🌐
DEV Community
dev.to › pradumnasaraf › building-an-ai-powered-cli-with-golang-and-google-gemini-45a1
Building an AI-Powered CLI with Golang and Google Gemini - DEV Community
August 27, 2024 - package cmd import ( "context" "fmt" "log" "os" "github.com/google/generative-ai-go/genai" "github.com/spf13/cobra" "google.golang.org/api/option" ) // searchCmd represents the search command var searchCmd = &cobra.Command{ Use: "search", Short: "A brief description of your command", // Added the getResponse() function Run: func(cmd *cobra.Command, args []string) { getResponse() }, } func init() { rootCmd.AddCommand(searchCmd) } func getResponse() { ctx := context.Background() client, err := genai.NewClient(ctx, option.WithAPIKey(os.Getenv("GEMINI_API_KEY"))) if err != nil { log.Fatal(err) } defer client.Close() model := client.GenerativeModel("gemini-1.5-flash") resp, err := model.GenerateContent(ctx, genai.Text("Write a story about a AI and magic")) if err != nil { log.Fatal(err) } fmt.Println(resp.Candidates[0].Content.Parts[0]) }
🌐
Liu Houliang
liuhouliang.com › en › post › go_gemini
Use Google Gemini API in Go - Liu Houliang
February 19, 2024 - Call client.Close() to close it proactively. Use a model specifically tailored to your use case (e.g., gemini-pro-vision for multimodal input, gemini-pro for text generation and continuous dialogue). import "github.com/google/generative-ai-go/genai" import "google.golang.org/api/option" ctx := context.Background() // Access your API key as an environment variable (see "Set up your API key" above) client, err := genai.NewClient(ctx, option.WithAPIKey(os.Getenv("API_KEY"))) if err != nil { log.Fatal(err) } defer client.Close() model := client.GenerativeModel("MODEL_NAME") When the prompt input i
Discussions

