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" client, err := genai.NewClient(ctx, &genai.ClientConfig{ APIKey: apiKey, Backend: genai.BackendGeminiAPI, }) client, err := genai.NewClient(ctx, &genai.ClientConfig{ Project: project, Location: location, Backend: genai.BackendEnterprise, }) You can create a client by configuring the necessary environment variables. Configuration setup instructions depends on whether you're using the Gemini Developer API or the Gemini API in Gemini Enterprise Agent Platform.
Starred by 1.1K users
Forked by 152 users
Languages Go
GitHub
github.com › google › generative-ai-go
GitHub - google/generative-ai-go: Go SDK for Google Generative AI · GitHub
With Gemini 2.0, we took the chance to create a single unified SDK for all developers who want to use Google's GenAI models (Gemini, Veo, Imagen, etc).
Starred by 856 users
Forked by 101 users
Languages Go 98.7% | Shell 1.3%
Videos
22:45
AI ChatBot with Gemini + Tool calling (Golang Tutorial) - YouTube
06:27
2DT SWE | Golang GPT + Gemini Analyzer | How to use Gemini API ...
05:32
Gemini AI API with Go Golang Tutorial - YouTube
04:09
Ground Gemini with Google Search with the Gen AI SDK - YouTube
12:07
Gemini API with Python - Getting Started Tutorial - YouTube
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]) }
GitHub
github.com › makew0rld › go-gemini
GitHub - makew0rld/go-gemini: Client and server library for the Gemini protocol, in Go.
Starred by 67 users
Forked by 8 users
Languages Go 100.0% | Go 100.0%
Reddit
reddit.com › r/golang › working with gemini api in go
r/golang on Reddit: working with gemini api in go
March 20, 2024 -
ive been wanting to use the gemini api in some projects i have but the documentation is not very helpful and provides barely any information in go while other languages are very well documented in the official gemini api documentation. anyone who knows how it it can be used please help
Top answer 1 of 3
3
https://ai.google.dev/tutorials/go_quickstart
2 of 3
3
Thats a nice example! If your operating on any GCP compute service like GCE or Cloud Run, you dont need to authenticate like that - gcp compute services have metadata server which client will pull from. Other helpful tip: genai.Part is an interface - so you can use type assertion to convert to strings as needed. If you need RAG either use an OSS or MatchingEngine now known as Vector Search. Powerful stuff. You'll also need Gecko for embeddings.
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 := genai.NewClient(ctx, &genai.ClientConfig{})
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
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 › git.sr.ht › ~yotam › go-gemini
gemini package - git.sr.ht/~yotam/go-gemini - Go Packages
go-gemini is a library that provide an easy interface to create client and servers that speak the Gemini protocol.
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 › ~adnano › go-gemini
gemini package - git.sr.ht/~adnano/go-gemini - Go Packages
May 11, 2024 - Package gemini provides Gemini client and server implementations.
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
sourcehut
sr.ht › ~jzs › gemini
gemini: gemini client, server and browser implementation written in go
gemini client, server and browser implementation written in go · 59956df Guard generating hints for 0 elements · ~jzs pushed to ~jzs/gomb git 5 years ago · 36469d4 Hints as qutebrowser. ~jzs pushed to ~jzs/gomb git 5 years ago · View project feed RSS Report abuse ·
Go Packages
pkg.go.dev › google.golang.org › adk › model › gemini
gemini package - google.golang.org/adk/model/gemini - Go Packages
January 30, 2026 - It uses the provided context and configuration to initialize the underlying genai.Client. The modelName specifies which Gemini model to target (e.g., "gemini-2.5-flash"). An error is returned if the genai.Client fails to initialize. This section is empty. View all Source files ·
Go Packages
pkg.go.dev › github.com › makeworld-the-better-one › go-gemini
gemini package - github.com/makeworld-the-better-one/go-gemini - Go Packages
Package gemini provides an easy interface to create client and servers that speak the Gemini protocol.
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.