Overview
The Google GenAI provider gives you access to Gemini models with advanced multimodal capabilities, embeddings, and image generation through Gemini native image models and Imagen.Installation
createGoogleGenAI()
Create a Google GenAI provider instance.Options
string
Your Google AI API key. Pass it explicitly or set the
GOOGLE_API_KEY
environment variable.string
API version to use (e.g.,
'v1', 'v1beta').string
Custom base URL for API requests.
GoogleGenAIClient
Provide your own configured Google GenAI client instance.
Returns
GoogleGenAIProvider with methods chatModel(), embeddingModel(), and imageModel().
Supported models
Chat models
Gemini 3.x (thinking level)
Gemini 3.x (thinking level)
- gemini-3.8-flash - Fast workhorse for coding and agentic workflows
- gemini-3.7-flash - Previous Flash model for agents and coding
- gemini-3.6-flash - Token-efficient Flash model for agents and coding
- gemini-3.5-flash - Previous generation Flash model
- gemini-3.5-flash-lite - Cost-efficient model for high-volume tasks
- gemini-3.1-pro / gemini-3.1-pro-preview - Most capable multimodal model
- gemini-3.1-flash-lite / gemini-3.1-flash-lite-preview - Lightweight thinking-level model
- gemini-3-pro - Previous Gemini 3 generation
Gemini 2.5 (thinking budget)
Gemini 2.5 (thinking budget)
- gemini-2.5-pro - High capability, budget-based thinking
- gemini-2.5-flash - Fast with optional thinking
- gemini-2.5-flash-lite - Lightweight with optional thinking
Embedding models
- text-embedding-004 - Latest text embedding model
Image models
- gemini-3.1-flash-image - Gemini native image generation
- gemini-3-pro-image-preview - Gemini native image generation preview
- gemini-2.5-flash-image - Gemini native image generation
- imagen-4.0-generate-001 - Dedicated Imagen generation
Examples
Basic chat
Reasoning
Multimodal input
Embeddings
Image generation
imageModel() and generateImage() API.
Streaming
Tool calling
Model capabilities
Google extends the sharedModelCapabilities shape with thinkingParam, which
selects budget or level control. The shared mode field reports whether
thinking is optional or always on. Inspect these values before setting
reasoning options:
modalities.input is ['text', 'image', 'file', 'audio'] for every Gemini
chat model. Image sources accept both base64 and url. A URL maps to
fileData.fileUri, which accepts publicly readable HTTP(S) URLs, pre-signed
URLs, gs:// objects, and Files API URIs. The URL is fetched by Google rather
than by this library, so the content must be reachable from Google’s side.
File and audio parts map to inlineData with the provided MIME type.
Audio parts support audio/wav, audio/mp3, audio/aiff, audio/aac,
audio/ogg, and audio/flac. The total inline request size is limited to 20
MB. Use base64 data only; core-ai does not upload audio through the Files API.
modalities.output is ['text'] for chat models. Native image generation uses
imageModel().
Thinking modes
Gemini models use either thinking levels or token budgets. Models whosereasoning.mode is always-on cannot disable thinking.
Thinking level (Gemini 3.x)
Gemini 3.x models use HIGH/LOW thinking control. Mapping:minimal/low/medium -> LOW, high/max -> HIGH.
Gemini 3 models cannot disable thinking completely.
Thinking budget (Gemini 2.5)
Token budgets:minimal -> 1,024, low -> 4,096, medium -> 16,384, high/max -> 32,768.
gemini-2.5-flash and gemini-2.5-flash-lite can skip thinking by omitting
the reasoning parameter.Thought signatures
Google may attach a thought signature under thegoogle key of a part’s
providerMetadata. Reasoning parts already expose it there. Gemini 3 also
attaches a signature to function call parts; core-ai stores that on the
tool-call part so multi-step tool loops can round-trip it.
GoogleReasoningMetadata type contains:
thoughtSignature— signature for preserving thought context across multi-turn conversations
Provider-specific options
Options are namespaced undergoogle in providerOptions:
Generate options
Embed options
taskType, title, mimeType, autoTruncate.
Image options
Gemini image models supportseed and aspectRatio. Gemini 3 image models
also support imageSize; Gemini 2.5 Flash Image uses its fixed 1K output.
The n option cannot request multiple Gemini image outputs:
n:
outputGcsUri, negativePrompt, aspectRatio, guidanceScale, seed, safetyFilterLevel ('BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE'), personGeneration ('DONT_ALLOW' | 'ALLOW_ADULT' | 'ALLOW_ALL'), includeSafetyAttributes, includeRaiReason, language, outputMimeType, outputCompressionQuality, addWatermark, labels, imageSize, enhancePrompt.
Error handling
Model comparison
Related
OpenAI Provider
GPT models and image generation
Anthropic Provider
Claude models with extended thinking
Multi-Modal Guide
Learn how to work with vision and audio