Google Gemini Provider Setup and Configuration
Learn to configure the Google Gemini provider with AI Studio API keys or Vertex AI, plus optional CLI runtime and multimodal tools. Ideal for developers integrating Gemini models.
Read this when
- You want to use Google Gemini models with OpenClaw
- You need Google AI Studio, Vertex AI, or Gemini CLI runtime guidance
The Google plugin grants access to Gemini models via Google AI Studio, along with image generation, media comprehension covering images, audio, and video, text-to-speech, and web search powered by Gemini Grounding.
- Provider:
google - Auth:
GEMINI_API_KEYorGOOGLE_API_KEY - API: Google Gemini API
- Managed-cloud provider:
google-vertexwith Google Cloud Application Default Credentials - Optional runtime:
agentRuntime.id: "google-gemini-cli"executes a specifically configured model through the local Gemini CLI
Getting started
For the majority of setups, an API key from Google AI Studio is the way to go. Opt for google-vertex when the Gateway is already operating inside a managed Google Cloud environment.
AI Studio API key
Recommended for: standard Gemini API access.
Get an API key
A free key can be created in Google AI Studio.
Run onboarding
openclaw onboard --auth-choice gemini-api-key
Alternatively, supply the key directly:
openclaw onboard --non-interactive --accept-risk --skip-health \
--mode local \
--auth-choice gemini-api-key \
--gemini-api-key "$GEMINI_API_KEY"
Set a default model
{
agents: {
defaults: {
model: { primary: "google/gemini-3.1-pro-preview" },
},
},
}
Verify the model is available
openclaw models list --provider google
Tip
Both
GEMINI_API_KEYandGOOGLE_API_KEYare valid. Go with whichever one is already set up in your environment.
Once an API key is configured, OpenClaw pulls the text-model list from Google AI Studio through the Gemini models.list API. This means newly launched Gemini 3 Pro, Flash, and Flash-Lite variants show up in openclaw models list --provider google without requiring an OpenClaw update. Should discovery fail, OpenClaw falls back to the catalog that ships with it.
Gemini CLI runtime
Advanced use only: run a canonical google/* model through an installed Gemini CLI while keeping authentication on the supported AI Studio API-key path.
OpenClaw does not offer new Gemini CLI OAuth or Antigravity OAuth setup. Google ended consumer Gemini CLI Login with Google access on June 18, 2026, and the Antigravity terms prohibit third-party tools from accessing the service through Antigravity OAuth. Use an AI Studio API key or Vertex AI instead.
Configure Google AI Studio
Finish the API-key configuration in the first tab. OpenClaw requires a working google API-key profile before the CLI runtime becomes selectable.
Install Gemini CLI
The gemini command needs to be present locally on PATH.
# Homebrew
brew install gemini-cli
# or npm
npm install -g @google/gemini-cli
OpenClaw accommodates both Homebrew and global npm installations, including typical Windows/npm directory layouts.
Select the CLI runtime
Maintain the canonical Google model ref and enable the CLI runtime for that model:
{
agents: {
defaults: {
model: { primary: "google/gemini-3.1-pro-preview" },
models: {
"google/gemini-3.1-pro-preview": {
agentRuntime: { id: "google-gemini-cli" },
},
},
},
},
}
- Runtime:
google-gemini-cli - Auth: selected Google AI Studio API-key profile
- Model refs: canonical
google/*
Existing valid Gemini CLI OAuth profiles continue to run for compatibility reasons, but OpenClaw cannot create or fix them. If one stops working, swap it out for a Google AI Studio API-key profile.
google-gemini-cli/* refs remain legacy compatibility aliases. New configs should use google/* model refs plus the explicit runtime selection above.
Note
google/gemini-3-pro-previewwas retired on 2026-03-09; usegoogle/gemini-3.1-pro-previewinstead. Re-running Gemini API key setup (openclaw onboard --auth-choice gemini-api-keyoropenclaw models auth login --provider google) rewrites a stale configured default to the current model.
Capabilities
| Capability | Supported |
|---|---|
| Chat completions | Yes |
| Image generation | Yes |
| Music generation | Yes |
| Text-to-speech | Yes |
| Realtime voice | Yes (Google Live API) |
| Image understanding | Yes |
| Audio transcription | Yes |
| Video understanding | Yes |
| Web search (Grounding) | Yes |
| Thinking/reasoning | Yes (Gemini 2.5+ / Gemini 3+) |
| Gemma 4 models | Yes |
Web search
The bundled gemini web-search provider relies on Gemini Google Search grounding. Set up a dedicated search key under plugins.entries.google.config.webSearch, or allow it to reuse models.providers.google.apiKey following GEMINI_API_KEY:
{
plugins: {
entries: {
google: {
config: {
webSearch: {
apiKey: "AIza...", // optional if GEMINI_API_KEY or models.providers.google.apiKey is set
baseUrl: "https://generativelanguage.googleapis.com/v1beta", // falls back to models.providers.google.baseUrl
model: "gemini-2.5-flash",
},
},
},
},
},
}
Credential precedence goes dedicated webSearch.apiKey first, then GEMINI_API_KEY, and finally models.providers.google.apiKey. webSearch.baseUrl is optional, intended for operator proxies or compatible Gemini API endpoints; when absent, Gemini web search falls back to models.providers.google.baseUrl. For provider-specific tool behavior, check Gemini search.
Tip
For Gemini 3 models,
thinkingLevelis used instead ofthinkingBudget. When handling Gemini 3, Gemini 3.1, andgemini-*-latest, OpenClaw maps reasoning controls tothinkingLevel, so runs at default or low latency avoid sending disabledthinkingBudgetvalues.Rather than locking in a fixed OpenClaw level,
/think adaptivepreserves Google's dynamic thinking semantics. No fixedthinkingLevelis sent for Gemini 3 and Gemini 3.1, letting Google pick the level; Gemini 2.5 transmits Google's dynamic sentinelthinkingBudget: -1.Thinking mode is available on Gemma 4 models, such as
gemma-4-26b-a4b-it. For Gemma 4, OpenClaw convertsthinkingBudgetinto a supported GooglethinkingLevel. When thinking is set tooff, thinking stays disabled rather than being translated toMINIMAL.Gemini 2.5 Pro operates exclusively in thinking mode and rejects an explicit
thinkingBudget: 0; OpenClaw removes that value from Gemini 2.5 Pro requests instead of forwarding it.
Image generation
The bundled google image-generation provider is set to
google/gemini-3.1-flash-image by default.
google/gemini-3-pro-imageis also supported- Generate: up to 4 images per request
- Edit mode: enabled, up to 5 input images
- Geometry controls:
size,aspectRatio, andresolution
To make Google the default image provider:
{
agents: {
defaults: {
mediaModels: {
image: {
primary: "google/gemini-3.1-flash-image",
},
},
},
},
}
Note
Shared tool parameters, provider selection, and failover behavior are covered in Image Generation.
Video generation
Video generation is also registered by the bundled google plugin through the
shared video_generate tool.
- Default video model:
google/veo-3.1-fast-generate-preview - Modes: text-to-video, image-to-video, and single-video reference flows
- Supports
aspectRatio(16:9,9:16) andresolution(720P,1080P); Veo currently does not support audio output - Supported durations: 4, 6, or 8 seconds (other values snap to the nearest allowed value)
To make Google the default video provider:
{
agents: {
defaults: {
mediaModels: {
video: {
primary: "google/veo-3.1-fast-generate-preview",
},
},
},
},
}
Note
Shared tool parameters, provider selection, and failover behavior are covered in Video Generation.
Music generation
The bundled google plugin additionally registers music generation through the
shared music_generate tool.
- Default music model:
google/lyria-3-clip-preview google/lyria-3-pro-previewis also supported- Prompt controls:
lyricsandinstrumental - Output format:
mp3by default, pluswavongoogle/lyria-3-pro-preview - Reference inputs: up to 10 images
- Session-backed runs detach through the shared task/status flow, including
action: "status"
To make Google the default music provider:
{
agents: {
defaults: {
mediaModels: {
music: {
primary: "google/lyria-3-clip-preview",
},
},
},
},
}
Note
Shared tool parameters, provider selection, and failover behavior are covered in Music Generation.
Text-to-speech
The bundled google speech provider routes through the Gemini API TTS path with
gemini-3.1-flash-tts-preview.
- Default voice:
Kore - Auth:
tts.providers.google.apiKey,models.providers.google.apiKey,GEMINI_API_KEY, orGOOGLE_API_KEY - Output: WAV for regular TTS attachments, Opus for voice-note targets, PCM for Talk/telephony
- Voice-note output: Google PCM is wrapped as WAV and transcoded to 48 kHz Opus with
ffmpeg
Generated audio from Google's batch Gemini TTS path arrives in the completed
generateContent response. For spoken conversations with the least latency, opt for the
Google realtime voice provider, which relies on the Gemini Live API, rather
than batch TTS.
To make Google the default TTS provider:
{
tts: {
auto: "always",
provider: "google",
providers: {
google: {
model: "gemini-3.1-flash-tts-preview",
speakerVoice: "Kore",
audioProfile: "Speak professionally with a calm tone.",
},
},
},
}
Gemini API TTS relies on natural-language prompting to control style. Assign
audioProfile to insert a reusable style prompt ahead of the spoken text. Assign
speakerName when your prompt text references a specific speaker.
Expressive square-bracket audio tags, such as [whispers] or [laughs], are also
accepted by Gemini API TTS within the text. To prevent those tags from appearing
in the visible chat reply while still transmitting them to TTS, enclose them in
a [[tts:text]]...[[/tts:text]] block:
Here is the clean reply text.
[[tts:text]][whispers] Here is the spoken version.[[/tts:text]]
Note
A Google Cloud Console API key scoped to the Gemini API works with this provider. This is distinct from the separate Cloud Text-to-Speech API path.
Realtime voice
The included google plugin registers a realtime voice provider backed by the
Gemini Live API, intended for backend audio bridges like Voice Call and Google
Meet.
| Setting | Config path | Default |
|---|---|---|
| Model | plugins.entries.voice-call.config.realtime.providers.google.model | gemini-3.1-flash-live-preview |
| Voice | ...google.voice | Kore |
| Temperature | ...google.temperature | (unset) |
| VAD start sensitivity | ...google.startSensitivity | (unset) |
| VAD end sensitivity | ...google.endSensitivity | (unset) |
| Silence duration | ...google.silenceDurationMs | (unset) |
| Activity handling | ...google.activityHandling | Google default, start-of-activity-interrupts |
| Turn coverage | ...google.turnCoverage | Google default, audio-activity-and-all-video |
| Disable auto VAD | ...google.automaticActivityDetectionDisabled | false |
| Session resumption | ...google.sessionResumption | true |
| Context compression | ...google.contextWindowCompression | true |
| API key | ...google.apiKey | Falls back to models.providers.google.apiKey, GEMINI_API_KEY, or GOOGLE_API_KEY |
Example Voice Call realtime configuration:
{
plugins: {
entries: {
"voice-call": {
enabled: true,
config: {
realtime: {
enabled: true,
provider: "google",
providers: {
google: {
model: "gemini-3.1-flash-live-preview",
speakerVoice: "Kore",
activityHandling: "start-of-activity-interrupts",
turnCoverage: "audio-activity-and-all-video",
},
},
},
},
},
},
},
}
Note
Bidirectional audio and function calling over a WebSocket are provided by the Google Live API. OpenClaw converts telephony/Meet bridge audio into Gemini's PCM Live API stream and maintains tool calls on the shared realtime voice contract. Leave
temperatureunset unless you need sampling changes; OpenClaw drops non-positive values because Google Live can return transcripts without audio fortemperature: 0. Gemini API transcription is active withoutlanguageCodes; the current Google SDK rejects language-code hints on this API path.
Note
Conversational text arrives through realtime input on Gemini 3.1 Live, which also uses sequential function calling. OpenClaw omits the older
NON_BLOCKING, function response scheduling, and affective-dialog fields for this model. PreferthinkingLevel; configured positivethinkingBudgetvalues map to the nearest supported level, while-1preserves Google's default. Consult the Gemini Live capability comparison.
Note
Control UI Talk supports Google Live browser sessions with restricted one-use tokens. In Video Talk, the browser sends bounded JPEG frames straight to Google Live at the provider's cap of one frame per second. The
describe_viewfunction indicates whether that camera stream is live. Camera frames bypass the Gateway. Backend-only realtime voice providers can also operate through the generic Gateway relay transport, which keeps provider credentials on the Gateway.
For maintainer live verification, execute
OPENAI_API_KEY=... GEMINI_API_KEY=... node --import tsx scripts/dev/realtime-talk-live-smoke.ts.
The smoke also covers OpenAI backend/WebRTC paths; the Google leg mints the same
constrained Live API token shape used by Control UI Talk, opens the browser
WebSocket endpoint, sends the initial setup payload plus a JPEG frame, and
verifies a text response and describe_view function roundtrip.
The OpenAI path also performs a synthesized PCM24 speech-to-response audio
roundtrip; pass --openai-audio-cycles 3 for a short repeated lifecycle soak.
Advanced configuration
Direct Gemini cache reuse
For direct Gemini API runs (api: "google-generative-ai"), OpenClaw
passes a configured cachedContent handle through to Gemini requests.
- Configure per-model or global params with either
cachedContentor legacycached_content - Params from a more specific scope (model-level over global) always win.
Within the same scope, if both keys are set,
cached_contentwins. Use only one key per scope to avoid surprises. - Example value:
cachedContents/prebuilt-context - Gemini cache-hit usage is normalized into OpenClaw
cacheReadfrom upstreamcachedContentTokenCount
{
agents: {
defaults: {
models: {
"google/gemini-2.5-pro": {
params: {
cachedContent: "cachedContents/prebuilt-context",
},
},
},
},
},
}
Gemini CLI usage notes
The optional google-gemini-cli runtime uses Gemini CLI stream-json
output by default and normalizes usage from the final stats payload.
Legacy --output-format json overrides still use the JSON parser.
- Assistant
messageevents carry the streamed reply text. - When outputting legacy JSON, the reply text sits in the CLI JSON
responsefield. - If the CLI leaves
usageblank, usage defaults tostats. - OpenClaw normalizes
stats.cachedintocacheRead. - In cases where
stats.inputis absent, OpenClaw calculates input tokens fromstats.input_tokens - stats.cached.
Environment and daemon setup
When the Gateway operates as a daemon (launchd/systemd), confirm that GEMINI_API_KEY is accessible to that process, such as through ~/.openclaw/.env or env.shellEnv.
Related
-
Model selection, How to pick providers, model references, and failover behavior.
-
Image generation, Common image tool parameters and how to choose a provider.
-
Video generation, Shared video tool settings and provider selection.
-
Music generation, Standard music tool parameters and provider selection.