OpenRouter with OpenClaw
One API for 30+ models — Claude, GPT, Gemini, Llama, Mistral
One API for 30+ models — Claude, GPT, Gemini, Llama, Mistral
OpenRouter is an aggregation layer: one API key gives you access to dozens of models (Claude, GPT, Gemini, Llama, Mistral, and more) from multiple providers. OpenClaw integrates with OpenRouter so you can switch models or try new ones without managing separate API keys for each provider. Good for experimentation, cost comparison, and failover across vendors.
Create an API key at openrouter.ai. Store in ~/.openclaw/credentials or via openclaw secrets. The same key works for all models on OpenRouter.
Beta: OpenRouter OAuth onboarding is available on stable v2026.6.6+; API keys still work on all builds.
Use the OpenRouter provider and specify the model ID. Model IDs follow the format provider/model-name (e.g. openai/gpt-4, anthropic/claude-opus-4). Check openrouter.ai/models for the full list.
{
"agent": {
"model": "anthropic/claude-opus-4",
"provider": "openrouter"
}
}
If you prefer automatic per-request routing (cheapest model that can handle each query), see ClawRouter in the Providers overview—we don't endorse third-party tools.
OpenClaw can use OpenRouter as an aggregator or talk directly to Anthropic, OpenAI, Ollama, and others. This section is about how to choose, not duplicate provider setup steps.
OpenRouter helps when you want one credential surface and to swap model IDs often (A/B quality, trying new releases, or pointing cron at a cheaper model while chat stays on a flagship). You still pay upstream pricing through their layer; the win is operational: fewer keys and one place to audit model strings. It fits households or small teams that accept traffic via an aggregator and want iteration speed.
Use direct Anthropic or OpenAI (OAuth or API key per upstream docs) when you want the shortest line between contract, billing, and data handling, or when infosec already standardizes on one vendor. Finance often prefers one vendor invoice. Debugging rate limits is simpler without a second hop between you and the API.
For jobs where API cost or offline use matters, pair Ollama with cloud models for the steps that need frontier quality. A common split: local for heartbeats, summarization, or classification; cloud for long reasoning or tool-heavy sessions.
Automatic failover between unrelated vendors is rarer than marketing suggests. Treat routing as your process: keep a tested secondary model string, document the switch (Upgrading / Migrating), and run openclaw doctor after changes. OpenRouter makes swapping IDs fast; you still own correctness and cost.
Exact JSON keys and flags drift—use docs.openclaw.ai and llms.txt as source of truth. Also see Example setups & model routing and Tips and best practices.