I benchmarked my coding agent against Claude Sonnet on every step: $0.03 vs $0.47
I'm building Puffin Coder, a VS Code coding agent. The idea is simple: send each step to the cheapest model that can handle it, and only bring in a frontier model when the cheap ones keep failing. That sounds good on a
I'm building Puffin Coder, a VS Code coding agent. The idea is simple: send each step to the cheapest model that can handle it, and only bring in a frontier model when the cheap ones keep failing.
That sounds good on a landing page. I wanted to know if it actually saves money, so I measured it.
The setup
I ran the same agent loop two ways on the same 4 tasks:
- Routed: cheap models first (DeepSeek V4.1 Flash, then Qwen3 Coder Next). The agent escalates to Claude Sonnet only after repeated serious failures (syntax errors, failing checks, crashed processes).
- Sonnet on every step: the identical loop, but every single step goes to Claude Sonnet 5.5.
The tasks are small changes to a tiny todo app:
- Fix a buggy
slugifyfunction - Add input validation to a POST endpoint (return 400s)
- Write a
parseDurationfunction plus tests - Add a dark mode toggle that persists across reloads
Each task has hidden tests the agent never sees. They run only after the agent says it's done, and they decide pass or fail. Costs are what OpenRouter actually billed, not estimates.
The results
Every run passed every hidden test.
| Task | Routed | Sonnet every step |
|---|---|---|
Bug fix: slugify
|
$0.003 | $0.104 |
| Input validation | $0.013 | $0.094 |
parseDuration + tests |
$0.009 | $0.114 |
| Dark mode toggle | $0.006 | $0.158 |
| Total | $0.031 | $0.469 |
About 15x cheaper overall.
What I learned
Most agent work is easy. Reading files, making small edits and running tests is the bulk of what a coding agent does. On these tasks, the routed agent never needed to escalate at all. Every step ran on Qwen3 Coder Next.
Cheap models take more steps, but it doesn't matter much. The routed agent sometimes took up to 2.5x as many steps (13 vs 5 on the validation task). But each step cost roughly 20 to 30 times less, so the total still came out far lower.
Escalation rules matter more than model choice. My first version escalated too eagerly and too late at the same time: it counted every hiccup as a failure, and when it finally did escalate it handed the strong model the entire messy history. Two changes fixed most of it:
- Only count serious failures (syntax errors, failed checks, dead processes), and escalate after 3 of them.
- When escalating, hand over a short summary instead of the full conversation, so the expensive model isn't paying to re-read everything.
Caveats
- One run per task per setup, on 4 small tasks. This is a data point, not a leaderboard.
- The tasks are small and well specified. Bigger, vaguer work is exactly where you'd expect to need the strong model more, and this benchmark doesn't test that.
- Both setups use my agent loop, so this measures routing, not "Puffin vs Claude Code" or "Puffin vs Cursor".
Try it or check my work
Everything is open source: the tasks, the hidden tests, the runner script, and the raw per-run billing data.
π github.com/funkyidol6/agent-cost-bench
You can also drop your own agent into it: keep the fixture and the hidden tests, give your agent each task's goal, and run the matching test.
If you want to try the agent itself, Puffin Coder is free in VS Code, works with your own API key from 16 providers, or with the built-in managed access.
I'd love to hear how other people decide when an agent should escalate. One commenter suggested weighting by "blast radius" (auth, migrations and widely imported modules get the strong model up front), which I'm planning to try next.
This post was written with an AI assistant from my own benchmark data. Every number is in the repo.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.