Skip to content

Gemini Enterprise plugin

The Gemini Enterprise plugin provides access to Gemini Enterprise, offering capabilities for building, scaling, and governing agents alongside model access, grounding, Vector Search, Model Garden, and evaluation metrics.

Accessing Google GenAI Models via the Gemini Enterprise API

Section titled “Accessing Google GenAI Models via the Gemini Enterprise API”

All languages support accessing Google’s generative AI models (Gemini, Imagen, etc.) via the Gemini Enterprise API with enterprise authentication and features.

The unified Google GenAI plugin provides access to models via the Gemini Enterprise API using the vertexAI initializer:

Terminal window
npm i --save @genkit-ai/google-genai
import { genkit } from 'genkit';
import { vertexAI } from '@genkit-ai/google-genai';
const ai = genkit({
plugins: [
vertexAI(), // Default: us-central1; Interactions API and Lyria 3 models use global
// vertexAI({ location: 'global' }), // Global endpoint
// vertexAI({ location: 'us-central1' }), // Regional endpoint (not for Interactions API models)
],
});

Models are served from different locations, so check a model’s location before you choose one for the plugin. Current Gemini models, including the ones on generateContent such as gemini-3.5-flash and gemini-3.1-pro-preview, as well as the Gemini image, text-to-speech, Omni, and Lyria models, are served from global (some also from the us and eu multi-regions), not from us-central1. Veo 3.1 is served only from us-central1, virtual-try-on-001 only from regions, and gemini-embedding-2 from global and the us and eu multi-regions but not from us-central1. Gemini, Veo, and Lyria models accept a per-request config.location that overrides the plugin’s; embedders always use the plugin’s location. See Gemini Enterprise Agent Platform locations.

Authentication Methods:

  • Application Default Credentials (ADC): The standard method for most Gemini Enterprise use cases, especially in production. It uses the credentials from the environment (e.g., service account on GCP, user credentials from gcloud auth application-default login locally). This method requires a Google Cloud Project with billing enabled and the Gemini Enterprise API (aiplatform.googleapis.com) enabled.
  • Gemini Enterprise Express Mode: A streamlined way to try out many Gemini Enterprise features using just an API key, without needing to set up billing or full project configurations. This is ideal for quick experimentation and has generous free tier quotas. Learn More about Express Mode.
// Using Gemini Enterprise Express Mode (Easy to start, some limitations)
// Get an API key from the Gemini Enterprise Express Mode setup.
vertexAI({ apiKey: process.env.VERTEX_EXPRESS_API_KEY }),

Note: When using Express Mode, you do not provide projectId and location in the plugin config.

The plugin resolves unlisted model IDs dynamically when a request names one, so any Google GenAI model ID that Gemini Enterprise serves in the configured location works, including models released after this version of the plugin and tuned endpoints (endpoints/<id>). Pass a bare model ID to vertexAI.model('<model-id>') or pass a prefixed 'vertexai/<model-id>' string reference. The following list covers the models that the plugin pre-registers for IDE autocomplete and capability metadata—it is not an allowlist. Unlisted model IDs resolve on demand with default capabilities for their model family. (Third-party Model Garden models use the separate @genkit-ai/vertexai/modelgarden plugin described in Model Garden Integration.)

Gemini 4 and 3 Series - Latest models with state-of-the-art reasoning and multimodal capabilities:

  • gemini-4-argon - Gemini 4 Argon
  • gemini-3.8-flash - Most intelligent Flash model, engineered for complex reasoning, coding, and agentic workflows
  • gemini-3.1-pro-preview - Preview of the most capable model for complex reasoning and problem solving
  • gemini-3.5-flash-lite - Fastest, most cost-effective model for high-throughput execution
  • gemini-nano-banana-2.1 - Fast and efficient image generation and editing
  • gemini-3-pro-image - State-of-the-art image generation and editing for complex visual tasks

Text-to-speech - gemini-3.8-flash-tts, gemini-3.8-flash-lite-tts (see Text-to-speech)

Video (Gemini Omni) - gemini-omni-1.1-flash-preview, gemini-omni-flash-preview (see Video Generation (Gemini Omni))

Newer Gemini models (such as gemini-4-argon and gemini-3.8-flash), Gemini Omni video models, and any Gemini model the plugin does not list go to the Interactions API. Gemini Enterprise doesn’t list the Google AI -latest aliases, so use a versioned model ID. Older models (such as gemini-3.5-flash, gemini-3.1-pro-preview, and the Gemini 2.5 family), image models, text-to-speech models, and tuned model endpoints stay on generateContent. text, reasoning, media, tool calls, streaming, and usage work the same on both; response.raw has a different shape (a GeminiInteraction with a steps[] timeline). Some generateContent options don’t apply: thinkingConfig.thinkingBudget is dropped with a warning (use thinkingLevel), and videoMetadata on media parts is ignored. Unlike the Google AI plugin, safetySettings and labels are supported on these models.

