The cheapest ai coding assistant is decided by a variable that is not on any rate card. We billed one identical coding task twelve times on 2026-09-22 — three models, four consecutive runs each, every answer correct — and the bills ran from $0.019026 to $0.245787. The spread inside a single model reached 3.851x, which is wider than the whole gap between the cheapest model and the dearest one when both are warm. Everything here is re-derived by an internal check script, and every arm's bill recomputes from four token counts.
Key takeaways
- One task, twelve correct answers, a 12.92x spread in what it cost. Nothing about the work changed between arms.
- The same model cost 3.851x itself — Opus 5 billed $0.245787 cold and $0.063824 warm, three times identically.
- A Sonnet run cost 1.779x an Opus run on the same task, because the Sonnet arm was cold and the Opus arm was not.
- The cache write is 61.8% to 77.9% of a cold turn's bill and zero on a warm Opus turn.
- Cross-vendor cost comparison is still unavailable: one of the two agents on this machine reports no price for a completed turn at all.
The short answer
The cheapest ai coding assistant is whichever one you stop restarting. Stop shopping for a cheaper model and start counting cold starts. Prompt caching means the first request of a session pays to write the context and later requests pay a tenth to read it, so the arithmetic that decides your bill is how many separate sessions you open, not which tier you selected.
The full AI coding tools pricing comparison is the pillar this sits under, and it computes the crossover between bringing your own key and paying a seat price at a monthly consumption of X. This article measures X. It turns out to be the least stable term in that equation, which is worth knowing before you solve it.
Twelve arms of one task
The task is a committed fixture used by earlier measurements on this site: four small JavaScript modules, exactly one holding an off-by-one error, copied alone into an empty scratch directory so nothing in this repository — no CLAUDE.md, no README naming the answer — is discoverable above it. The prompt asks for the function name and nothing else. The answer is pageSlice.
claude -p "This directory is a small JavaScript library. Exactly one function in src/ has an off-by-one error. Reply with only that function's name and nothing else." --model claude-opus-5 --output-format json # → "result":"pageSlice" # → "total_cost_usd":0.245787
The one design decision that matters: four runs per model, consecutively, rather than alternating models. An earlier measurement on this site alternated, which meant every arm paid a cold cache. Running them in a row is what makes the second, third and fourth arms comparable to the first.
| Model | Cold run | Warm runs | Spread |
|---|---|---|---|
| Haiku 4.5 | $0.035550 | $0.019463 · $0.020281 · $0.019026 | 1.868x |
| Sonnet 5 | $0.113540 | $0.044455 · $0.044584 · $0.044601 | 2.554x |
| Opus 5 | $0.245787 | $0.063824 · $0.063824 · $0.063824 | 3.851x |
All twelve arms answered correctly. That is a fact about a small task with one right answer, not evidence about any model's ability, and the fixture asserts it in those words.
The same model, twice the price
Read the table down a column and the models rank the way the rate card says they should. Read it across and the ranking stops being stable.
A Sonnet arm cost $0.113540. An Opus arm cost $0.063824. Same task, same machine, same day, both correct — and the model with the lower published input rate cost 1.779x the one with the higher rate. Nothing about the models explains it. The Sonnet arm was the first run in its directory and the Opus arm was the fourth.
That is the finding in one line: the spread you do not control is bigger than the spread you shop for. Opus alone varied 3.851x across four runs. The gap between the cheapest model and the dearest, both held warm, is 3.279x.
Where the money actually goes
Claude Code reports four token counts and a dollar figure for every turn — its own cost documentation explains what the figure covers, and the multipliers come from the published model overview. Four counts, three multipliers and one published input rate per model reproduce every bill above to within 4e-7 — the residual is the sixth decimal place, which is where the reported figure is rounded.
| Component | Rate, relative to input | Opus cold arm | Opus warm arm |
|---|---|---|---|
| Cache write (1h) | 2x | 19,154 tokens | 0 tokens |
| Cache read | 0.1x | 79,234 tokens | 98,388 tokens |
| Output | 5x | 584 tokens | 584 tokens |
| Billed | — | $0.245787 | $0.063824 |
The cache write is the entire difference. On the cold Opus arm it is 77.9% of the bill; on the cold Sonnet arm 75.2%; on the cold Haiku arm 61.8%. On the three warm Opus arms it is zero, and those three arms billed the identical figure three times — not approximately, exactly.
The rest of the turn is almost free by comparison. 98,388 cache-read tokens on Opus cost $0.049194 at a tenth of the $5 input rate; the 584 output tokens cost $0.0146. The context this agent re-reads on every turn is priced like a rounding error once it has been written, and like the whole bill before it has. Anthropic's prompt caching documentation states the multipliers; what it cannot tell you is how often your habits pay them.
The cheapest ai coding assistant is a workflow, not a model
Four decision rules come out of the table, in the order they are worth acting on.
- One session, many questions. Every
claude -pinvocation in a new directory is a cache write you pay at twice the input rate. Four questions in one session bill one write; four separate invocations bill four. - Do not switch model to save money before you have stopped starting cold. On this task, moving Opus to Sonnet saved $0.019240 per warm turn. Keeping Opus warm instead of cold saved $0.181963.
- The cheapest ai coding assistant on a rate card is not the cheapest one on an invoice. Cheap models are not proportionally cheap: Haiku's three warm arms averaged $0.019590 against Opus at $0.063824 — 3.26x, on a card that prices their inputs 5x apart, because output and cache reads do not scale the same way.
- If your work is genuinely a handful of one-shot questions a week, none of this matters and you should optimise the seat instead. What each vendor's plan actually includes is the read for that, and the free tiers are the read if $0 is a hard constraint rather than a preference.
The tier premium is three different numbers
The premium for the larger model has been quoted three ways on this site and all three are correct about different things.
| Source | Opus over Sonnet | What it describes |
|---|---|---|
| Published rate card | 2.5x | the price of a token |
| Alternating arms, 2026-09-19 | 2.1851x | a turn that always starts cold |
| Consecutive arms, 2026-09-22 | 1.4315x | a turn that does not |
The middle row is the six-arm billing measurement from three days earlier. It is refined here rather than corrected. Its design alternated models, so every arm paid a cache write, and 2.1851x is the honest premium for exactly that pattern — our cold arms reproduce it at 2.1648x. Held warm, the same two models on the same task sit at 1.4315x. Both numbers are true and they answer different questions; the fixture says so, and a guard asserts that wording.
The same article also found Sonnet sending more prompt tokens than Opus for identical work, which reproduced again here: the cold Sonnet arm read 109,911 cached tokens against Opus at 79,234.
Budget ai coding across vendors is not answerable
This article prices one vendor because the other one on this machine does not publish a price. Measured on 2026-09-21, Codex CLI and Claude Code on the same task reported different things about what a turn cost: Claude Code a dollar figure every time, Codex a token count and nothing else.
That is consistent with a plan-based product where a completed turn genuinely has no price — and it means there is no cross-vendor cost comparison to make from the tools themselves. Anyone publishing one is combining a rate card with an assumed consumption figure, and the consumption figure is the term this article shows moving 12.92x on a fixed task.
So the cheapest ai coding assistant question splits in two, and an affordable coding ai setup needs both answers: which plan you are on, which the pricing comparison handles, and how many cold starts your habits generate, which nothing on a pricing page can tell you. Where a large bill actually comes from attributed 98.7% of one tool's input side to context being re-read; this measures what it costs to write that context in the first place.
What we did not measure
Which model writes better code. Nothing here scores output. Twelve arms of one question with one right answer is not capability evidence, and the fixture refuses to license a quality claim.
Anything at scale. One task, one machine, one account, one day, three models. Four arms per model is four arms.
Longer sessions. Every arm was a single -p invocation. A long interactive session has a different shape — more turns against one written cache — and this measures the boundary case rather than the common one.
Cache lifetime. The arms ran back to back, well inside the one-hour window they were billed for. Nothing here measures what happens at the edge of it.
Other vendors. Codex CLI publishes no per-turn price, and no other agent was installed on this machine on the day.
Common mistakes picking on price
To turn this per-task spread into a personal forecast, use the solo developer monthly budget, which keeps subscription fees, credits and API charges separate.
- Comparing rate cards. The card prices a token. Your bill is tokens times a multiplier that depends on whether you have asked this question's neighbours recently.
- Downgrading the model first. It is the smallest of the levers here and the most visible, which is why it gets pulled first.
- Reading one measured month as your consumption. The same fixed task moved 12.92x across twelve runs on one afternoon.
- Quoting a cross-vendor price comparison. One of the two agents measured here does not price a turn at all.
- Assuming a cheaper model is proportionally cheaper. Haiku prices its input at a fifth of Opus and delivered a third of the warm bill, because output and cache reads do not follow the input rate.
Conclusion
If you want a cheaper bill this week, change how you invoke the tool before you change which model it points at: one long session instead of four short ones was worth nine times more than a tier downgrade on every arm we ran. Take the model decision on whether the answers are good enough for your work, which this article deliberately does not measure, and take the cost decision on cold starts, which it does. For an explicit breakdown of the 5-minute vs 1-hour eviction boundaries, token minimums, and 2-turn break-even math, see our analysis of prompt caching cost savings. We recompute all twelve bills from their token counts with that script — if the arithmetic still lands inside a rounding error, the rates have not moved.
Frequently asked questions
What is the cheapest AI coding assistant?
Does choosing a cheaper model actually save money?
Why does the same prompt cost different amounts each time?
Is budget ai coding cheaper with a subscription or an API key?
Can you compare cost across vendors from the tools themselves?
Muhammad Kashif
Founder and editor of Devventa, covering AI coding assistants, Next.js and the modern AI development stack.




