Hey everyone! When your coding agent opens a file, greps for a function name, or reads a wall of test output, which model is doing that work?
For most of us, it's the same expensive model that writes the hard code, on every step of every loop.
I think that's where most agent money goes. I'm building my own agent harness around fixing it, and here's the case for routing each step to the cheapest model that can handle it.
Most of what an agent does is reading
Watch a coding agent work and you'll see a lot of looking around before any code gets written. Researchers at the University of Washington released a trace of about 4,300 real Claude Code and Codex sessions. That's roughly 350,000 model calls and 430,000 tool calls. Their main finding was long loops with long contexts and short outputs.
The bill follows the same pattern. One study cited in Augment's cost breakdown found agentic coding uses over 1,000 times more tokens than a single-turn question, with more than 150 input tokens for every output token. A dev who tracked a week of their own agent averaged 23 Read, Grep and Glob calls per prompt.
So most of the work is reading files, searching, and summarizing what came back. Picking which file to open next is not a frontier-model problem.
The price gap is huge
Here's OpenAI's current lineup at the standard tier, per million tokens (pricing page, December 2026):
| Model | Input | Output |
|---|---|---|
| gpt-6.2-astra (flagship) | $8.00 | $40.00 |
| gpt-6.2-sol | $2.00 | $10.00 |
| gpt-6.1-terra | $1.00 | $5.00 |
| gpt-6-luna (smallest) | $0.10 | $0.50 |
The flagship costs 80 times more than the smallest model on both input and output. Most providers sell a similar range of big and small models.
If your agent pushes 10 million input tokens through a day of reading files, that's $80 on the flagship and $1 on the small one. Most of those tokens are grep results and file contents.
The research already says routing works
Two papers made the case for routing years ago.
FrugalGPT (Stanford, 2023). This paper tries the cheapest model first and only moves up to a pricier one when the answer doesn't pass a quality check. The authors reported matching the best single model with up to 98% lower cost.
RouteLLM (LMSYS and UC Berkeley, 2024). Instead of trying models in order, RouteLLM trains a small router to guess up front which model each request needs. Their best router hit 95% of GPT-4's quality while sending only 26% of calls to GPT-4. With extra training data, that dropped to 14% of calls. The open-source release reports cutting costs by up to 85% on MT Bench.
Both papers tested chat-style questions, not agents. Agent steps should be even easier to route, since so many of them are plain reading and searching.
How I'd split it up
The simplest way to route an agent is by role, so you don't need a fancy trained router on day one. My harness has five agent roles. Here's the split I'd start with:
| Role | What it does | Model size |
|---|---|---|
| Explorer | Reads files, greps, maps the codebase | Smallest |
| Tester | Runs tests, summarizes what failed | Small |
| Manager | Picks the next step and hands it off | Mid |
| Plan writer | Breaks the task into steps | Mid to large |
| Coder | Writes and edits the actual code | Large for hard changes, mid for boilerplate |
Then add one rule from FrugalGPT: if a cheap model fails a step, retry it one size up. That way the big model only sees the work that needs it.
I'm building mine on the OpenAI-compatible API standard, so swapping models is a one-line config change. If your harness locks you into one provider, that's the first thing I'd fix.
Where routing bites back
Routing isn't free money. A few things to watch:
- You give up some quality. RouteLLM's headline is 95% of GPT-4, not 100%. In a coding agent, that missing 5% might be the one bug that eats your afternoon. Keep the big model on anything that touches production code.
- Cheap retries add up. A small model that fails three times before escalating can cost more than calling the big one once. Cap retries at one per tier.
- Switching models can break your cache. Prompt caching works per model, and caching is a big chunk of agent spend. One dev measured two months of their own sessions and found 89% of the bill was cache traffic. Route whole roles to a model instead of flipping models every few calls, so each one keeps its cache warm.
- The papers didn't test agents. Both studies used chat benchmarks. Measure your own sessions before and after you switch.
So, are we overpaying?
I think most of us are. We picked one great model, pointed the whole agent at it, and stopped looking at the bill. The cheap models got good enough to read files and summarize test output a while ago.
I want to hear the other side though! Are you routing your agents across models, or sending everything to the flagship on purpose? And if you tried routing and went back, what broke? Let me know in the comments.
