Ways to connect Gemini to OpenClaw
AI Studio API key
- Works on any computer or VPS
- Unlocks every Gemini feature in OpenClaw
- New Gemini models appear without an OpenClaw update
- Watch your usage and billing in Google AI Studio
Vertex AI
- For gateways already running on Google Cloud
- Signs in with Application Default Credentials, so no key to store
- Uses its own model list, separate from AI Studio
Gemini CLI runtime
- Runs Gemini turns through Google's
geminiprogram - Still needs an AI Studio API key
- No "Login with Google" option for new setups
Google ended consumer Gemini CLI "Login with Google" access on June 18, 2026, and Antigravity's terms don't allow third-party tools. OpenClaw no longer creates these sign-ins. Existing working profiles still run, but if one breaks, replace it with an AI Studio API key.
Which Gemini setup fits you?
Set up Gemini with an AI Studio API key
Create a key
Go to aistudio.google.com/apikey and create a key. A Google Cloud Console key restricted to the Gemini API also works.
Run onboarding
openclaw onboard --auth-choice gemini-api-keyopenclaw onboard --non-interactive --accept-risk --skip-health \
--mode local \
--auth-choice gemini-api-key \
--gemini-api-key "$GEMINI_API_KEY"openclaw models auth login --provider googleOpenClaw accepts both GEMINI_API_KEY and GOOGLE_API_KEY. If the gateway runs as a background service, put the key in ~/.openclaw/.env so the service can see it.
Pick a model and verify
openclaw models list --provider google
openclaw models set google/gemini-3.1-pro-preview
openclaw models status --probeWith a key in place, OpenClaw reads Google's live model list, so new Gemini 3 Pro, Flash and Flash-Lite versions show up without waiting for an OpenClaw release.
Use Gemini through Vertex AI
If your gateway already runs on Google Cloud, use the google-vertex provider. It signs in with Google Cloud Application Default Credentials instead of an AI Studio key.
gcloud auth application-default login # skip on a VM with a service account
openclaw models list --provider google-vertexVertex has its own fixed model list, separate from AI Studio's live list, so pick a model from the command above. See OpenClaw's provider docs for Vertex details.
Run Gemini through the Gemini CLI
This option runs Gemini turns through Google's own gemini program, but still signs in with your AI Studio key. Do the API-key setup above first.
Install Gemini CLI
# Homebrew
brew install gemini-cli
# or npm
npm install -g @google/gemini-cliSelect the CLI runtime for your model
{
agents: {
defaults: {
model: { primary: "google/gemini-3.1-pro-preview" },
models: {
"google/gemini-3.1-pro-preview": {
agentRuntime: { id: "google-gemini-cli" },
},
},
},
},
}Keep normal google/* model names. Old google-gemini-cli/* names still work but are kept only for compatibility.
Choose a Gemini model
These model names appear in the OpenClaw docs. Your list may include newer ones, so always check openclaw models list --provider google.
| Use | Model reference | Notes |
|---|---|---|
| Main assistant | google/gemini-3.1-pro-preview | The docs' default example. google/gemini-3.1-pro also works. |
| Fast, lower cost | google/gemini-3.5-flash | Example Flash model in the docs |
| Open model | google/gemma-4-26b-a4b-it | Gemma 4, with thinking mode |
| Images | google/gemini-3.1-flash-image | Default. Also gemini-3-pro-image |
| Video | google/veo-3.1-fast-generate-preview | 4, 6 or 8 second clips |
| Music | google/lyria-3-clip-preview | Also lyria-3-pro-preview |
google/gemini-3-pro-preview was retired on March 9, 2026. Use google/gemini-3.1-pro-preview. Re-running openclaw onboard --auth-choice gemini-api-key updates an old default for you. For prices, see Google's Gemini API pricing.
Gemini feature builder
Turn on the Gemini features you want
Pick a chat model and tick the extras. Copy the result into ~/.openclaw/openclaw.json, then run openclaw gateway restart.
Your API key stays in ~/.openclaw/.env as GEMINI_API_KEY. It isn't part of this config.
Images, video, music and voice
Up to 4 images per request, and editing with up to 5 input images. Size, aspect ratio and resolution controls.
Veo text-to-video and image-to-video in 16:9 or 9:16, at 720P or 1080P. Clips are 4, 6 or 8 seconds, with no audio.
Lyria with lyrics or instrumental. Outputs MP3, plus WAV on Lyria 3 Pro. Accepts up to 10 reference images.
Default voice Kore. Gemini 3.8 TTS supports two-speaker dialogue and tags such as <laugh>.
Real-time voice for Voice Call, Google Meet, Talk and Discord through the Gemini Live API.
Reads images, transcribes audio and understands video you send to your assistant.
Example: two-voice speech with Gemini 3.8 TTS.
{
tts: {
auto: "always",
provider: "google",
providers: {
google: {
model: "gemini-3.8-flash-tts",
speakerVoice: "Kore",
speakers: [
{ speaker: "Puck", voice: "Puck", style: "bright" },
{ speaker: "Kore", voice: "Kore", style: "whispered" },
],
},
},
},
}Voice notes are converted to Opus with ffmpeg, so install it on the gateway machine. Want the assistant in a call? See the Discord guide.
Web search with Google Search grounding
OpenClaw's gemini web-search provider answers with live Google Search results and citations. It reuses your GEMINI_API_KEY, or you can set a separate key:
openclaw configure --section web{
plugins: {
entries: {
google: {
config: {
webSearch: {
apiKey: "AIza...", // optional
model: "gemini-3.6-flash", // default
},
},
},
},
},
}Key order: the dedicated webSearch.apiKey first, then GEMINI_API_KEY, then models.providers.google.apiKey.
Thinking with Gemini
/think adaptive # let Google decide how much to think
/think high # think harder
/think off # Gemma 4: keeps thinking disabled- Gemini 3 and 3.1 use Google's
thinkingLevel. OpenClaw converts its own thinking settings for you. /think adaptivekeeps Google's dynamic thinking. Gemini 2.5 gets Google's "dynamic" setting.- Gemini 2.5 Pro only works with thinking on. OpenClaw removes any "thinking off" value before sending.
Key rotation and context caching
Hitting rate limits? Give OpenClaw several Gemini keys. It tries the next one when a key is rate limited.
OPENCLAW_LIVE_GEMINI_KEYA single overrideGEMINI_API_KEYSSeveral keys, separated by commasGEMINI_API_KEYThe standard keyGEMINI_API_KEY_1,GEMINI_API_KEY_2…Numbered keys, withGOOGLE_API_KEYas a final fallback
Reusing a large prompt? Point OpenClaw at a Gemini context cache you created:
{
agents: {
defaults: {
models: {
"google/gemini-2.5-pro": {
params: { cachedContent: "cachedContents/prebuilt-context" },
},
},
},
},
}The optional stateless Interactions route (api: "google-interactions") doesn't support cachedContent. More on backups: model setup and fallbacks.
Fix common Gemini problems
gemini-3-pro-preview not foundIt was retired. Run openclaw models set google/gemini-3.1-pro-preview, or re-run the Gemini key setup.
Works in terminal, not as a serviceThe background service can't see your shell's GEMINI_API_KEY. Add it to ~/.openclaw/.env and restart the gateway.
Gemini CLI login stopped workingOpenClaw can't repair Google sign-in profiles. Add an AI Studio key and keep the CLI runtime on that key.
gemini: command not foundInstall Gemini CLI with Homebrew or npm install -g @google/gemini-cli and make sure it's on the gateway's PATH.
New model missingRun openclaw models list --provider google. A failed refresh keeps the last good list. Vertex uses a separate fixed list.
Rate limited (429)Add more keys with GEMINI_API_KEYS, or add a fallback model from another provider.
More fixes: troubleshooting guide.
Gemini and OpenClaw questions
How do I connect Gemini to OpenClaw?
Create a key in Google AI Studio, then run openclaw onboard --auth-choice gemini-api-key. Pick a model with openclaw models set google/gemini-3.1-pro-preview and check it with openclaw models list --provider google.
Can I sign in to Gemini with my Google account instead of a key?
Not for new setups. Google ended consumer Gemini CLI Login with Google access on June 18, 2026, and OpenClaw no longer creates Gemini CLI or Antigravity sign-ins. Use an AI Studio API key, or Vertex AI on Google Cloud.
Which Gemini model should I use with OpenClaw?
The OpenClaw docs use google/gemini-3.1-pro-preview as the main example, with google/gemini-3.5-flash as a faster option. Run openclaw models list --provider google to see every model your key can use.
Can OpenClaw make images and videos with Gemini?
Yes. The Google plugin generates images with Gemini image models, videos with Veo and music with Lyria. Set them as defaults under agents.defaults.mediaModels.
Does GOOGLE_API_KEY work instead of GEMINI_API_KEY?
Yes. OpenClaw accepts both for the google provider. GOOGLE_API_KEY is also used as a fallback when rotating several Gemini keys.
Should I use AI Studio or Vertex AI?
Use an AI Studio key for most setups. Choose the google-vertex provider when your gateway already runs on Google Cloud and you want to use Application Default Credentials instead of an API key.