The Interactions API is available on the global location (and on the us and eu multi-regions with CMEK), and in Express mode. If you do not set a location (no vertexAI({ location }), no GCLOUD_LOCATION, no config.location), these models use global and generateContent models use us-central1, where current Gemini models aren’t served, so give those a global location. A location you set is used as is, so a regional location such as us-central1 makes these models fail; use global or leave the location unset. Interactions are not stored by default; set config: { store: true } (or vertexAI({ store: true })) to store them and continue a conversation from the previous response’s messages.

import { genkit } from 'genkit';
import { vertexAI } from '@genkit-ai/google-genai';
const ai = genkit({
plugins: [vertexAI()],
});
const response = await ai.generate({
model: vertexAI.model('gemini-3.8-flash'),
prompt: 'Explain Gemini Enterprise in simple terms.',
});
console.log(response.text);

You can specify the payGo option to use Flex or Priority routing in Gemini Enterprise.

const response = await ai.generate({
model: vertexAI.model('gemini-3.8-flash'),
prompt: 'Explain Gemini Enterprise in simple terms.',
config: {
payGo: 'priority', // Can be 'priority', 'priority-only', 'flex', or 'flex-only'
},
});

Gemini models can process multimodal inputs, including images and video. When using videos, you can use videoMetadata to specify specific timestamps or sampling rates (only on models that use generateContent).

const response = await ai.generate({
model: vertexAI.model('gemini-3.5-flash'),
prompt: [
{ text: 'transcribe this video' },
{
media: {
url: 'gs://cloud-samples-data/video/animals.mp4',
contentType: 'video/mp4',
},
metadata: {
videoMetadata: {
fps: 0.5,
startOffset: '3.5s',
endOffset: '10.2s',
},
},
},
],
config: { location: 'global' }, // gemini-3.5-flash isn't served from us-central1
});

Available Models:

  • text-embedding-005 - English text (768 dimensions)
  • text-multilingual-embedding-002 - Multilingual text (768 dimensions)
  • multimodalembedding@001 - Text, image, and video (1408 dimensions)
  • gemini-embedding-001 - Text (3072 dimensions)
  • gemini-embedding-2 - Text, image, and video (3072 dimensions); a document’s text and media parts are embedded together, and taskType and title are ignored

Embedders run in the plugin’s location. gemini-embedding-2 is served from global and the us and eu multi-regions, but not from us-central1.

const embeddings = await ai.embed({
embedder: vertexAI.embedder('text-embedding-005'),
content: 'Embed this text.',
});

Imagen image generation models on Gemini Enterprise were retired on June 30, 2026. To generate or edit images, use a Gemini image model such as gemini-nano-banana-2.1 or gemini-3-pro-image.

Available Models:

  • virtual-try-on-001
// The virtual-try-on model requires two specific media inputs: the person and the product.
const response = await ai.generate({
model: vertexAI.model('virtual-try-on-001'),
prompt: [
{
media: { url: `data:image/png;base64,${personImageBase64}`, contentType: 'image/png' },
metadata: { type: 'personImage' },
},
{
media: { url: `data:image/png;base64,${productImageBase64}`, contentType: 'image/png' },
metadata: { type: 'productImage' },
},
],
});
const generatedImage = response.media;

Available Models:

  • gemini-omni-1.1-flash-preview
  • gemini-omni-flash-preview

These IDs differ from the Google AI plugin’s (gemini-omni-1.1-flash). Omni models use the Interactions API, so they need a location it supports (see Interactions API). Unlike Veo, generation isn’t a long-running operation: ai.generate() returns the video directly.

const response = await ai.generate({
model: vertexAI.model('gemini-omni-1.1-flash-preview'),
prompt: 'An origami butterfly flaps its wings and flies out of the french doors into the garden.',
config: {
videoFormat: { aspectRatio: '16:9', resolution: '720p' },
},
});
const video = response.media;
  • Images and videos in the prompt are used as inputs (for example, image to video or editing a video). config.videoConfig.task (text_to_video, image_to_video, reference_to_video, edit, extend) sets the kind of generation; without it, the model infers it from the prompt.
  • config.videoFormat sets aspectRatio (16:9, the default, or 9:16) and resolution (360p, 720p (the default), 1080p, or 4k; gemini-omni-flash-preview supports only 720p). The video is returned inline by default; set delivery: 'uri' and gcsUri in videoFormat to write it to Cloud Storage instead.
  • To edit a generated video in a follow-up turn, set config: { store: true } and pass the previous response’s messages.

Generate videos from text prompts or manipulate existing images to create dynamic video content.

Available Models:

  • veo-3.1-generate-001
  • veo-3.1-fast-generate-001
  • veo-3.1-lite-generate-001

