OpenClaw
Run OpenClaw against AnyRouter — one key across every model and messaging channel, unified billing, and audit logs on every request.
OpenClaw is a personal AI assistant that answers you on the messaging channels you already use (Telegram, Discord, Slack, WhatsApp, Signal, iMessage, Email, …). It runs locally and supports any OpenAI-compatible LLM provider — so pointing it at AnyRouter is a config-only change, and every request then flows through one gateway.
Why route through AnyRouter
- One key for every model OpenClaw can use.
- Audit logs with cost, latency, and tokens per request.
- Free model swaps — change one line in
~/.openclaw/openclaw.json, no key rotation.
Set it up
Create an AnyRouter API key in your dashboard first — every key starts with sk-ar-. Then choose the onboarding wizard or edit the config file directly.
Run the OpenClaw onboarding wizard — it handles gateway, workspace, channels, and provider in one flow:
openclaw onboard --install-daemon
When the wizard asks for an LLM provider, pick Custom (OpenAI-compatible) and enter:
- Base URL —
https://anyrouter.dev/api/v1 - API key — your
sk-ar-…key - Model — any AnyRouter model id, e.g.
google/gemini-3.1-flash-lite(the wizard registers it under the provider, then references it asanyrouter/google/gemini-3.1-flash-lite)
Then start the gateway and OpenClaw will route every request through AnyRouter:
openclaw gateway --port 18789 --verbose
OpenClaw stores config in ~/.openclaw/openclaw.json:
{
"env": {
"ANYROUTER_API_KEY": "sk-ar-your-anyrouter-key"
},
"models": {
"mode": "merge",
"providers": {
"anyrouter": {
"baseUrl": "https://anyrouter.dev/api/v1",
"api": "openai-completions",
"apiKey": "${ANYROUTER_API_KEY}",
"models": [
{
"id": "google/gemini-3.1-flash-lite",
"name": "Gemini 3.1 Flash Lite",
"contextWindow": 1000000
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "anyrouter/google/gemini-3.1-flash-lite"
}
}
}
}
Two things OpenClaw requires for a custom provider:
- The key is an interpolated env var —
apiKey: "${ANYROUTER_API_KEY}", with the value supplied in the top-levelenvblock (or your shell). There is noapiKeyEnvfield. - Every model must be declared in the provider's
models[]array (at minimum anid). OpenClaw won't route to an undeclared model id. Add one entry per AnyRouter model you intend to use.
Reference a model as anyrouter/<id> — the provider name you registered (anyrouter) plus the declared model id (e.g. anyrouter/google/gemini-3.1-flash-lite). mode: "merge" keeps OpenClaw's built-in providers alongside yours.
Verify
Message OpenClaw on any connected channel, then open your request logs. The call should appear within a second or two with the model name, token counts, and cost — confirmation you're routing through AnyRouter. You can also run openclaw models status --probe to live-test provider connectivity.
Recommended models
anyrouter/google/gemini-3.1-flash-lite— default low-latency model for most channelsanyrouter/anthropic/claude-sonnet-4.6— best quality for long threads and tool useanyrouter/openai/gpt-5.4-mini— strong balance, broad capability coverage
List every available model:
curl https://anyrouter.dev/api/v1/models -H "Authorization: Bearer sk-ar-your-key"
Different models per use case
OpenClaw selects models per agent, not per channel directly. Define multiple agents in agents.list[] — each with its own model.primary — then bind channels to those agents in OpenClaw's bindings config:
{
"agents": {
"defaults": {
"model": { "primary": "anyrouter/google/gemini-3.1-flash-lite" }
},
"list": [
{
"id": "fast",
"model": { "primary": "anyrouter/google/gemini-3.1-flash-lite" }
},
{
"id": "deep",
"model": { "primary": "anyrouter/anthropic/claude-sonnet-4.6" }
}
]
}
}
Every model referenced here must also be declared in the anyrouter provider's models[] array (see above). Channel-to-agent routing (e.g. send Telegram to fast, Discord to deep) is configured in OpenClaw's bindings section — see the OpenClaw configuration reference.
Troubleshooting
401 or 403 — verify echo $ANYROUTER_API_KEY returns your key and that the dashboard shows it active with credit remaining.
Unknown model — make sure the id is prefixed anyrouter/, that it's declared in the provider's models[] array, and that the rest matches an entry from GET /api/v1/models. Run openclaw models status --probe to live-test provider connectivity and surface routing issues.
429 — OpenClaw heartbeats and scheduled tasks can burst. Back off and retry — the same key works again next window. See Rate Limits.