Methodology

Model Routing for Coding Agents: Cut Cost, Keep Quality

You do not run one model for everything. Plan with the expensive model, delegate execution to the cheap one, and reserve frontier rates for the hard parts. Here is the routing pattern, a task-to-model decision matrix, and the cost math behind it.

By Kylian Migot · Updated July 2026 · 11 min read

Quick answer

Model routing is matching each coding task to the cheapest model that can do it well instead of running one model for everything. The core pattern: a frontier planner (Claude Fable 5) drafts specs, architects, and reviews, then delegates routine execution to a workhorse (Claude Sonnet 5), a fast tier (Claude Haiku 4.5), or Codex (GPT-5.6 Terra/GPT-5.6 Sol). Because output tokens dominate coding spend, moving execution off the frontier tier cuts cost 3-10x on those tokens while quality stays where it matters. Prices verified July 18, 2026.
One-line definition
Match each task to the cheapest model that can do it well
The pattern
Plan with the frontier model, execute with the cheap one (Claude Fable 5 plans, Claude Sonnet 5/GPT-5.6 Terra execute)
Why it saves
Output tokens dominate spend; routine work is the bulk of it
Frontier vs fast (output)
$50 vs $5 per MTok, a 10x delta
01

What Model Routing Is, and Why One Model for Everything Wastes Money

Model routing is the practice of sending each coding task to the cheapest model that can do it well, rather than picking one model at the start of a project and running it for everything. The frontier tier is priced for the hardest reasoning; most of the work a coding agent does is not the hardest reasoning. Paying frontier rates for routine execution is the single most common and most invisible way agentic coding budgets get burned.

The waste is structural, not incidental. Coding output is token-heavy, and output tokens are the expensive half of the meter. Run every story through Claude Fable 5 at $50 per million output tokens and a codebase-full of routine edits, tests, and renames costs the same per token as a genuinely hard cross-cutting refactor, even though a model costing a tenth as much would have produced identical routine code. The frontier model is not doing anything special on the easy work; you are just paying as if it were.

02

The Tiers, Their Real Prices, and What Each Is For

Routing only works if you know the roster. Both vendors ship a capability ladder, frontier, flagship, workhorse, fast, and the price gap between top and bottom is roughly 10x on output tokens. Verified prices and positioning across both CLIs (AIDEN runs both), as of July 18, 2026:

ModelVendorTierPrice (per MTok)ContextWhere it fits
Claude Fable 5Anthropicfrontier$10 in / $50 out per MTok1M tokens (128k output)Plan, architect, review the hard parts
Claude Opus 4.8Anthropicflagship$5 in / $25 out per MTok1M tokensComplex day-to-day feature work
Claude Sonnet 5Anthropicworkhorse$3 in / $15 out per MTok1M tokens (default)Routine features, tests, refactors
Claude Haiku 4.5Anthropicfast$1 in / $5 out per MTok200k tokensMechanical edits, sub-agents, triage
GPT-5.6 SolOpenAIfrontier$5 in / $30 out per MTokn/aHard terminal-agent runs in Codex
GPT-5.6 TerraOpenAIworkhorse$2.5 in / $15 out per MTokn/aDefault Codex executor
GPT-5.6 LunaOpenAIfast$1 in / $6 out per MTokn/aCheap mechanical work in Codex

The prices tell you where each tier earns its place. Claude Fable 5 is the frontier: the best published SWE-bench Verified score (95.0%) and a 1M-token window that holds a large repo plus specs, but $50/MTok out and, by the catalog's own note, “overkill for routine edits” and not even Claude Code's default, you select it explicitly. Claude Sonnet 5 gives you a 1M window at $15/MTok out, the value tier for real work. Claude Haiku 4.5 is the floor at $5/MTok out, built for sub-agent fan-outs and lint-fix mechanical changes, not complex autonomous coding. On the Codex side the same ladder repeats: GPT-5.6 Sol for hard runs, GPT-5.6 Terra as the sane default, GPT-5.6 Luna for cheap volume. Full detail on each is on the models hub, with tier-picking guides for Claude and Codex.

03

The Delegation Pattern: Planner Drafts and Reviews, Executor Implements

Routing is not just picking a model once per task in isolation, the highest-leverage version is a delegation pattern within a single unit of work. The expensive model does the thinking that is hard to get right; a cheaper model does the typing that is not. Concretely, Fable plans, Codex or Sonnet execute, Fable reviews.

  1. 1

    The frontier model plans (spend frontier tokens here)

    Point Claude Fable 5 at the codebase and have it draft the spec: files to touch, the approach, acceptance criteria, explicit exclusions. This is exactly where its 1M-token window and best-in-class reasoning pay for themselves, a large-context spec review is a frontier-tier job. It is a small slice of the total tokens and the one place a wrong decision is expensive.
  2. 2

    A cheaper model executes (spend most tokens here)

    Hand the approved spec to a workhorse: Claude Sonnet 5 on the Claude side, GPT-5.6 Terra on the Codex side, or Claude Haiku 4.5/GPT-5.6 Luna for genuinely mechanical work. Because the scope is written down, the executor gets a bounded contract, not a vague brief, and a cheaper model with a good spec beats a frontier model with a fuzzy one.
  3. 3

    The frontier model reviews (spend a little frontier again)

    Bring the diff back to Claude Fable 5 and have it check the implementation against the spec: does it match, did anything out of scope change, do the acceptance criteria hold? The reviewer is not grading its own homework, and reviewing a diff is cheaper than writing it. This closes the loop without paying frontier rates for the bulk execution.

The reason this works is that the token distribution is lopsided. Planning and review are a thin layer of high-value tokens; execution is the thick layer of routine tokens. Routing puts the expensive model only on the thin layers. The mechanics of running two model families on one repo, branches, worktrees, and the shared spec that acts as the contract, are covered in using Claude Code and Codex together; this article is about which model gets which layer and why.

Your AI workspace for shipping software.

Download AIDEN free and point it at your existing Claude Code or Codex setup. No credit card, running in minutes.

Download AIDEN free

Free to start · macOS 12+ · No credit card required

04

The Decision Matrix: Task Type to Model

Here is the routing table in one place. Read it as a starting heuristic tuned to the current roster, not a law, your codebase gets the final vote. The rule underneath every row: escalate a tier when a wrong early step is expensive, drop a tier when the work is bounded and you review it anyway.

Task typeRecommended modelWhy
Hard, cross-cutting refactorClaude Fable 5Tangled multi-file reasoning where one wrong step costs the run; frontier SWE-bench Verified (95.0%) earns its $10 in / $50 out per MTok
Spec drafting / large-context reviewClaude Fable 51M-token window holds the repo plus specs; the planning-and-review layer is where frontier tokens belong
Complex day-to-day featureClaude Opus 4.8Flagship, Anthropic's own recommended default for complex agentic coding, at half Fable's price ($5 in / $25 out per MTok)
Routine CRUD, tests, refactorsClaude Sonnet 5Workhorse with a 1M window at $3 in / $15 out per MTok; a good spec makes it as good as a frontier model on bounded work
Parallel bulk edits in CodexGPT-5.6 Terra (or GPT-5.6 Sol)Sane Codex default at $2.5 in / $15 out per MTok; escalate to Sol for ultra mode's parallel subagents on hard runs
Cheap / throwaway mechanical editsClaude Haiku 4.5 / GPT-5.6 LunaFast tiers at $1 in / $5 out per MTok and $1 in / $6 out per MTok; plenty for renames, lint fixes, sub-agents, and triage you review anyway

Two rows deserve a note. The frontier appears twice, refactors and spec review, because both are reasoning-bound and both are cheap as a share of total tokens; that is precisely the profile you want to spend up on. The fast tier also appears twice, Claude and Codex, because the cheapest model that clears the bar is a fine default for mechanical work regardless of vendor. When both CLIs are in play, route the story to whichever family fits and let cost break the tie.

05

The Cost Math, Kept Honest

The savings claim is easy to hand-wave, so here is a rough, clearly illustrative split using catalog output prices (output dominates coding spend). Assume a feature worth roughly 2M output tokens of agent work: a thin planning-and-review layer and a thick execution layer. Take the split as about 15% planning/review and 85% execution, which matches the lopsided distribution routing exploits.

Illustrative feature ~= 2,000,000 output tokens
(output prices only; verified July 18, 2026)

A) All-frontier (Claude Fable 5, $50/MTok out)
   2.0M x $50                         = $100.00

B) Routed (plan/review on Fable, execute on Claude Sonnet 5)
   plan+review  0.3M x $50  = $15.00
   execution    1.7M x $15   = $25.50
   total                                   = $40.50

C) Routed to the floor (execute on Claude Haiku 4.5, $5/MTok)
   plan+review  0.3M x $50  = $15.00
   execution    1.7M x $5    = $8.50
   total                                   = $23.50

Routing execution to Claude Sonnet 5 takes the output bill from $100.00 to about $40.50, roughly a 2.5x reduction, and routing the mechanical slice to Claude Haiku 4.5 pushes it near $23.50, close to a 4.3x reduction, all while the planning and review stay on the frontier model. The exact multiple depends on your token split and ignores input tokens and caching, but the shape is robust: the more of your work is routine, the more routing saves, because you keep frontier rates on the thin layer and pay workhorse or fast rates on the thick one.

06

The Failure Modes of Routing

Routing is a lever, and like any lever it can be pulled wrong. Three failure modes account for most of the disappointment:

Routing too aggressively

Chasing the cheapest tier on work that is subtly hard. The cheap model fails, you re-run it, maybe escalate anyway, and the retries plus your wasted attention cost more than doing it on the right tier the first time. Cheap-per-token is not cheap-per-result.

