What is OpenRouter?
OpenClaw alone is powerful. OpenClaw connected to OpenRouter is a different tool entirely.
OpenRouter is a unified AI API that routes your requests to any model from any provider. You create one account, get one API key, and that key works for everything.
Instead of managing separate keys for Anthropic, OpenAI, Google, and DeepSeek — you manage one OpenRouter key and access all of them through it.
The cost: OpenRouter adds a small markup on most models (roughly 10–15%). For the convenience of a single key and unified billing, most people find this completely worth it. Some models on OpenRouter are actually cheaper than going direct.
Step 1 — Create your OpenRouter account
Go to openrouter.ai and sign up. It takes 2 minutes.
Once you're in, go to API Keys in your dashboard and create a new key. Name it something like openclaw.
Copy the key — it starts with sk-or-. You'll need it in the next step.
Add credits: OpenRouter is pay-as-you-go. Add a small amount to start — $5 or $10 is plenty to test with. You won't be charged a subscription.
Step 2 — Connect OpenRouter to OpenClaw
Run this command, replacing the key with yours:
openclaw onboard --auth-choice apiKey --token-provider openrouter --token "sk-or-your-key-here"
This registers your OpenRouter key with OpenClaw's gateway. You only need to do this once.
Verify it worked:
openclaw doctor
You should see OpenRouter listed as a configured provider with no errors.
Step 3 — Set your default model
Now tell OpenClaw which model to use by default. Open your config:
openclaw config edit
Update the model section:
{
"env": {
"OPENROUTER_API_KEY": "sk-or-your-key-here"
},
"agents": {
"defaults": {
"model": {
"primary": "openrouter/anthropic/claude-sonnet-4-6"
}
}
}
}
Note on model strings: OpenRouter model strings follow the format
openrouter/provider/model-name. So Claude Sonnet becomesopenrouter/anthropic/claude-sonnet-4-6, GPT-4o becomesopenrouter/openai/gpt-4o, and so on.
Save and close. Your changes take effect immediately.
How to switch models
This is where OpenRouter gets useful. You can switch to any model with a single config change — no new API keys, no new accounts. Here are the most useful model strings:
openrouter/anthropic/claude-sonnet-4-6 # best all-rounder
openrouter/anthropic/claude-opus-4-6 # most capable
openrouter/openai/gpt-4o # great for coding
openrouter/openai/gpt-4o-mini # fast and cheap
openrouter/google/gemini-2.0-flash # Google's fast model
openrouter/deepseek/deepseek-chat # budget option
openrouter/mistralai/mistral-large # Mistral's flagship
To switch, just change the primary value in your config and save. You can also switch for a single conversation without changing your config — just mention it in your message: "Use GPT-4o for this task" — OpenClaw understands model preferences in natural language.
Setting up model failover
Failover means: if your primary model fails, rate-limits, or is unavailable, OpenClaw automatically switches to your backup. For automations running overnight, this is essential.
{
"agents": {
"defaults": {
"model": {
"primary": "openrouter/anthropic/claude-sonnet-4-6",
"fallback": "openrouter/openai/gpt-4o-mini"
}
}
}
}
Now if Claude hits a hiccup at 3am while an automation is running, GPT-4o mini takes over automatically.
Finding models on OpenRouter
OpenRouter has hundreds of models. Browse them at openrouter.ai/models.
Each listing shows:
- Price per million input/output tokens
- Context window size
- Benchmark scores
- Whether it supports vision (images)
For most OpenClaw use cases, price and context window are the two things that matter most. A larger context window means the model can handle longer documents and longer conversation histories without losing track.
Checking your usage and costs
OpenRouter gives you a dashboard showing exactly what you've spent, by model, by day. Go to Activity in your OpenRouter account. You can also set a monthly spending limit so you never get a surprise bill.
For typical OpenClaw use — a few automations, daily email handling, some research tasks — most people spend $3–8/month on Claude Sonnet. Heavy users with lots of automations might hit $15–25/month.
Troubleshooting
"Provider not found" when running commands
Re-run the onboard command with your key:
openclaw onboard --auth-choice apiKey --token-provider openrouter --token "sk-or-your-key-here"
Model isn't responding
Check that your OpenRouter account has credits. Run:
openclaw daemon logs
The logs will show the exact error from the API.
Wrong model string format
OpenRouter strings must start with openrouter/. If you copy a model name directly from OpenRouter's docs, add openrouter/ at the front.
Why we recommend OpenRouter for most ClawMatic users
If you're buying one of our AI Stack Packages, they're all configured to work through OpenRouter. One key, the right model for your use case, and you can switch if your needs change.
It also means we can update our package recommendations as new models come out — you just change the model string, no new accounts or keys needed.