AgentReceipt

Why did my Claude Code session cost so much? Usually: cache misses

On Claude, a cache write costs 1.25x the input price and a cache read 0.1x: a miss costs 12.5x a hit. Here is how to find the misses in your own session and what each one cost.

Claude Code sends the whole conversation (system prompt, tool definitions, CLAUDE.md, every file it read) with every model call. Prompt caching is what keeps that affordable: the unchanged prefix is read from cache at a tenth of the input price.

When the cache misses, the same prefix is written again at 1.25x the input price. That is 12.5 times what a hit costs for exactly the same tokens. On a 150k-token Opus context, one miss is about $0.94 (Opus 4.8 list price) instead of $0.08 for the hit.

Misses come from three places: an idle gap longer than the 5-minute cache lifetime, a change in anything before the conversation (tools, MCP servers, the system prompt, CLAUDE.md), and a model switch, since caches belong to one model.

AgentReceipt flags every step whose cache write is large compared with the context the previous step already had, says which of the three causes fits, and prices what a hit would have cost instead.

How to fix it

  • Keep sessions moving, or start fresh after a break instead of resuming a huge context.
  • Add MCP servers and edit CLAUDE.md between tasks, not during one.
  • Pick the model at the start of a task and stay on it.

See it in your own session

Drop the session file below. Every step this applies to is flagged on the receipt with what it cost and what fixing it would have saved.

Itemize your own session

Drop a Claude Code or Codex log. It is parsed in your browser, and you get your real numbers instead of a model.

Drop a session log here

Claude Code ~/.claude/projects/…/*.jsonl, a Codex rollout ~/.codex/sessions/…/rollout-*.jsonl, or the claude-code-action execution file.

Parsed in your browser. Your prompts and code never leave this tab.