Skip to main content

Overview

The Google on Vertex AI provider gives you access to Gemini chat, embedding, and native image models as well as Imagen through Google Cloud. It uses the same model behavior as @core-ai/google-genai, while configuring the Google SDK for Vertex AI authentication and regional endpoints.

Installation

createGoogleVertex()

Create a Google provider targeting one Google Cloud project and region.

Options

projectId
string
Google Cloud project ID. Required unless a preconfigured client is supplied.
region
string
Vertex AI location, such as europe-west1 or us-central1. Required unless a preconfigured client is supplied.
credentials
GoogleVertexServiceAccountCredentials
Parsed service-account JSON. When omitted, the Google SDK uses Application Default Credentials.
client
GoogleGenAIClient
A preconfigured Google client. When supplied, projectId, region, and credentials are not used.

Returns

GoogleVertexProvider with chatModel(), embeddingModel(), and imageModel() methods.

Authentication

Application Default Credentials

Without explicit credentials, the provider uses Application Default Credentials (ADC):
ADC is recommended for workloads running on Google Cloud. For local development, configure ADC with the Google Cloud CLI:

Service-account credentials

Parse a service-account JSON key and pass the resulting object:
GOOGLE_APPLICATION_CREDENTIALS_JSON accepts either plain JSON or base64-encoded JSON. This is separate from Google’s standard GOOGLE_APPLICATION_CREDENTIALS env var, which points to a credentials file path for ADC.

Custom client

You can inject a preconfigured Google client:

Models and regions

Use model IDs available to your project in the selected Vertex AI region:
Model availability varies by region. Since a provider instance targets one region, create separate providers for models hosted in different locations. Imagen models such as imagen-4.0-generate-001 are also supported when they are available to the selected project and region.

Examples

Chat and streaming

Embeddings

Image generation

Gemini image models return base64 image data and do not support requesting multiple outputs with n. Imagen model IDs use the dedicated Imagen API and support n.

Provider-specific options

Provider options remain namespaced under google, matching @core-ai/google-genai:
The Google provider-option schemas, GoogleReasoningMetadata, and getGoogleModelCapabilities() are exported by @core-ai/google-vertex.

Error handling

Errors are wrapped as ProviderError with provider ID google-vertex:

Google GenAI Provider

Use Gemini through the Google AI API

Anthropic on Vertex AI

Use Claude through Vertex AI