Learn how to instrument Google Gemini API calls in Go using the LangWatch SDK via a Vertex AI endpoint.
gcloud
CLI. The token is short-lived (typically 1 hour) and needs to be refreshed.
gcloud
directly.https://<region>-aiplatform.googleapis.com/v1/projects/<project-id>/locations/<region>/publishers/google/models/<model-name>
For example:
https://us-central1-aiplatform.googleapis.com/v1/projects/my-gcp-project/locations/us-central1/publishers/google/models/gemini-1.5-pro-001
openai.Client
with the constructed Vertex AI URL and the temporary access token. The gen_ai.system
attribute should be set to "google"
.
Model
parameter in the request body is less critical, it’s good practice to set it to the model you are targeting.