Cheap model on a frontier task

A tangled refactor or an architecture call handed to Claude Sonnet 5 or a fast tier because it looked routine. The catalog is explicit that Claude Sonnet 5 is "noticeably behind Opus/Fable on hard multi-step reasoning"; on genuinely hard work that gap becomes wrong code you review at length or ship by mistake.

Context handoff loss

The planner understood the codebase; the executor starts cold. If the only thing that crosses the handoff is a thin prompt, the cheap model re-derives context badly or misses constraints the planner knew. The fix is a written spec as the contract, not a verbal toss-over.
07

How AIDEN Routes: Both CLIs, One Board, Model per Story

Routing only pays off if switching models is cheap and the handoff is enforced. That is what AIDEN is built for. It is a cockpit over the CLIs you already have, it orchestrates Claude Code and Codex side by side on one spec-first kanban board, BYO inference (your own Claude and Codex subs or keys), local-first, PR-per-story. Because both CLIs run at once, routing is a per-card choice, not a per-project commitment.

Model per story

Every story card gets an agent and model assignment. The planning story goes to your frontier model (Claude Fable 5); execution stories go to a workhorse (Claude Sonnet 5) or to Codex (GPT-5.6 Terra). The delegation pattern becomes a dropdown instead of a discipline.

The spec is the handoff

AIDEN's spec gate means every story gets a written, approved spec before any CLI starts coding. That approved spec is exactly the contract that prevents context-handoff loss, the executor inherits the planner's intent in writing, not a thin prompt.

Worktree and PR per story

Each story runs in its own git worktree and lands as its own PR, so a frontier planning session and a cheap execution session never collide, and every routed piece of work is reviewable in isolation.

The result is that plan-with-the-expensive-model, execute-with-the-cheap-one stops being a manual juggling act across terminals and becomes the default shape of the board. Assign the planning story to Claude Fable 5, fan the execution stories out to Claude Sonnet 5 and GPT-5.6 Terra, and review on the frontier again, all in one project. If you are still choosing between the two CLIs, start with Claude Code vs Codex; the routing pattern here assumes you have answered “both.” AIDEN is free for one project and Solo is $19/mo, so you can put a real routed workflow on a board today. And once the window matters as much as the model, pair this with context engineering, the other half of getting good work out of a coding agent cheaply.

FAQ

Should I use one model or several for coding?
Several, if you care about cost. Running a frontier model like Claude Fable 5 on every task is like hiring a principal engineer to write CRUD boilerplate: it works, but you overpay by multiples. The efficient pattern is model routing, use the expensive model for planning, architecture, and review, and delegate routine execution to cheaper, faster tiers. On the same task shape, that split can cut spend several-fold while keeping quality where it matters, on the hard parts.
Which Claude model is cheapest for coding?
Claude Haiku 4.5 at $1 in / $5 out per MTok, the fast tier built for sub-agents, classification, and quick mechanical edits (200k context). For real feature work at a low price, Claude Sonnet 5 is the value pick at $3 in / $15 out per MTok (with intro pricing lower through Aug 31, 2026) and ships a 1M-token window. Reserve Claude Fable 5 ($10 in / $50 out per MTok) and Claude Opus 4.8 ($5 in / $25 out per MTok) for the hard, cross-cutting work that actually needs them. Prices verified July 18, 2026.
Can Claude and Codex work on the same project?
Yes. Both are CLIs operating on a local git checkout, so you can route a planning story to Claude Code and execution stories to Codex on the same repo. The safe pattern is one branch or worktree per task so the agents never share a working directory, plus a written spec as the contract between them. AIDEN runs both CLIs on one kanban board and lets you assign the model per story.
How much can model routing save?
It depends on your task mix, but the arithmetic is favorable whenever most of your tokens are routine. Because output tokens dominate coding spend, moving execution off a frontier tier (Claude Fable 5 at $50/MTok out) onto a workhorse (Claude Sonnet 5 at $15/MTok out) or fast tier (Claude Haiku 4.5 at $5/MTok out) is a 3-10x reduction on those tokens, while you still spend frontier rates only on the small planning-and-review slice. The savings scale with how much of your work is genuinely routine.
Does a bigger model always write better code?
No. A frontier model earns its price on hard, cross-cutting reasoning, tangled refactors, architecture, review of large diffs, where a wrong early step is expensive. On well-scoped, mechanical work (a new endpoint matching an existing pattern, a batch of tests, a rename), a workhorse or fast tier produces the same result for a fraction of the cost and often faster. The skill is matching the tier to the task, not defaulting to the biggest model.

Keep reading

Route the model per story, not per project.

AIDEN runs Claude Code and Codex side by side on one board, so the planning story goes to your frontier model and execution stories to a cheaper one, per card. Free for one project.

macOS 12+ · Bring your own Claude Code or Codex · Your code stays local