DEV Community

Developer at Fortitude Omnis Group
Developer at Fortitude Omnis Group

Posted on Originally published at omnisvigil.fortitude-omnis.group

Your AI coding bill isn't paying for code

So, I went through 33 days of my own Claude Code logs looking for something expensive, and found it in the gaps. Not in the work. In the gaps BETWEEN the work.

207 times I left a session for more than an hour and came back to it. Each time, the next turn rewrote about 470,000 tokens of context into the cache, because the cache had expired while I was away. Those 207 turns cost $972 at API rates. Read warm, the same context would've cost $48. That's 22% of everything my main sessions spent.

The code is the cheap bit

Priced at API rates the month came to about $4,560. The tokens the models actually wrote were 8% of that. Cache reads were 62%, cache writes 29%.

An agent conversation is stateless. Every turn sends the whole thing back, instructions, files, tool output, the lot, and my main sessions averaged about 455,000 tokens of prompt a turn. Caching makes each reread cheap. Thousands of cheap rereads is how you get to 62%.

The hour

A cached prompt lives five minutes by default, or an hour if you pay twice the input price to write it. Come back after that and the whole conversation is written again. On Opus 5.5 that's about $3.65 per return from lunch, against 9 cents warm. Claude Code's new idle compaction (announced 14 October) summarises a session just before the cache expires, which fixes most of this if you're happy to continue from a summary.

Fan-out and cliffs

On 15 October someone filed a Claude Code bug after asking for one audit of one Excel file and getting 137 agents, 16 million tokens and half a weekly allowance in 62 minutes. Meanwhile cheap models have cliffs: Haiku 5.5 is $0.10/$0.50 per million up to a 100K-token prompt and five times that beyond, cached tokens included. 54% of my subagent requests were over the line.

What helps

  • Measure per session, repo and person, not per month.
  • Set a budget and a kill switch per task, before it starts.
  • Keep the start of the prompt stable and the sessions short.
  • Compact or end a session before you leave it for more than the cache lasts.
  • Route small, read-light work down, and check the long-prompt price first.

Disclosure: I build OmnisRouter and OmnisVigil, which do the measuring and capping. But the numbers above came from a hundred lines of Python against my own logs, so you don't need them to find your 22%.

Full version, with sources: https://omnisvigil.fortitude-omnis.group/articles/ai-coding-bill/

Top comments (0)