The Problem Nobody Talks About
Every AI coding tool sells you on the frontier model. Claude Code defaults to Fable 5. Codex pushes Sol. Cursor uses whatever's newest.
But here's what six months of running production AI workloads taught me: 65% of your AI coding calls don't need a frontier model.
Tests? Boilerplate? Documentation? File scaffolding? You're burning $50/Mtok output tokens on work that a $3/Mtok model handles identically.
Last quarter we spent $10,400/month across Claude Code, Codex, and API calls. After implementing task-level routing, we're at $3,100. Same output quality. Same velocity. Here's exactly how.
What Is Task-Level Model Routing?
Traditional model selection: pick the best model, use it for everything.
Task-level routing: classify each task, then route it to the cheapest model that can handle it well.
This isn't new. Coinbase built a routing layer that cut their LLM spend nearly in half while usage kept growing. The concept is simple — the implementation details matter.
For coding specifically, here's how tasks break down:
| Task Type | % of Calls | Model Needed | Cost Tier |
|---|---|---|---|
| Architecture & Planning | ~10% | Frontier (Fable 5, Sol) | $$$$ |
| Complex Implementation | ~25% | Mid-tier (Opus 4.8, Terra) | $$$ |
| Boilerplate & Scaffolding | ~30% | Fast (Sonnet 5, Luna) | $$ |
| Tests & Documentation | ~25% | Budget (Haiku, Nano) | $ |
| Refactoring | ~10% | Mid-tier | $$$ |
The math is brutal when you realize most teams send everything to the top row.
The Quick Win: CLAUDE_CODE_SUBAGENT_MODEL
If you're on Claude Code, this one environment variable is worth hundreds per month:
export CLAUDE_CODE_SUBAGENT_MODEL=claude-sonnet-5
Claude Code's orchestrator (Fable) spawns sub-agents for individual file edits, test generation, and scaffolding tasks. By default, every sub-agent also uses Fable. Setting SUBAGENT_MODEL routes these worker tasks to Sonnet instead.
Result: Same quality plans. Same architecture decisions. 60% fewer Fable tokens consumed. Your 5-hour rate limit suddenly stretches to 12+ hours of productive work.
The Full Setup: Multi-Provider Routing
For teams using multiple tools, here's the architecture that got us from $10K to $3K:
Step 1: Classify Your Tasks
Before routing, you need to know what you're routing. We track every AI call by category:
- Planning calls: Architecture decisions, system design, complex debugging
- Implementation calls: Writing new features, integrating APIs
- Maintenance calls: Tests, docs, formatting, linting fixes
- Review calls: Code review, refactoring suggestions
Step 2: Assign Models by Category
Our current routing table (July 2026 prices):
Planning → Fable 5 ($10/$50 per Mtok) or Sol ($5/$30)
Implementation → Opus 4.8 ($15/$75) or Terra ($2.50/$15)
Maintenance → Sonnet 5 ($3/$15) or Luna ($0.50/$3)
Review → Haiku ($0.25/$1.25) or Nano ($0.10/$0.60)
Step 3: Measure and Adjust
The routing table isn't static. We review weekly:
- If a cheaper model produces noticeably worse output for a category → upgrade
- If a category has zero quality complaints at current tier → try downgrading
- Track rejection rate (how often you redo AI-generated work) per model per category
Real Numbers: Before and After
Before (January 2026):
- Claude Code: ~$4,200/mo (all Opus/Fable)
- Codex API: ~$3,800/mo (all GPT-5)
- Direct API calls: ~$2,400/mo
- Total: $10,400/mo
After (June 2026):
- Claude Code: ~$1,400/mo (Fable orchestrator + Sonnet sub-agents)
- Codex: ~$900/mo (Sol planning + Luna implementation)
- Direct API calls: ~$800/mo (routed by task type)
- Total: $3,100/mo
Quality impact: Rejection rate went from 12% to 11%. Slightly better, because cheaper models are often more deterministic for straightforward tasks.
Common Objections
"Won't cheaper models produce worse code?"
For planning and architecture — yes, significantly. That's why you keep frontier models for those tasks. For writing a React component from a clear spec? Sonnet 5 and Luna are virtually indistinguishable from Fable on well-defined implementation tasks.
"This sounds like a lot of overhead to manage."
The initial setup takes an afternoon. After that, it's a 15-minute weekly review. The ROI is immediate — we saved more in the first week than the setup time cost.
"What about when models get cheaper?"
They will, and that's great. Routing still helps because the spread between frontier and budget tiers stays large. Even if everything drops 50%, the relative savings from routing remain.
What's Next
The market is moving toward this pattern fast. MindStudio, OpenClaw's ClawRouter, and open-source tools like Plano are all building routing layers. Anthropic themselves benchmarked "Fable orchestrates, cheap models execute" at 96% performance for 46% of the cost.
Outcome-based pricing (pay per completed task, not per token) is coming. But until then, task-level routing is the most practical way to control AI coding costs without sacrificing quality.
I'm Bo — I've shipped 10+ apps and spend way too much time optimizing AI workflows. Currently building tools that make model routing automatic. Find me @aplomb2 on X.
Top comments (0)