A cheaper model costs less per token, not necessarily per task. Coding agents re-read the conversation on every request, so extra turns raise cost faster than the turn count: in our example, Sonnet 5.5 loses its 50% price advantage over Opus 5.5 once a task takes about 1.6x the requests. Failed attempts and the developer's time widen the gap. Compare models by cost per finished task, measured on your own work.
The price-list comparison: Sonnet is half of Opus
Every Claude token type costs twice as much on Opus 5.5 as on Sonnet 5.5, so the same requests cost exactly half on Sonnet. Take the illustrative 30-request Claude Code task from our Opus vs Sonnet cost breakdown: $1.04 on Opus and $0.52 on Sonnet. Most of it is cache reads, because each request re-reads the conversation so far.
| Model | Input | Cache read | Cache write | Output |
|---|---|---|---|---|
| Claude Opus 5.5 | $4.00 | $0.20 | $5.00 | $20.00 |
| Claude Sonnet 5.5 | $2.00 | $0.10 | $2.50 | $10.00 |
This is what re-pricing tools show, including Ganivra's: the same tokens on another model. It assumes the other model makes exactly the same requests, which makes it a best case. Prices: Claude models overview.
Why more turns cost more than you expect
If Sonnet needs more requests to finish the same task, the cost doesn't rise in proportion. Each extra request re-reads a longer conversation, so cache reads grow roughly with the square of the number of turns. The table assumes exactly that, with everything else growing in line with the turns.
| Sonnet requests | Sonnet cost | Opus cost (30 requests) | Sonnet vs Opus |
|---|---|---|---|
| 30 (1x) | $0.52 | $1.04 | 50% cheaper |
| 38 (1.25x) | $0.73 | $1.04 | 30% cheaper |
| 45 (1.5x) | $0.97 | $1.04 | 7% cheaper |
| 53 (1.75x) | $1.23 | $1.04 | 18% more |
| 60 (2x) | $1.53 | $1.04 | 47% more |
Under these assumptions, Sonnet stops being cheaper at about 1.6x the requests, around 48 instead of 30. Extra turns come from smaller steps, more file reads, re-running tests after a wrong fix, or asking the developer to clarify. Starting a fresh session for a new task, rather than continuing a long one, keeps the context short whichever model you use; Anthropic's Claude Code cost guide covers this.
Failed attempts: divide by the success rate
A task that fails and is done again costs a second attempt. If attempts are retried until one works, the expected cost per finished task is the cost per attempt divided by the share of attempts that succeed. The success rates below are illustrative; yours depend on the codebase, the task and how it is prompted.
| Kind of task | Opus succeeds | Sonnet succeeds | Opus per finished task | Sonnet per finished task |
|---|---|---|---|---|
| Routine change | 90% | 80% | $1.16 | $0.65 |
| Unfamiliar code | 90% | 60% | $1.16 | $0.87 |
| Hard multi-step change | 80% | 40% | $1.30 | $1.30 |
On routine work, Sonnet stays clearly cheaper. On a hard change where it succeeds half as often as Opus, the token cost is about even, before counting extra turns within each attempt. Combine the two effects, more turns and more failures, and Sonnet can cost more per finished task than Opus.
The cost that isn't on the model bill
The tokens are the small part. If a developer costs $100 an hour, 10 minutes spent reviewing and discarding a failed attempt costs $16.67, about 32x the $0.52 the attempt cost in tokens. A model that fails more often can be cheaper on the bill and more expensive for the team.
That cuts both ways: on routine tasks Sonnet is often faster, and waiting for a slower, stronger model costs time too. The point is to count failed and redone work, not to default to the most expensive model.
When the cheaper model is much cheaper
The same logic applies further down the price list. In one hour of our own Claude Code use, the recorded cost was $18.51; the same tokens re-priced on a much cheaper model came to $0.95, about 19x less.
Suppose the cheaper model needed twice the requests. Under the square-of-turns assumption that is roughly 3 to 4 times the tokens, so about $3.32. If 4 in 10 of its tasks also had to be redone, about $5.54. Still cheaper on tokens, but closer to 3.3x than 19x, and the developer time on redone work can outweigh the rest. A per-request comparison flatters the cheaper model; only a measured cost per task shows the real gap.
How to measure cost per task on your own work
- 01Pick a unit of work
For Claude Code, a prompt (one user turn) or a session. Its OpenTelemetry export carries a prompt ID and a session ID on every request, and reports failed requests as
api_errorevents. - 02Run both models on similar work
Switch a few developers, or a few days, to the other model with
/model. Aim for at least five sessions on each, on comparable tasks. - 03Compare medians, not totals
Look at the median cost per prompt and per session, requests per prompt, and the share of failed requests. Medians keep one runaway session from deciding the result.
- 04Count what didn't finish
Note tasks that were abandoned or redone on the other model. Their cost belongs to the model that failed.
Ganivra's Coding agents view does this from Claude Code's and Codex's own telemetry, without a proxy: Cost per task shows, for each model, the median cost per session and per prompt, requests per prompt and failed requests, with a ratio against your most-used model. Re-pricing on other models stays available, labelled as the best case it is. See AI coding cost tracking to connect it.
Related: Opus or Sonnet in Claude Code: what it costs, what Claude Code's starting context costs, and self-hosting AI coding models.
Frequently asked questions
Can a cheaper LLM really cost more than an expensive one?
Per token, no. Per finished task, yes. Agents re-read the whole conversation on every request, so a model that needs more turns re-reads more context each time, and cost grows faster than the number of turns. In our worked example, Sonnet 5.5 costs half of Opus 5.5 per token but costs more per task once it needs about 1.6x the requests. Failed attempts that have to be redone add to that.
Is Claude Sonnet cheaper than Opus per task?
Usually, for routine work. Sonnet 5.5 is half the price of Opus 5.5 per token, so it stays cheaper unless it needs roughly 1.6x the requests, or fails much more often. On hard, multi-step changes the gap can close or reverse, and the developer's time spent on failed attempts usually costs more than the tokens.
How do you measure LLM cost per task?
Group requests into a unit of work and divide its cost by the tasks that finished. In Claude Code, each prompt has a prompt ID and each session a session ID in its OpenTelemetry export, and failed requests are reported as api_error events. Compare models on similar work, using medians, with enough tasks on each model.
Why does re-pricing tokens on a cheaper model overstate savings?
Re-pricing assumes the cheaper model makes exactly the same requests. It is a best case: a weaker model often needs more turns, more retries and more re-reads of a growing context, or doesn't finish the task. Use re-pricing to find candidates, then measure cost per task on real work.
How should a team choose between Opus and Sonnet?
Default to the cheaper model for routine work and switch to the stronger one for hard tasks. Then measure: if the cheaper model needs far more requests per prompt, or a high share of tasks are redone, the saving is smaller than the price list suggests.
Measure it on your own work
See what a finished task costs on each model.
Connect Claude Code or Codex in one command, then compare cost per session and per prompt across the models your team uses. 14-day free trial, no credit card.