Google (Gemini)
The Google plugin provides access to Gemini models through Google AI Studio, plus image generation, media understanding (image/audio/video), and web search via Gemini Grounding.
- Provider:
google - Auth:
GEMINI_API_KEYorGOOGLE_API_KEY - API: Google Gemini API
- Alternative provider:
google-gemini-cli(OAuth)
Getting started
Choose your preferred auth method and follow the setup steps.
Best for: standard Gemini API access through Google AI Studio.
- Run onboarding
openclaw onboard --auth-choice gemini-api-keyOr pass the key directly:
openclaw onboard --non-interactive \ --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
The environment variables GEMINI_API_KEY and GOOGLE_API_KEY are both accepted. Use whichever you already have configured.
Best for: reusing an existing Gemini CLI login via PKCE OAuth instead of a separate API key.
The google-gemini-cli provider is an unofficial integration. Some users
report account restrictions when using OAuth this way. Use at your own risk.
- Install the Gemini CLI
The local
geminicommand must be available onPATH.# Homebrew brew install gemini-cli # or npm npm install -g @google/gemini-cliOpenClaw supports both Homebrew installs and global npm installs, including common Windows/npm layouts.
- Log in via OAuth
openclaw models auth login --provider google-gemini-cli --set-default - Verify the model is available
openclaw models list --provider google-gemini-cli
- Default model:
google-gemini-cli/gemini-3-flash-preview - Alias:
gemini-cli
Environment variables:
OPENCLAW_GEMINI_OAUTH_CLIENT_IDOPENCLAW_GEMINI_OAUTH_CLIENT_SECRET
(Or the GEMINI_CLI_* variants.)
If Gemini CLI OAuth requests fail after login, set GOOGLE_CLOUD_PROJECT or
GOOGLE_CLOUD_PROJECT_ID on the gateway host and retry.
If login fails before the browser flow starts, make sure the local gemini
command is installed and on PATH.
The OAuth-only google-gemini-cli provider is a separate text-inference
surface. Image generation, media understanding, and Gemini Grounding stay on
the google provider id.
Capabilities
| Capability | Supported |
|---|---|
| Chat completions | Yes |
| Image generation | Yes |
| Music generation | Yes |
| Image understanding | Yes |
| Audio transcription | Yes |
| Video understanding | Yes |
| Web search (Grounding) | Yes |
| Thinking/reasoning | Yes (Gemini 3.1+) |
| Gemma 4 models | Yes |
Gemma 4 models (for example gemma-4-26b-a4b-it) support thinking mode. OpenClaw
rewrites thinkingBudget to a supported Google thinkingLevel for Gemma 4.
Setting thinking to off preserves thinking disabled instead of mapping to
MINIMAL.
Image generation
The bundled google image-generation provider defaults to
google/gemini-3.1-flash-image-preview.
- Also supports
google/gemini-3-pro-image-preview - Generate: up to 4 images per request
- Edit mode: enabled, up to 5 input images
- Geometry controls:
size,aspectRatio, andresolution
To use Google as the default image provider:
{
agents: {
defaults: {
imageGenerationModel: {
primary: "google/gemini-3.1-flash-image-preview",
},
},
},
}
See Image Generation for shared tool parameters, provider selection, and failover behavior.
Video generation
The bundled google plugin also registers video generation 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,resolution, andaudio - Current duration clamp: 4 to 8 seconds
To use Google as the default video provider:
{
agents: {
defaults: {
videoGenerationModel: {
primary: "google/veo-3.1-fast-generate-preview",
},
},
},
}
See Video Generation for shared tool parameters, provider selection, and failover behavior.
Music generation
The bundled google plugin also registers music generation through the shared
music_generate tool.
- Default music model:
google/lyria-3-clip-preview - Also supports
google/lyria-3-pro-preview - 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 use Google as the default music provider:
{
agents: {
defaults: {
musicGenerationModel: {
primary: "google/lyria-3-clip-preview",
},
},
},
}
See Music Generation for shared tool parameters, provider selection, and failover behavior.
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 - If both are present,
cachedContentwins - 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 JSON usage notes
When using the google-gemini-cli OAuth provider, OpenClaw normalizes
the CLI JSON output as follows:
- Reply text comes from the CLI JSON
responsefield. - Usage falls back to
statswhen the CLI leavesusageempty. stats.cachedis normalized into OpenClawcacheRead.- If
stats.inputis missing, OpenClaw derives input tokens fromstats.input_tokens - stats.cached.
Environment and daemon setup
If the Gateway runs as a daemon (launchd/systemd), make sure GEMINI_API_KEY
is available to that process (for example, in ~/.openclaw/.env or via
env.shellEnv).