Usage (Text-to-Video):

let { operation } = await ai.generate({
model: vertexAI.model('veo-3.1-lite-generate-001'),
prompt: 'A majestic dragon soaring over a mystical forest at dawn.',
config: {
aspectRatio: '16:9',
durationSeconds: 8,
resolution: '1080p',
personGeneration: 'allow_adult',
},
});
if (!operation) throw new Error('No operation returned');
while (!operation.done) {
operation = await ai.checkOperation(operation);
await new Promise((resolve) => setTimeout(resolve, 5000));
}
const video = operation.output?.message?.content.find((p) => !!p.media);

Video Extension:

You can extend an existing Veo-generated video by providing it as input to another generation request:

let { operation } = await ai.generate({
model: vertexAI.model('veo-3.1-generate-001'),
prompt: [
{ text: 'Track the butterfly into the garden as it lands on a flower.' },
{
media: {
contentType: 'video/mp4',
url: previousVeoVideo.media.url,
},
},
],
config: {
aspectRatio: '16:9', // Must match the original video
},
});

Generate high-quality music and audio clips.

Available Models:

  • lyria-3-pro-preview
  • lyria-3-clip-preview
  • lyria-002 (Legacy)

The Lyria 3 models use the Interactions API and are available only on the global location: if you don’t set a location they use global, and a regional location you set makes them fail.

Usage:

const response = await ai.generate({
model: vertexAI.model('lyria-3-pro-preview'),
prompt: 'A cheerful acoustic folk song with guitar and harmonica.',
});
const audioMedia = response.media;

Available Models:

  • gemini-3.8-flash-tts
  • gemini-3.8-flash-lite-tts

The text is read verbatim, so put delivery instructions in the part’s metadata.speechMetadata.style. Choose a voice with speechConfig.voiceConfig.voice (a prebuilt voice name or a voice ID); the Google AI plugin’s prebuiltVoiceConfig: { voiceName } shape also works. Text-to-speech models use generateContent and are served only from global, so the sample sets location: 'global'.

const response = await ai.generate({
model: vertexAI.model('gemini-3.8-flash-tts'),
prompt: [
{
text: 'Have a wonderful day!',
metadata: { speechMetadata: { style: 'cheerful and friendly' } },
},
],
config: {
location: 'global',
speechConfig: { voiceConfig: { voice: 'Kore' } },
},
});
const audio = response.media;

Without audioFormat, a non-streamed request returns a WAV file (audio/wav) and a streamed request returns raw PCM (audio/l16). Set config.audioFormat.mimeType to audio/wav, audio/l16, audio/mulaw, or audio/alaw to choose the format.

const response = await ai.generate({
model: vertexAI.model('gemini-3.1-pro-preview'),
prompt: 'what is heavier, one kilo of steel or one kilo of feathers',
config: {
location: 'global', // gemini-3.1-pro-preview is served only from global
thinkingConfig: {
thinkingLevel: 'HIGH', // Or 'LOW' or 'MEDIUM'
includeThoughts: true,
},
},
});

thinkingConfig.thinkingBudget is sent only to models on generateContent. It was designed for the Gemini 2.5 models, which reached their retirement date on October 20, 2026 (the plugin still registers them until the service stops serving them). Models on the Interactions API drop thinkingBudget with a warning; use thinkingLevel instead.

Section titled “Grounding (Gemini Enterprise Search & Google Search)”

Enable Google Search or Gemini Enterprise data stores to provide answers grounded in verifiable sources.

// Google Search Grounding
const searchResponse = await ai.generate({
model: vertexAI.model('gemini-3.8-flash'),
prompt: 'What are the top tech news stories this week?',
config: {
tools: [{ googleSearch: {} }],
},
});
// Gemini Enterprise Search Grounding
const vertexResponse = await ai.generate({
model: vertexAI.model('gemini-3.8-flash'),
prompt: 'Summarize our company policies.',
config: {
vertexRetrieval: {
datastore: {
projectId: 'your-project-id',
location: 'global', // Data store location: 'global', 'us', or 'eu'
dataStoreId: 'your-data-store-id',
},
},
},
});

Access third-party models through Model Garden in Gemini Enterprise:

Available Models:

  • claude-opus-4-7
  • claude-sonnet-4-6
  • claude-opus-4-6
  • claude-haiku-4-5@20251001
  • claude-sonnet-4-5@20250929
  • claude-sonnet-4@20250514
  • claude-opus-4-5@20251101
  • claude-opus-4-1@20250805
  • claude-opus-4@20250514
import { vertexModelGarden } from '@genkit-ai/vertexai/modelgarden';
const ai = genkit({
plugins: [vertexModelGarden({ location: 'us-central1' })],
});
const response = await ai.generate({
model: vertexModelGarden.model('claude-sonnet-4-6'),
prompt: 'What should I do when I visit Melbourne?',
});

