🌐
Go Packages
pkg.go.dev › cloud.google.com › go › vertexai
vertexai package - cloud.google.com/go/vertexai - Go Packages
April 9, 2026 - Package vertexai provides a client for interacting with Vertex AI APIs. New users are encouraged to use the Google GenAI Go SDK available at google.golang.org/genai.
🌐
GitHub
github.com › uber › go-vertex-ai
GitHub - uber/go-vertex-ai: A go implementation of the Google VertexAI API · GitHub
A go implementation of the Google VertexAI API. Contribute to uber/go-vertex-ai development by creating an account on GitHub.
Starred by 48 users
Forked by 4 users
Languages   Go
🌐
Medium
medium.com › google-cloud › generative-ai-app-development-using-vertex-ai-and-golang-cf315c7fa4e1
Generative AI app development using Vertex AI and Golang | by Edi Wiraya | Google Cloud - Community | Medium
July 22, 2023 - In this article, we are going to use Vertex AI pre-trained large language model PaLM 2 for Text (aka. text-bison) to create an outline for a scientific essay using your input topic and a predefined prompt. You can easily tweak it to fit other needs and explore the power of PaLM 2 generative AI features. Inspired by Deploying a Google Cloud Generative AI App in a Website with Cloud Run, I write this article focusing on application development aspect in Go (Golang) instead of commonly available Python examples.
🌐
Go Packages
pkg.go.dev › cloud.google.com › go › vertexai › genai
genai package - cloud.google.com/go/vertexai/genai - Go Packages
April 9, 2026 - Package genai is a client for the generative VertexAI model. New users are encouraged to use the Google GenAI Go SDK available at google.golang.org/genai
🌐
P. Galeone's blog
pgaleone.eu › golang › vertexai › 2023 › 08 › 27 › vertex-ai-custom-training-go-golang
Custom model training & deployment on Google Cloud using Vertex AI in Go
How I built an automated stock analysis system that leverages Gemini to parse Italian financial news feeds, providing real-time trading recommendations. This article explores the architecture, challenges, and implementation details of integrating AI-powered news analysis into a Go-based trading system. Complete migration guide from Vertex AI SDK to Google Gen AI SDK for Python and Go developers.
🌐
Stack Overflow
stackoverflow.com › questions › 76826580 › using-vertexai-google-generative-ai-in-golang
go - Using VertexAI (Google Generative AI) in Golang - Stack Overflow
I am implementing this curl request in golang for connecting to vertexi generative AI models. I am using the token generated by this command for authentication gcloud auth print-access-token. But the
🌐
Google Cloud
cloud.google.com › client libraries › vertex ai api v1 - package cloud.google.com/go/aiplatform/apiv1 (v1.125.0)
Vertex AI API v1 - Package cloud.google.com/go/aiplatform/apiv1 (v1.125.0) | Go client libraries | Google Cloud Documentation
April 17, 2025 - func (it *AnnotationIterator) Next() (*aiplatformpb.Annotation, error) Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done. func (it *AnnotationIterator) PageInfo() *iterator.PageInfo · PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
Find elsewhere
🌐
GitHub
github.com › googleapis › google-cloud-go › blob › main › vertexai › genai › client.go
google-cloud-go/vertexai/genai/client.go at main · googleapis/google-cloud-go
// go install golang.org/x/exp/protoveneer/cmd/protoveneer@latest · · //go:generate protoveneer -license license.txt config.yaml ../../aiplatform/apiv1beta1/aiplatformpb · · package genai · · import ( "context" "fmt" "io" "log" "os" "strings" · aiplatform "cloud.google.com/go/aiplatform/apiv1beta1" pb "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb" "cloud.google.com/go/vertexai/internal" "google.golang.org/api/iterator" "google.golang.org/api/option" "google.golang.org/genai" ) ·
Author   googleapis
Top answer
1 of 3
9

As @DazWilkin suggested, configure the client option to specify the specific regional endpoint with a port 443:

Copyoption.WithEndpoint("<region>-aiplatform.googleapis.com:443")

Try like below:

Copyfunc main() {
 
   ctx := context.Background()
   c, err := aiplatform.NewPredictionClient(
       ctx,
       option.WithEndpoint("<region>-aiplatform.googleapis.com:443"),
   )
   if err != nil {
       log.Printf("QueryVertex NewPredictionClient - Err:%s", err)
   }
   defer c.Close()
       .
       .
2 of 3
1

I'm unfamiliar with Google's (Vertex?) AI Platform and unable to test this hypothesis but it appears that the API uses location-specific endpoints.

Can you try configuring the client's ClientOption to specify the specific regional endpoint, i.e.:

Copyurl := fmt.Sprintf("https://%s-aiplatform.googleapis.com", location)
opts := []option.ClientOption{
    option.WithEndpoint(url),
}

And:

Copypackage main

import (
    "context"
    "fmt"
    "log"
    "os"

    aiplatform "cloud.google.com/go/aiplatform/apiv1"

    "google.golang.org/api/option"
    aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1"
    "google.golang.org/protobuf/types/known/structpb"
)

const file = "MY_BASE64_IMAGE"

func main() {
    // Values from the environment
    project := os.Getenv("PROJECT")
    location := os.Getenv("LOCATION")
    endpoint := os.Getenv("ENDPOINT")

    ctx := context.Background()

    // Configure the client with a region-specific endpoint
    url := fmt.Sprintf("https://%s-aiplatform.googleapis.com", location)
    opts := []option.ClientOption{
        option.WithEndpoint(url),
    }

    c, err := aiplatform.NewPredictionClient(ctx, opts...)
    if err != nil {
        log.Fatal(err)
    }
    defer c.Close()

    parameters, err := structpb.NewValue(map[string]interface{}{
        "confidenceThreshold": 0.2,
        "maxPredictions":      5,
    })
    if err != nil {
        log.Fatal(err)
    }

    instance, err := structpb.NewValue(map[string]interface{}{
        "content": file,
    })
    if err != nil {
        log.Printf("QueryVertex structpb.NewValue instance - Err:%s", err)
    }

    rqst := &aiplatformpb.PredictRequest{
        Endpoint: fmt.Sprintf("projects/%s/locations/%s/endpoints/%s",
            project,
            location,
            endpoint,
        ),
        Instances: []*structpb.Value{
            instance,
        },
        Parameters: parameters,
    }

    resp, err := c.Predict(ctx, rqst)
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("QueryVertex Res:%+v", resp)
}
🌐
P. Galeone's blog
pgaleone.eu › golang › vertexai › 2024 › 02 › 26 › gemini-go-limits-details
Using Gemini in a Go application: limits and details – P. Galeone's blog
February 26, 2024 - This article explores using Gemini within Go applications via Vertex AI. We'll delve into the limitations encountered, including the model's context window size and regional restrictions. We'll also explore various methods for feeding data to Gemini, highlighting the challenges faced due to ...
🌐
P. Galeone's blog
pgaleone.eu › cloud › 2025 › 06 › 29 › vertex-ai-to-genai-sdk-service-account-auth-python-go
From Vertex AI SDK to Google Gen AI SDK: Service Account Authentication for Python and Go – P. Galeone's blog
June 29, 2025 - Complete migration guide from Vertex AI SDK to Google Gen AI SDK for Python and Go developers. Covers service account authentication, OAuth2 scope limitations, and the critical implementation details missing from Google's official documentation.
🌐
Reddit
reddit.com › r/golang › from vertex ai sdk to google gen ai sdk: service account authentication for python and go
r/golang on Reddit: From Vertex AI SDK to Google Gen AI SDK: Service Account Authentication for Python and Go
June 29, 2025 - From Vertex AI SDK to Google Gen AI SDK: Service Account Authentication for Python and Go · r/Bard • · r/Bard · r/Bard is a subreddit dedicated to discussions about Google's Gemini (Formerly Bard) AI. This subreddit is not affiliated with Google. Members Online · pgaleone · upvotes · Session-Based Authentication in Go · r/golang • ·
🌐
Stack Overflow
stackoverflow.com › questions › 78869270 › vertex-ai-vector-search-query-via-golang-troubleshooting
go - Vertex AI Vector Search Query via Golang Troubleshooting - Stack Overflow
I am attempting to utilize the Go Vertex AI SDK in order to use some of the functionalities on Vertex AI. Specifically, I want to query from a deployed matching engine index via Go. I am running this on go 1.22.5, and using cloud.google.com/go/aiplatform version 1.68.0 · Here is my implementation: package main import ( "fmt" "context" "regexp" aiplatformpb "cloud.google.com/go/aiplatform/apiv1/aiplatformpb" aiplatform "cloud.google.com/go/aiplatform/apiv1" "google.golang.org/api/option" "google.golang.org/protobuf/types/known/structpb" ) func embedTexts() { ...
🌐
Medium
didikmulyadi.medium.com › retrieval-augmented-generation-rag-with-vertex-ai-and-golang-for-financial-applications-8795ea731c87
Retrieval-Augmented Generation (RAG) with Vertex AI and Golang for Financial Applications | by Didik Mulyadi | Medium
February 27, 2025 - Basically, it will be handled by AI and it called “function calling”. We will focus only in the backend (Golang) and Vertex AI (Gemini) regarding user input and result.
🌐
LinkedIn
linkedin.com › posts › ferminblanco_building-a-semantic-search-with-vertex-ai-activity-7121898965976895488-Ob-P
How to build semantic search with Vertex AI | Fermin Blanco posted on the topic | LinkedIn
October 22, 2023 - Here are the steps involved: 🤖 Create a Vertex AI project and enable the Text Embedding API. 🤖 Create a dataset of text documents that you want to index. 🤖 Train a text embedding model on your dataset. 🤖 Deploy the text embedding model to Vertex Search. 🤖 Query the text embedding model and return the most relevant results. https://lnkd.in/e8uXMNK8 #Golang #VertexAI #GoogleAI #GoogleCloud #GenerativeAI #VectorSearch
🌐
Google
docs.cloud.google.com › gemini enterprise agent platform › google gen ai sdk
Google Gen AI SDK | Gemini Enterprise Agent Platform | Google Cloud Documentation
from google import genai # TODO(developer): Update below line API_KEY = "YOUR_API_KEY" client = genai.Client(vertexai=True, api_key=API_KEY) response = client.models.generate_content( model="gemini-3.5-flash", contents="Explain bubble sort to me.", ) print(response.text) # Example response: # Bubble Sort is a simple sorting algorithm that repeatedly steps through the list · The Google Gen AI SDK for Go is available on go.dev and GitHub: google-genai on go.dev · go-genai on GitHub · go get google.golang.org/genai ·
🌐
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 - Initialize the module and add the Vertex AI dependency: go mod init my-function go get google.golang.org/genai · Here is a Cloud Function that takes a prompt and returns a Gemini response.
🌐
Reddit
reddit.com › r/golang › custom model training & deployment on google cloud using vertex ai in go
r/golang on Reddit: Custom model training & deployment on Google Cloud using Vertex AI in Go
August 27, 2023 - Custom model training & deployment on Google Cloud using Vertex AI in Go · r/programming • · r/programming · Computer Programming · Members · Online · pgaleone · upvote · What network-focused projects are you currently building in Go? r/golang • ·