MediumWhy Coding Agents Burn Money: What a 50-Turn Session Could Cost | by Gifa Eriyanto | Nov, 2026 | Medium
Sitemap
Gifa Eriyanto

Gifa Eriyanto

Full‑stack dev exploring how AI, LLMs, and automation change the way we design, build, and ship products.

Why Coding Agents Burn Money: What a 50-Turn Session Could Cost

7 min read21 hours ago

--

Coding agent cost often hides in failures and retries. The TokenEconomizer paper (Microsoft Research and UC Berkeley, arXiv 2610.22732, https://arxiv.org/abs/2610.22732) profiles 60 SWE-Bench tasks, which are real GitHub issue fixes, 10 from each of six repositories. Within that sample, the paper reports: "The 10 failed executions constitute 17% of the tasks but 32% of total spend (Fig. 3(c))." This is a retrospective profile of one sample, not a general statistic. Still, the pattern is worth noticing, because failed runs are easy to overlook while the answers scroll by.

Press enter or click to view image in full size
Illustration for this article.

TL;DR: Coding agent cost is driven mostly by rereading accumulated context on every turn, through cache reads (reusing stored context) and cache writes (storing it), not by the output the agent writes. One paper measures these shares directly. In PointFive's analysis of 2,848 Claude Code runs, cache writes made up 48.5% of cost, cache reads 38.7% and output 11.4%. Another paper finds that input tokens dominate. A 50-turn model below shows a similar pattern. It is illustrative, not measured.

Where does a coding agent's money go?

A coding agent resends its history on every turn. That history is usually cached, meaning the provider stores it so later requests can reuse it at a lower price. A request served from the cache is a "cache hit." A request the cache cannot serve is a "cache miss," and it is billed at full input. Rereads are cheap per token, but they add up fast. The pricing pages show the structure.

Press enter or click to view image in full size
Claude API pricing in US dollars per million tokens, as shown on the Anthropic pricing page on November 14, 2026. Source: https://platform.claude.com/docs/en/about-claude/pricing (accessed November 14, 2026).

For Opus 5.5, the pricing page lists base input at $4 per million tokens and output at $20. A cache read costs $0.20, which is 5% of base input. Writing to a 5-minute cache costs $5, or 1.25x input. A 1-hour cache write costs $8, or 2x. Caching is cheap to read and slightly more expensive to write, so it pays off only when the same context is read many times.

Press enter or click to view image in full size
Prompt caching multipliers on the Anthropic pricing page, accessed November 14, 2026. Source: https://platform.claude.com/docs/en/about-claude/pricing.

DeepSeek is priced far lower. Its Flash model lists a peak-hour cache-hit price of $0.006 per million tokens, a cache miss at $0.30 and output at $1.20. Off-peak prices are half those rates. V4 Pro costs more: $0.044 for a cache hit, $1.32 for a cache miss and $3.96 for output at peak.

Press enter or click to view image in full size
DeepSeek API pricing, accessed November 14, 2026. Source: https://api-docs.deepseek.com/quick_start/pricing. DeepSeek reserves the right to change its prices.

Does lower output mean a lower bill?

The clearest breakdown comes from Weinberger and Hozez at PointFive, "Token Reduction Is Not Cost Reduction" (arXiv 2607.12161, https://arxiv.org/abs/2607.12161). The paper analyzed 2,848 Claude Code runs and split the bill this way: uncached input 1.4%, cache writes 48.5%, cache reads 38.7% and output 11.4%. Output is a small share. Most of the money goes to writing and rereading context.

The same paper shows why cutting tokens is not the same as cutting cost. The most aggressive compression of tool output cut tool-output tokens by 38.4%, yet raised the bill by 6.8%. Across runs, the correlation between token reduction and cost reduction was only r = 0.15. The study covers a single harness and a single provider, mostly on single-prompt tasks, and the authors say so.

How much do repeated runs vary?

Variance is the other problem. "How Do AI Agents Spend Your Money?" (arXiv 2604.22750, https://arxiv.org/abs/2604.22750) studied OpenHands on SWE-bench Verified across eight models. Its abstract puts agentic tasks at roughly 1,000 times the tokens of code reasoning or chat. The body reports larger multiples, 3,500 and 1,200, so the exact figure depends on the comparison. According to the paper, repeated runs of the same task can differ by up to 30 times in total tokens. It also finds that input tokens, not output, dominate cost even when caching is enabled. The models it studied are older, and the authors note their limits.

Does the 31% saving hold up?

The headline "31% cheaper" comes from TokenEconomizer (arXiv 2610.22732). Its exact terms matter.

Across 277 SWE-Bench tasks, the plugin cut average cost per task by between 18.4% and 30.9%, counting the plugin's own call costs. Across all 579 tasks in the paper, which include Web-Bench and security tasks, the reported ranges are wider. Pass@1 (the share of tasks solved on the first attempt) rose in four of five agent-model combinations. The 30.9% figure is the top of the SWE-Bench range, and it applies to one combination only: Claude Code with Opus 4.8. The paper did not test Opus 5.5 or Sonnet 5.5, so "up to 30.9%" is not a promise about current Claude models.

The analysis suggests trusting the direction, not the number. The PointFive study's tool-output finding shows that a token cut does not guarantee a bill cut. Before relying on any percentage, run the same tasks on your own bill.

What could a 50-turn session cost?

Even with a cache, a hypothetical 50-turn session reads about 5.5 million tokens from cache, writes about 200,000 and produces about 20,000 output tokens. The model below shows the structure of cost in that case. It is not a measurement of any real session. Prices were accessed November 14, 2026.

Get Gifa Eriyanto’s stories in your inbox

Join Medium for free to get updates from this writer.

The model rests on these assumptions:

  • Starting context of 25,000 tokens: system prompt, tool schemas and repository notes.
  • Each turn adds 3,500 tokens of tool results and replies.
  • Each turn produces 400 output tokens.
  • 50 turns in total, with no failures, no subagents and no context above 200K tokens.
  • Every turn reads the full history from cache. The model assumes the cache never expires and never misses. Real cache behavior is not confirmed here. The cache's time-to-live (TTL, how long an entry stays valid before it expires) and any invalidation would both affect the result, and misses would raise the cost.

Illustrative model, not measured data. Prices accessed November 14, 2026.

  • Fable 5.2: $3.90 with cache, $46.50 without cache. Share of cached cost: 28% reads / 51% writes / 20% output.
  • Opus 5.5: $2.50 with cache, $23.25 without cache. Share of cached cost: 44% reads / 40% writes / 16% output.
  • Sonnet 5.5: $1.25 with cache, $11.63 without cache. Share of cached cost: 44% reads / 40% writes / 16% output.

Under the same assumptions, DeepSeek Flash costs about $0.12 at peak and $0.06 off-peak. V4 Pro costs about $0.59 at peak and $0.29 off-peak. These figures show shape, not what a real session will cost.

In this illustrative model, the same session without the cache costs about 9 to 12 times more on the Claude models. Output is also a small share of the total. A shorter session shifts the mix: in a lighter 30-turn scenario, output reaches roughly a third of the total. In this model, session length matters more than reply length.

What actually lowers the bill?

The levers below come from the pricing pages and the research. The papers have not measured how much each one saves in a real session.

  1. Use the cheaper model for light steps. The Sonnet 5.5 price is half the Opus 5.5 price in every column of the table: input $2 against $4, output $10 against $20, cache read $0.10 against $0.20.
  2. Use batch processing for work that can wait. Batch (discounted, asynchronous processing) for Opus 5.5 is $2 input and $10 output, half the standard rate.
  3. Skip fast mode unless you need it. Fast mode doubles the Opus 5.5 price to $8 input and $40 output.
  4. Keep sessions short, or start fresh on purpose. Every extra turn adds to the context that gets reread. A new session discards that history, which can help the bill more than trimming replies.
  5. Test cheaper models on your own tasks. DeepSeek Flash's peak cache-miss price of $0.30 per million tokens is far below Claude's. The price alone does not show equal quality, so test before switching.

No measured saving exists for any of these levers. Treat them as direction for your own bill.

Is there a fair way to measure coding agent cost?

No public standard yet measures the number that matters most: cost per finished task, not cost per token. Until one exists, the most useful habit is to compare your own bill, per completed task, before and after each change.

This article was researched and drafted with AI assistance, then reviewed and edited by a human before publishing.

Sources (accessed November 14, 2026)

Prices were accessed on November 14, 2026. DeepSeek reserves the right to change its prices.

--

--

Full‑stack dev exploring how AI, LLMs, and automation change the way we design, build, and ship products.