Advanced Configuration (Optional):

You can provide configuration options to tailor the model’s behavior, such as enabling extended thinking features.

const response = await ai.generate({
model: vertexModelGarden.model('claude-sonnet-4-6'),
prompt: 'What should I do when I visit Melbourne?',
config: {
thinking: {
enabled: true,
budgetTokens: 2048,
},
output_config: {
effort: 'high', // Can be 'low', 'medium', 'high', or 'xhigh'
},
},
});

For the full list of available Claude models see: Available Claude models

Available Models:

  • meta/llama-4-maverick-17b-128e-instruct-maas
  • meta/llama-4-scout-17b-16e-instruct-maas
  • meta/llama-3.3-70b-instruct-maas
const ai = genkit({
plugins: [vertexModelGarden({ location: 'us-central1' })],
});
const response = await ai.generate({
model: vertexModelGarden.model(
'meta/llama-4-maverick-17b-128e-instruct-maas',
),
prompt: 'Write a function that adds two numbers together',
});

For the full list of available Llama models see: Fully-managed Llama models

Available Models:

  • mistral-medium-3
  • mistral-ocr-2505
  • mistral-small-2503
  • codestral-2
const ai = genkit({
plugins: [vertexModelGarden({ location: 'us-central1' })],
});
const response = await ai.generate({
model: vertexModelGarden.model('mistral-medium-3'),
prompt: 'Write a function that adds two numbers together',
config: {
temperature: 0.7,
maxOutputTokens: 1024,
topP: 0.9,
topK: 40,
},
});

For the full list of available Mistral AI models see: Mistral AI models

Use the Gemini Enterprise Rapid Evaluation API for model evaluation:

import {
vertexAIEvaluation,
VertexAIEvaluationMetricType,
} from '@genkit-ai/vertexai/evaluation';
const ai = genkit({
plugins: [
vertexAIEvaluation({
location: 'us-central1',
metrics: [
VertexAIEvaluationMetricType.SAFETY,
{
type: VertexAIEvaluationMetricType.ROUGE,
metricSpec: {
rougeType: 'rougeLsum',
},
},
],
}),
],
});

Available metrics:

  • BLEU: Translation quality
  • ROUGE: Summarization quality
  • Fluency: Text fluency
  • Safety: Content safety
  • Groundedness: Factual accuracy
  • Summarization Quality/Helpfulness/Verbosity: Summary evaluation

Run evaluations:

Terminal window
genkit eval:run
genkit eval:flow -e vertexai/safety

Use Vector Search in Gemini Enterprise for enterprise-grade vector operations:

  1. Create a Vector Search index in the Google Cloud Console
  2. Configure dimensions based on your embedding model:
    • gemini-embedding-001 / gemini-embedding-2: default 3072 dimensions; you can set outputDimensionality in the embedder options (embedderOptions in vectorSearchOptions, or options on ai.embed()) (for example 768, 1536, or 3072 per Google). Size the index to the length you actually use.
    • text-embedding-005: 768 dimensions
    • text-multilingual-embedding-002: 768 dimensions
    • multimodalembedding@001: 128, 256, 512, or 1408 dimensions
  3. Deploy the index to a standard endpoint
import { vertexAIVectorSearch } from '@genkit-ai/vertexai/vectorsearch';
import {
getFirestoreDocumentIndexer,
getFirestoreDocumentRetriever,
} from '@genkit-ai/vertexai/vectorsearch';
const ai = genkit({
plugins: [
vertexAIVectorSearch({
projectId: 'your-project-id',
location: 'us-central1',
vectorSearchOptions: [
{
indexId: 'your-index-id',
indexEndpointId: 'your-endpoint-id',
deployedIndexId: 'your-deployed-index-id',
publicDomainName: 'your-domain-name',
documentRetriever: firestoreDocumentRetriever,
documentIndexer: firestoreDocumentIndexer,
embedder: vertexAI.embedder('gemini-embedding-001'),
},
],
}),
],
});
import {
vertexAiIndexerRef,
vertexAiRetrieverRef,
} from '@genkit-ai/vertexai/vectorsearch';
// Index documents
await ai.index({
indexer: vertexAiIndexerRef({
indexId: 'your-index-id',
}),
documents,
});
// Retrieve similar documents
const results = await ai.retrieve({
retriever: vertexAiRetrieverRef({
indexId: 'your-index-id',
}),
query: queryDocument,
});
  • Learn about generating content to understand how to use these models effectively
  • Explore evaluation to leverage Gemini Enterprise evaluation metrics
  • See RAG to implement retrieval-augmented generation with Vector Search
  • Check out creating flows to build structured AI workflows
  • For simple API key access, see the Google AI plugin