Skip to main content
The @genkit-ai/google-genai package is the unified Google plugin for Genkit. It exports two initializers:
  • googleAI — connects to the Gemini Developer API (Google AI Studio). Best for prototyping, quick experiments, and apps that don’t need a Google Cloud project.
  • vertexAI — connects to Google Cloud Vertex AI. Best for production workloads, enterprise compliance, and access to Vertex-only features. See the Vertex AI plugin page for the full Vertex story.
This page covers googleAI.
The older @genkit-ai/googleai package is superseded by @genkit-ai/google-genai. Migrate by changing your import and plugin initializer — the model reference syntax is identical.

Installation

Configuration

API key

Obtain a free API key from Google AI Studio and set it as an environment variable:
Or pass it directly at plugin init time (useful for testing, not recommended for production):

Plugin options (TypeScript)

The GoogleAIPluginOptions interface exposes these fields:

Available models

The plugin dynamically discovers available models from the API. Pre-registered known models include: You can use any model ID supported by the underlying SDK — new models appear automatically without a plugin update.

Basic text generation

Model configuration

Pass a GeminiConfig object alongside the model reference to tune generation:
Available GeminiConfig fields include:

Structured output

Multimodal input

Gemini 2.5 models accept text, images, audio, video, and PDFs in the same request:
For Gemini 2.5+ models, external HTTPS URLs are passed directly to the API. For Gemini 2.0 models, Genkit automatically downloads external media and inlines it (up to 100 MB).

Function calling (tools)

Embeddings

Embedder config

Image generation (Imagen)

Google Search grounding

Ground responses with real-time web data:

Vertex AI plugin

Enterprise Gemini access with GCP credentials.

Structured output

Type-safe JSON generation with Zod schemas.

Multimodal

Working with images, audio, and video.

Tools

Give models access to functions and external data.