A simple guide to setting up Gemini 2.5 Pro, free, without running into 3rd party rate limits
They just announced pricing for the 2.5 model, enjoy it while the promotional period lasts, it won't be free for much longer... More on reddit.com
🌐 r/ChatGPTCoding
172
196
April 4, 2025
Gemini-Go
I'm here to share this very simple library to talk to the Gemini API. https://github.com/estefspace/gemini-go More on reddit.com
🌐 r/golang
9
0
May 4, 2025
🌐
CloudZenia Blogs
cloudzenia.com › home › blogs › how to implement gemini ai model in golang: a comprehensive tutorial
Implement Gemini AI Model in Golang: A Complete Guide | CloudZenia
December 4, 2025 - Learn step-by-step how to implement the Gemini AI model in Golang with our comprehensive guide. Build powerful AI applications efficiently - CloudZenia blog
🌐
PixelsTech
pixelstech.net › home › articles › gemini example with go
Gemini Example with Go | PixelsTech
December 15, 2024 - To connect and use Gemini with Go, Google's LLM, one can use their official Go SDK for doing this. In this post, we will just show a simple chat example to demonstrate how to make it work with Go.
🌐
GitHub
github.com › google › generative-ai-go
GitHub - google/generative-ai-go: Go SDK for Google Generative AI · GitHub
The Gemini API docs are fully updated to show examples of the new Google Gen AI SDK: Get started.
Starred by 856 users
Forked by 101 users
Languages   Go 98.7% | Shell 1.3%
🌐
GitHub
github.com › googleapis › go-genai
GitHub - googleapis/go-genai: Google Gen AI Go SDK provides an interface for developers to integrate Google's generative models into their Go applications. · GitHub
May 22, 2026 - import "google.golang.org/genai" ... location, Backend: genai.BackendEnterprise, }) You can create a client by configuring the necessary environment variables....
Starred by 1.1K users
Forked by 152 users
Languages   Go
🌐
GitHub
github.com › makew0rld › go-gemini
GitHub - makew0rld/go-gemini: Client and server library for the Gemini protocol, in Go.
Client and server library for the Gemini protocol, in Go. - makew0rld/go-gemini
Starred by 67 users
Forked by 8 users
Languages   Go 100.0% | Go 100.0%
Find elsewhere
🌐
GitHub
github.com › xyproto › geminiclient
GitHub - xyproto/geminiclient: Simple way to use Gemini from Go, including function calls / tools
Simple way to use Gemini from Go, including function calls / tools - xyproto/geminiclient
Author   xyproto
🌐
GitHub
github.com › jyap808 › go-gemini
GitHub - jyap808/go-gemini: Gemini API in Golang
go-gemini is an implementation of the Gemini API (public and private) in Golang. Based off of https://github.com/toorop/go-bittrex/ import "github.com/jyap808/go-gemini" This library is more of a framework for some bots I use so it is expected ...
Author   jyap808
🌐
Eli Bendersky
eli.thegreenplace.net › 2023 › using-gemini-models-from-go
Using Gemini models from Go - Eli Bendersky's website
package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/google/generative-ai-go/genai" "google.golang.org/api/option" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, option.WithAPIKey(os.Getenv("API_KEY"))) if err != nil { log.Fatal(err) } defer client.Close() model := client.GenerativeModel("gemini-pro-vision") imgData1, err := os.ReadFile("../images/turtle1.png") if err != nil { log.Fatal(err) } imgData2, err := os.ReadFile("../images/turtle2.png") if err != nil { log.Fatal(err) } prompt := []genai.Part{ genai.ImageData("png", imgData1), genai.ImageData("png", imgData2), genai.Text("Describe the difference between these two pictures, with scientific detail"), } resp, err := model.GenerateContent(ctx, prompt...) if err != nil { log.Fatal(err) } bs, _ := json.MarshalIndent(resp, "", " ") fmt.Println(string(bs)) }
🌐
OneUptime
oneuptime.com › home › blog › use the google gen ai go sdk to call gemini models from a cloud function
Use the Google Gen AI Go SDK to Call Gemini Models from a Cloud Function
February 17, 2026 - Here is a Cloud Function that takes a prompt and returns a Gemini response. package myfunction import ( "context" "encoding/json" "fmt" "log" "net/http" "os" "github.com/GoogleCloudPlatform/functions-framework-go/functions" "google.golang.org/genai" ) // init registers the Cloud Function entry point func init() { functions.HTTP("GenerateText", GenerateText) } // GenerateRequest represents the incoming request payload type GenerateRequest struct { Prompt string `json:"prompt"` MaxTokens int `json:"max_tokens,omitempty"` Temperature float32 `json:"temperature,omitempty"` } // GenerateResponse re
🌐
Go Packages
pkg.go.dev › git.sr.ht › ~yotam › go-gemini
gemini package - git.sr.ht/~yotam/go-gemini - Go Packages
ErrorResponse create a response from the given error with the error string as the Meta field. If the error is of type gemini.Error, the status will be taken from the status field, otherwise it will default to StatusTemporaryFailure.
🌐
Medium
kkamalesh117.medium.com › build-golang-gemini-ai-chat-63e520d29f42
Build GoLang Gemini-AI Chat. Powered with Redis Cache | LINK For… | by Kamalesh D | Medium
September 14, 2024 - In this blog post, we’ll explore how to create a chat application powered by Gemini PRO using the Go programming language. We’ll cover the integration of this model, handling user prompts, and implementing a apikey based caching system for a more personalized experience. To utilize this application, you’ll need an API key from ai.google.dev · Go (Golang): A statically typed, compiled language designed for simplicity and efficiency.
🌐
Go Packages
pkg.go.dev › google.golang.org › genai
genai package - google.golang.org/genai - Go Packages
3 weeks ago - Gemini API on Gemini Enterprise Agent Platform: Set GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION, as shown below: export GOOGLE_GENAI_USE_ENTERPRISE=true export GOOGLE_CLOUD_PROJECT='your-project-id' export GOOGLE_CLOUD_LOCATION='us-central1' client, err := ...
🌐
Go Packages
pkg.go.dev › github.com › google › generative-ai-go › genai
genai package - github.com/google/generative-ai-go/genai - Go Packages
May 2, 2025 - package main import ( "context" "fmt" "log" "os" "github.com/google/generative-ai-go/genai" "google.golang.org/api/option" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, option.WithAPIKey(os.Getenv("GEMINI_API_KEY"))) if err != nil { log.Fatal(err) } defer client.Close() model := client.GenerativeModel("gemini-1.5-flash") cs := model.StartChat() cs.History = []*genai.Content{ { Parts: []genai.Part{ genai.Text("Hello, I have 2 dogs in my house."), }, Role: "user", }, { Parts: []genai.Part{ genai.Text("Great to meet you.
🌐
Go Packages
pkg.go.dev › google.golang.org › adk › model › gemini
gemini package - google.golang.org/adk/model/gemini - Go Packages
January 30, 2026 - func NewModel(ctx context.Context, modelName string, cfg *genai.ClientConfig) (model.LLM, error) NewModel returns model.LLM, backed by the Gemini API.
🌐
Google AI
ai.google.dev › gemini api › getting started with gemini api
Getting started with Gemini API | Google AI for Developers
2 weeks ago - To use the Gemini API, you need an API key. Create one for free to get started: ... Install the SDK and generate text with a single API call. ... from google import genai client = genai.Client() interaction = client.interactions.create( ...
🌐
Google AI
ai.google.dev › gemini api › using gemini api keys
Using Gemini API keys | Google AI for Developers
1 week ago - import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({ apiKey: "YOUR_API_KEY" }); async function main() { const interaction = await ai.interactions.create({ model: "gemini-3.5-flash", input: "Explain how AI works in a few words", }); console.log(interaction.output_text); } main(); package main import ( "context" "fmt" "log" "google.golang.org/genai" "google.golang.org/genai/interactions" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, &genai.ClientConfig{ APIKey: "YOUR_API_KEY", Backend: genai.BackendGeminiAPI, }) if err != nil { log.Fatal(err
🌐
DEV Community
dev.to › gde › mcp-development-with-go-and-gemini-cli-12bj
MCP Development with Go and Gemini CLI - DEV Community
February 12, 2026 - One of the key goals of this tutorial is to validate that a compiled language like Go can be used for AI software development beyond the traditional interpreted languages. Go, also known as Golang...