Smart model routing reduces costs by matching request complexity to model capability. Instead of building your own heuristics, let OpenRouter handle it.
Most AI agent setups use a single expensive model for everything:
- Quick status checks → opus ($$$)
- Complex reasoning → opus ($$$)
- Heartbeat processing → opus ($$$)
You're paying premium prices for tasks that don't need premium intelligence.
OpenRouter's Auto Model (openrouter/openrouter/auto) automatically selects the most cost-effective model based on your prompt. No client-side heuristics needed.
[Your Request] → [OpenRouter Auto] → [Picks optimal model] → [Response]
OpenRouter analyzes your prompt and routes to the best model for the job:
- Simple queries → cheap/fast models
- Complex reasoning → capable models
- Code generation → code-optimized models
openclaw onboard --auth-choice apiKey --token-provider openrouter --token "$OPENROUTER_API_KEY"Or manually add to ~/.openclaw/openclaw.json:
{
"auth": {
"profiles": {
"openrouter:default": {
"provider": "openrouter",
"mode": "api_key"
}
}
}
}Then store the key:
openclaw auth set openrouter:default --key "$OPENROUTER_API_KEY"Update your agents.defaults.model section:
{
"agents": {
"defaults": {
"model": {
"primary": "openrouter/openrouter/auto",
"fallbacks": [
"openrouter/anthropic/claude-haiku-3.5"
]
},
"models": {
"openrouter/openrouter/auto": {},
"openrouter/anthropic/claude-haiku-3.5": {}
}
}
}
}openclaw gateway restartTypical distribution after switching to auto routing:
Before: 100% opus → $15.00/1M tokens (blended)
After: Auto-routed mix → ~$3-5/1M tokens (blended)
↓
60-80% cost reduction
Use auto for most tasks, but pin specific workloads to specific models:
{
"agents": {
"defaults": {
"model": {
"primary": "openrouter/openrouter/auto"
}
}
}
}Then override per-spawn for critical tasks:
# Force opus for complex coding tasks
openclaw spawn --model anthropic/claude-opus-4-5 --task "Review this PR..."Or in sessions_spawn:
{
"model": "anthropic/claude-opus-4-5",
"task": "Complex analysis requiring top-tier reasoning"
}Track what's actually being used:
-
OpenRouter Dashboard: openrouter.ai/activity
- See which models auto is selecting
- Cost breakdown by model
- Request volume over time
-
clawtel (planned): Heartbeat telemetry includes model field
- Surface distribution on claw.tech dashboard
- Identify further optimization opportunities
Auto is good for most tasks, but consider explicit models when:
| Scenario | Override To |
|---|---|
| Complex coding/debugging | claude-opus-4-5 |
| Long context (>100k tokens) | gemini-pro-1.5 |
| Cost-critical batch jobs | claude-haiku-3.5 |
| Reasoning chains | deepseek-reasoner |
- OpenRouter Auto Model
- OpenRouter + OpenClaw Integration
- bdougie/clawtel#1 - Surface model distribution on claw.tech
The best model for the job isn't always the biggest one — let the router figure it out.