Skip to main content
This page covers Gemini hosted on Google Vertex AI. For Gemini through Google AI Studio API keys, see the Google Gemini guide. GoModel routes Vertex chat and Responses API requests through Vertex AI’s native Gemini publisher endpoint by default. You can switch to Vertex’s OpenAI-compatible endpoint when you need its compatibility behavior.
Vertex authentication is enterprise-oriented and may become paid or licensed in a future release.

Before you start

  • A Google Cloud project with Vertex AI enabled.
  • A Vertex region where the model you want is available (e.g. us-central1, europe-west4).
  • Either Application Default Credentials (via gcloud auth application-default login, GKE Workload Identity, or a metadata server) or a service-account JSON key.

Configure Vertex AI

Use the VERTEX_* prefix. Vertex providers use the dedicated vertex provider type:
This registers provider vertex, type vertex. Vertex requires both project and location. VERTEX_AUTH_TYPE defaults to Application Default Credentials (gcp_adc) when service-account fields are not set. Or in config.yaml:

Service-account authentication

Use service-account JSON directly when ADC is not appropriate:

Multiple regions or accounts

For multiple Vertex regions or accounts, use suffixed env vars:
These register providers vertex_us and vertex_eu.

Native versus OpenAI-compatible mode

Vertex native mode is enabled by default:
Set VERTEX_API_MODE=openai_compatible to route chat and Responses API requests through Vertex’s OpenAI-compatible endpoint instead. The default Vertex bases are derived from project and location:
  • OpenAI-compatible: https://aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/openapi
  • native Gemini: https://aiplatform.googleapis.com/v1/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.

Image URL behavior

Like AI Studio Gemini, native mode supports inline image data only:
Remote https://... image URLs are rejected in native mode. Set VERTEX_API_MODE=openai_compatible to pass the OpenAI-compatible image_url shape through to Vertex’s OpenAI-compatible endpoint instead.

Current support

Integrated:
  • chat completions and streaming
  • Responses API and streaming
  • model listing via Vertex publisher models
  • Vertex embeddings through native prediction
  • usage metadata normalization for native responses
  • tool calls and function-call results
  • inline image data via data: URLs in native mode
Not integrated yet:
  • fetching remote image_url values
  • Vertex Files and batch prediction APIs
References: