#openclaw + openrouter how to
1 messages · Page 1 of 1 (latest)
Yep, manual config is pretty simple, and the big gotcha is that OpenClaw config is JSON5, not strict JSON.
Put this in your config file, usually ~/.openclaw/openclaw.json:
{
env: {
OPENROUTER_API_KEY: "sk-or-...",
},
agents: {
defaults: {
model: {
primary: "openrouter/auto",
// or: "openrouter/<provider>/<model>"
},
},
},
}
A couple notes:
- Config path:
openclaw config file - Validate it:
openclaw config validate - Check auth/model resolution:
openclaw models status
Important bit for OpenRouter refs:
- use
openrouter/auto, or - the full form
openrouter/<provider>/<model>
You do not need to manually set the OpenRouter base URL for normal provider usage.
Docs:
- https://docs.openclaw.ai/providers/openrouter
- https://docs.openclaw.ai/gateway/configuration-reference
- https://docs.openclaw.ai/help/faq
If you want, I can also give you a ready-to-paste example with fallbacks included.
How to use free models and how to get OpenClaw to recognize them?
For OpenRouter free models, the main trick is: they usually use the :free suffix, and OpenClaw needs the full OpenRouter ref.
So in config, use:
{
env: {
OPENROUTER_API_KEY: "sk-or-...",
},
agents: {
defaults: {
model: {
primary: "openrouter/<provider>/<model>:free",
},
},
},
}
How to get OpenClaw to recognize them:
-
Make sure OpenRouter auth is present
openclaw models status
-
Scan OpenRouter’s free catalog
openclaw models scan- or metadata-only:
openclaw models scan --no-probe
-
Set one automatically
openclaw models scan --set-default --yes
-
Or set one manually
openclaw models set openrouter/<provider>/<model>:free
Big gotcha:
- For OpenRouter, you must include the provider prefix like
openrouter/... - If you omit that, OpenClaw may not resolve it correctly
If it still doesn’t show up, paste:
openclaw --version
openclaw models status
Docs: