OpenClaw treats Google Gemini as a first-party provider, so adding it is mostly a matter of pasting an API key into the right place. Here’s the whole flow — get the key, wire it up, pick a model — plus the one-key shortcut if you don’t want a separate Google account.
1. Get a Gemini API key
- Go to Google AI Studio.
- Sign in with your Google account.
- Open the API Keys section and create a key.
- Copy it somewhere safe — you’ll paste it into the OpenClaw config in a second.
Every key comes with a free tier: a generous number of requests per day at no cost. That’s enough for light OpenClaw use without ever being billed. Beyond the free limits you pay per token.
2. Add Google as a provider in OpenClaw
Open ~/.openclaw/openclaw.json and add a google entry under models.providers:
{
"models": {
"providers": {
"google": {
"baseUrl": "https://generativelanguage.googleapis.com/v1beta",
"apiKey": "your-google-api-key",
"api": "openai-completions"
}
}
}
}
If you’d rather not edit the file by hand, run openclaw onboard — the wizard walks you through picking Google and entering the key, and writes the config for you.
3. Add the Gemini models you want
In the same file, allowlist the models under the provider:
{
"models": {
"providers": {
"google": {
"baseUrl": "https://generativelanguage.googleapis.com/v1beta",
"apiKey": "your-google-api-key",
"api": "openai-completions",
"models": [
{ "id": "gemini-3-flash", "name": "Gemini 3 Flash" },
{ "id": "gemini-3.1-pro", "name": "Gemini 3.1 Pro" }
]
}
}
}
}
Then start OpenClaw and run /model to switch to a Gemini model, or set it as your default under agents.defaults.model.primary (e.g. "google/gemini-3-flash").
Which Gemini model to pick
| Model | Input / Output (per 1M) | Context | Use it for |
|---|---|---|---|
| Gemini 3 Flash | ~$0.50 / $3 | 1M | Default — cheap, fast, handles most tasks |
| Gemini 3.1 Pro | ~$2 / $12 | 1M | Hard debugging, deeper reasoning, codebase Q&A |
| Gemini 2.0 Flash | ~$0.10 / $0.40 | 1M | Staying inside the free tier, lowest cost |
The common pattern: run Gemini 3 Flash by default and override to 3.1 Pro only when a task actually needs the extra reasoning. The reason to bother with Gemini at all is that 1M-token window — you can feed it a small monorepo or a pile of logs in one prompt. For the full breakdown, see Best Gemini Model for OpenClaw.
Common problems
- 401 / invalid key. You copied a project ID or OAuth token instead of the AI Studio API key. Generate a fresh API key in AI Studio and paste that.
- Hitting rate limits fast. You’re past the free tier, or sending huge 1M-token contexts on every turn — trim the files OpenClaw has loaded. The free tier counts requests, so fewer, leaner calls go further.
- Model not found. The model ID in your allowlist doesn’t match Google’s current naming. Check the exact ID in AI Studio and copy it verbatim.
- Wrong base URL. It should end at
/v1beta— don’t append a path. OpenClaw handles the rest.
Set up haimaker.ai instead — one key, every model
If you don’t want a separate Google account, or you’re already routing other models, you can reach all the Gemini models through haimaker.ai with a single API key — alongside Claude, GPT, DeepSeek, Grok, MiniMax, and the rest.
-
Create an account and copy an API key at app.haimaker.ai. New accounts start with free credits.
-
Add haimaker as a provider in
~/.openclaw/openclaw.json:{ "models": { "providers": { "haimaker": { "baseUrl": "https://api.haimaker.ai/v1", "apiKey": "your-haimaker-api-key", "api": "openai-completions", "models": [ { "id": "google/gemini-3-flash", "name": "Gemini 3 Flash" }, { "id": "google/gemini-3-1-pro", "name": "Gemini 3.1 Pro" } ] } } } } -
Start OpenClaw, run
/model, and pick a Gemini model. To add other providers later — Claude, GPT, DeepSeek — just add their model IDs to the samehaimakerblock; the key and base URL don’t change.
Want to compare Gemini against everything else on price and benchmarks first? They’re all side by side at haimaker.ai.
GET $10 FREE CREDITS ON HAIMAKER
Related: Best Gemini Model for OpenClaw · OpenClaw API Key Setup · OpenClaw Custom Provider Setup