OpenClaw
Run OpenClaw against AnyRouter with one key across every model and messaging channel.
OpenClaw is a local personal AI assistant that answers on Telegram, Discord, Slack, WhatsApp and more. It supports any OpenAI-compatible provider, so pointing it at AnyRouter is a config change.
Create a key (sk-ar-...) in the dashboard, then pick one path.
openclaw onboard --install-daemonChoose Custom (OpenAI-compatible) and enter base URL https://anyrouter.dev/api/v1, your sk-ar-... key, and a model id such as google/gemini-3.1-flash-lite (referenced afterwards as anyrouter/google/gemini-3.1-flash-lite). Then start the gateway:
openclaw gateway --port 18789 --verboseEdit ~/.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" } }
}
}- The key must be an interpolated env var (
"${ANYROUTER_API_KEY}") set in the top-levelenvblock or your shell. There is noapiKeyEnvfield. - Declare every model you use in the provider's
models[](at least anid); OpenClaw will not route to an undeclared id. - Reference models as
anyrouter/<id>.mode: "merge"keeps the built-in providers.
Verify
Message OpenClaw, then check your request logs for the call. openclaw models status --probe live-tests provider connectivity.
Models and per-agent selection
Suggested models: anyrouter/google/gemini-3.1-flash-lite (low latency), anyrouter/anthropic/claude-sonnet-4-6 (long threads, tool use), anyrouter/openai/gpt-5.4-mini (balanced). List all with GET https://anyrouter.dev/api/v1/models.
OpenClaw selects models per agent. Define agents in agents.list[] with their own model.primary, declare each model in the provider, and bind channels to agents with OpenClaw's bindings (configuration reference):
{ "agents": { "list": [
{ "id": "fast", "model": { "primary": "anyrouter/google/gemini-3.1-flash-lite" } },
{ "id": "deep", "model": { "primary": "anyrouter/anthropic/claude-sonnet-4-6" } }
] } }Troubleshooting
| Symptom | Fix |
|---|---|
| 401 or 403 | Check echo $ANYROUTER_API_KEY and that the key is active with credit in the dashboard. |
| Unknown model | Use the anyrouter/ prefix, declare the id in models[], and match an id from GET /api/v1/models. |
| 429 | Heartbeats and scheduled tasks can burst. Back off and retry; see Rate Limits. |
AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer