Originally published on Loop & Retry — field notes on building LLM agents that survive production.
Search "claude pricing" and you'll land on a table: dollars per million input tokens, dollars per million output tokens, one row per model. That table is accurate and almost useless for predicting what you'll actually pay, because the invoice at the end of the month isn't tokens × rate — it's tokens × rate × three multipliers most people never measure. I've written about each multiplier separately on this blog. This post puts them on one page and runs the arithmetic together, because the interaction between them is where the real surprises live.
The three multipliers, in the order people usually discover them:
- Cache misses. Prompt caching can cut your input cost by 90% on the reused part of a request — or do nothing, silently, if your request structure breaks it.
- Quadratic context growth. A long-running agent's token bill grows with the square of its step count, not linearly, because every step re-sends the whole transcript so far.
- Prepaid parallel retries. Best-of-N sampling for latency multiplies your token spend by N unconditionally, whether or not you needed the extra attempts.
None of these show up as a line item. All three show up in the total.
The rate is not the bill
Anthropic and OpenAI both publish the same kind of table: a flat per-model, per-million-token rate, separately for input and output. That's the number people search for under "claude cost," "claude api pricing," or "how much does claude cost," and it's genuinely the wrong place to start optimizing, for a specific reason — it describes the price of one token, and your bill is a function of how many tokens you actually send, which is almost never what you'd naively estimate from (prompt length) × (number of calls).
I use illustrative Sonnet-class rates throughout this post — $3 per million input tokens, $15 per million output tokens, matching what I've used consistently in the cost-beyond-tokens breakdown — because the ratios here are the durable part, not the absolute numbers, and they'll survive the next price change. Swap in your own current rate card; the shape of the argument doesn't move.
Multiplier 1: the cache that silently misses
Prompt caching is the closest thing to a free lunch in this business: mark a stable prefix — system prompt, tool schemas, a big retrieved document — with a cache breakpoint, and repeat calls that share that exact prefix pay roughly a tenth the input price on it instead of full price. The catch is that "exact prefix" means byte-identical, and there's no error when it isn't. A stray timestamp ahead of the breakpoint, a tool list that serializes in a different order, a loop step that runs past the cache TTL — any of these silently puts you back to paying full price, and nothing in the response tells you unless you're logging cache_read_input_tokens and noticing it's zero.
This matters for a Claude bill specifically because Claude Code and most agent harnesses re-send a large, mostly-stable system prompt and tool schema block on every single turn. If that block is genuinely stable and actually hits the cache, it's cheap. If it silently misses — which is the common failure mode, not the rare one — you're paying close to full input price on a multi-thousand-token block, every single call, and the invoice gives you no way to tell that from a model that's just expensive.
Continue reading: the rest of this post — including the sections that follow — is on Loop & Retry: read the full article
Top comments (0)