This page covers Gemini hosted on Google Vertex AI. For Gemini through
Google AI Studio API keys, see the Google Gemini guide.
Vertex needs a GCP project, a region where the model is available, and either
Application Default Credentials or a service-account JSON key. GoModel routes
to Vertex’s native Gemini publisher endpoint by default; switch to the
OpenAI-compatible endpoint when you need its compatibility behavior.
Vertex authentication is enterprise-oriented and may become paid or
licensed in a future release.
VERTEX_PROJECT=my-gcp-project
VERTEX_LOCATION=us-central1
VERTEX_AUTH_TYPE=gcp_adc # default; ADC via gcloud, GKE Workload Identity, or metadata server
VERTEX_API_MODE=native # or openai_compatible
Or in config.yaml:
providers:
vertex:
type: vertex
auth_type: gcp_adc
vertex_project: my-gcp-project
vertex_location: us-central1
api_mode: native
Service-account authentication
VERTEX_AUTH_TYPE=gcp_service_account
VERTEX_SERVICE_ACCOUNT_FILE=/secrets/service-account.json
# or VERTEX_SERVICE_ACCOUNT_JSON / VERTEX_SERVICE_ACCOUNT_JSON_BASE64
Multiple regions or accounts
Use suffixed env vars to register additional Vertex providers:
VERTEX_US_PROJECT=prod-ai
VERTEX_US_LOCATION=us-central1
VERTEX_US_AUTH_TYPE=gcp_adc
VERTEX_EU_PROJECT=prod-ai
VERTEX_EU_LOCATION=europe-west4
VERTEX_EU_AUTH_TYPE=gcp_service_account
VERTEX_EU_SERVICE_ACCOUNT_FILE=/secrets/vertex-eu.json
This registers vertex-us and vertex-eu.
Base URLs and modes
Default bases are derived from project and location:
- OpenAI-compatible:
.../projects/{project}/locations/{location}/endpoints/openapi
- native Gemini:
.../projects/{project}/locations/{location}/publishers/google
Vertex embeddings use Vertex AI native prediction regardless of
VERTEX_API_MODE. Vertex does not expose Gemini Files or OpenAI-compatible
batch operations.
| Mode | OpenAI-style image_url |
|---|
native (default) | inline data: URLs only — remote https://... URLs are rejected |
openai_compatible | OpenAI-style remote URLs pass through to Vertex’s OpenAI-compatible endpoint |
Not yet integrated
- Automatic fetching of remote
image_url values in native mode.
- Vertex Files and batch prediction APIs.
References