Install
openclaw skills install @globalcaos/smart-model-routerStop sending 'format this JSON' to Opus. Stop sending 'cron job' to GPT. Billing-aware routing guide for choosing among the models already configured in your OpenClaw setup when assigning an agent, sub-agent or cron task — flat-rate first, metered only when justified, budget pressure respected. Not for picking models outside your configuration, and not a runtime proxy.
openclaw skills install @globalcaos/smart-model-routerOne of dozens of skills and plugins in TinkerClaw — a self-improving OpenClaw fork that's been running 24/7 for months.
Stop sending "format this JSON" to Opus. Stop paying frontier prices for a cron job that any cheap brain handles in its sleep.
Most agents send every task to the smartest model they have — and quietly torch a metered budget on work a flat-rate model does just as well. This router knows which of your models are flat-rate (effectively free until your quota runs out) and which charge real money per token. It spends the flat-rate quota first, reaches for the metered model only when the task actually earns it, and eases off the moment your budget gets tight — so no surprise invoice at the end of the week.
Part of TinkerClaw — real-time token tracking, self-improving crons, persistent cognitive memory. This is one piece of that stack; the repo has dozens more.
👉 https://github.com/globalcaos/tinkerclaw
Clone it. Fork it. Break it. Make it yours.
<why_this_matters> Flat-rate Anthropic quotas are effectively free until exhausted; metered GPT/o3 costs real dollars per token. Routing every task to the smartest model burns the metered budget on tasks that flat-rate handles equally well, and sends the operator a surprise invoice. </why_this_matters>
Before routing, understand the cost structure:
| Billing tier | What it means | Examples |
|---|---|---|
flat | Subscription / flat-rate. Zero marginal cost per token. Spend freely within quota. | Anthropic Claude via Max subscription (opus, sonnet, haiku) |
metered | Pay-per-use. Real money per token. Every call has a dollar cost. | OpenAI (GPT, o3), Google Gemini (API) |
free | Local inference. Literally zero cost. | Ollama (qwen3, llama, etc.) |
<default_policy>
Route to flat or free by default. metered requires explicit justification from the scenarios below — assume flat-rate has headroom unless the budget data says otherwise.
</default_policy>
Most tasks fit obvious categories. Check the Fast Route Table first, and decide the tier yourself, in the current context. No task text leaves this context to make that decision.
All tiers default to flat-rate models. Metered alternatives are only used when justified AND budget allows.
| Signal in task | Route to | Why |
|---|---|---|
| "what time" / "what date" / simple lookup | flash | Zero reasoning needed |
| Format conversion, CSV→JSON, extract fields | flash | Mechanical transformation |
| Summarize text, list bullet points | fast | Pattern matching, not reasoning |
| Translate text | fast | Well-trained capability across all models |
| Write code, implement feature, refactor | mid | Needs structured thinking |
| Review code, find bugs, security audit | mid | Analysis without deep creativity |
| Draft email, write content | mid | Needs tone + context awareness |
| Research + synthesize from multiple sources | mid | Needs breadth, not max depth |
| Debug complex system, multi-file investigation | strong | Needs deep reasoning chains |
| Reflect on failures, self-improvement | strong | Requires genuine metacognition |
| Creative writing with nuance | strong | Judgment + style + originality |
| Math proofs, formal logic, complex reasoning | reasoning | Chain-of-thought specialist |
| Architectural decisions, tradeoff analysis | strong | Needs weighing multiple factors |
| Tier | Default model (flat-rate) | Metered alternative | When metered is allowed |
|---|---|---|---|
| flash | qwen3 (local/free) | — | Never |
| fast | haiku (flat) | — | Never |
| mid | sonnet (flat) | — | Never |
| strong | opus (flat) | gpt-5.2-pro | Cross-model review, second opinion on critical output |
| reasoning | opus with thinking (flat) | o3 | Complex formal logic where o3 measurably outperforms |
Not every task needs the smartest model. Most tasks need a fast, flat-rate, correct one.
These tasks have a single correct answer or a mechanical transformation. No model does them "better" — they all get it right. Use the cheapest:
These tasks benefit from a good model but don't need the frontier. The gap between mid and strong is <5% quality for 5x the cost:
Only route here when the task genuinely requires deep reasoning or creativity that cheaper models measurably fail at:
<metered_justification>
The exhaustive list. Use a metered model (gpt-5.2-pro, o3) only when the scenario matches one of these:
If the scenario doesn't fit one of these four, route to flat-rate. </metered_justification>
<metered_blocked> These use cases never justify a metered model, regardless of task complexity:
Check utilization before routing. Do not assume headroom.
| seven_day utilization | Routing guidance |
|---|---|
| < 70% | Normal — best model for the task tier |
| 70–85% | Conservative — prefer sonnet over opus; haiku for flash/fast tiers |
| 85–95% | Austerity — sonnet max for everything except active user conversation with explicit escalation. No opus for crons. |
| > 95% | Emergency — haiku + local only. Opus only for active user conversation with explicit ask. No automated work above haiku. |
| five_hour utilization | Override |
|---|---|
| > 80% | Downshift one tier regardless of seven_day status |
| > 95% | Local models only for all automated/cron work |
<missing_data_rule> If utilization data is unavailable, treat seven_day = 75% (conservative mode).
Missing data isn't permission to use opus — it's a signal to be cautious. Assume only the headroom you can prove. </missing_data_rule>
A task is ambiguous when it matches rows in two or more tiers of the Fast Route Table (e.g. "write code" and "debug complex system"), or matches no row at all. A task that matches one row is not ambiguous — route it; do not classify it.
Default (no configuration): decide the tier yourself using the tier definitions below and the Generosity Rule. Nothing is sent to another model for this.
Optional local classifier — off by default. Only when the operator has set MODEL_ROUTER_CLASSIFIER=local, you may ask a local model (e.g. Ollama qwen3 on 127.0.0.1) to pick the tier. Never send the raw task: send a one-line abstract summary (task type, expected output, complexity signals) with no code, credentials, names, URLs, customer or personal data. If the variable is unset, has any other value, or no local model is reachable, skip this and use the default. This skill never sends classification requests to a remote provider.
Tier definitions (used by you, or by the opt-in local classifier):
Classify this task into exactly one tier. Reply with ONLY the tier name.
Tiers:
- flash: mechanical lookup, formatting, simple extraction
- fast: summarization, translation, template work
- mid: code generation, content writing, analysis, drafting
- strong: complex debugging, self-reflection, creative writing, architectural decisions
- reasoning: math proofs, formal logic, multi-step deduction
Task summary: {ABSTRACT_ONE_LINE_SUMMARY}
Tier:
The tier names are fixed internal labels the router matches on; they do not affect the language of anything shown to the user.
If you (or the opt-in local classifier) chose a tier but you're unsure:
Generosity applies within flat-rate tiers. Going up never means jumping to metered without justification.
// Before (manual, billing-unaware):
sessions_spawn({ task: "Review this PR", model: "gpt-5.2-pro" });
// After (billing-aware):
// 1. Check Fast Route Table → "Review code" → mid → sonnet (flat)
sessions_spawn({ task: "Review this PR", model: "sonnet" });
// Cross-model review (metered justified):
// 1. High-stakes deliverable + cross-model perspective needed
// 2. Check budget: seven_day < 85%
// 3. Use gpt-5.2-pro only then
sessions_spawn({
task: "Review my architecture proposal for external publication",
model: "gpt-5.2-pro",
});
heartbeat: flash/local → qwen3 (free, NEVER metered)
cleaning-lady: fast → haiku (flat, NEVER metered)
morning-briefing: mid → sonnet (flat, NEVER metered)
code review: mid → sonnet (flat, NEVER metered)
wind-down: strong → opus (flat, NEVER metered)
self-evolution: strong → opus (flat, NEVER metered)
research reports: mid → sonnet (flat, NEVER metered)
## Model Routing
- All automated/cron work: flat-rate models only (opus/sonnet/haiku/local)
- Metered models (GPT, o3): only for cross-model review or user-initiated request
- Budget pressure: check utilization before spawning. >85% seven_day → sonnet max. >95% → haiku/local only.
- Missing data → assume conservative (75%). Never assume headroom you can't prove.
- If your gateway enforces billing caps, it may reroute a metered request once over budget — check its logs.
For detailed model comparisons, see references/model-strengths.md.
Quick reference for tier selection when multiple flat-rate models are available at the same tier:
| Strength | Best provider | Why |
|---|---|---|
| Coding (Terminal-Bench) | Claude (Opus/Sonnet) | 65.4 score, leads benchmarks |
| Large context (>200K) | Gemini | 1M window, native long-doc |
| Multimodal (images/video) | Gemini | Full video processing |
| Structured feedback | GPT | Calibrated, consistent format (metered — justify first) |
| Chain-of-thought reasoning | o3 | Purpose-built for deduction (metered — justify first) |
| Speed + cost efficiency | Haiku / qwen3 | Fastest flat-rate and free options |
| Creative/nuanced writing | Opus | Best subjective quality (flat-rate) |
The router applies to ALL model selections, including:
<cron_restriction> All cron-originated work inherits the metered-blocked restriction. The user isn't there to authorise spend, so the policy treats it as flat-rate-only across the board. </cron_restriction>
When a cron job spawns sub-agents, EACH sub-agent gets its own tier — and ALL inherit the flat-rate restriction:
Cron: morning-briefing (sonnet, flat)
└── Sub-agent: check emails → fast (haiku, flat)
└── Sub-agent: calendar summary → flash (qwen3, free)
└── Sub-agent: draft briefing text → mid (sonnet, flat)
For complex multi-step tasks, see references/task-orchestration.md:
Match CoT technique to tier for maximum ROI. See references/chain-of-thought.md:
In AGENTS.md (every prompt): Only the billing-aware routing rule:
## Model Routing
- All automated/cron work: flat-rate models only (opus/sonnet/haiku/local)
- Metered models (GPT, o3): only for cross-model review or user-initiated request
- Budget pressure: check utilization before spawning. >85% seven_day → sonnet max. >95% → haiku/local only.
- Missing data → assume conservative (75%). Never assume headroom you can't prove.
- If your gateway enforces billing caps, it may reroute a metered request once over budget — check its logs.
In this skill (loaded on demand): The full routing table, tier definitions, ambiguous-case rules, budget pressure tables, justification scenarios.
In reference files (loaded only when needed):
references/model-strengths.md — detailed benchmarks and per-provider analysisreferences/task-orchestration.md — big task decomposition, Claude Code architecturereferences/chain-of-thought.md — CoT techniques matched to tiersThis follows the progressive disclosure principle: 5 lines always loaded, full skill on demand (~6KB), deep references only when the task requires them.
<anti_patterns>
MODEL_ROUTER_CLASSIFIER=local that receives only an abstract summary. Corrected the security note to match, defined "ambiguous", and scoped the description to models you have configured.👉 https://github.com/globalcaos/tinkerclaw
Clone it. Fork it. Break it. Make it yours.