What actually drives my LLM API bill?
An invoice says tokens in and tokens out. It does not say that most of the tokens in were tokens the provider had already read, sent again because a conversation re-sends its whole history every turn. Pick a model and a workload that looks like yours, and watch which line of the bill actually moves when you change something.
History re-reads are the biggest line: 94% of every prompt token you are billed for is something the provider has already seen. At 90% hits the cache takes this conversation from $1.72 to 54.1c.
| Model, same workload | No cache | Your settings | Cache |
|---|---|---|---|
| Claude Fable 5.1 Anthropic | $77K | $20K | explicit |
| Claude Opus 5 Anthropic | $39K | $12K | explicit |
| Claude Sonnet 5 Anthropic | $15K | $4.9K | explicit |
| GPT-6 Astra OpenAI | $77K | $24K | explicit |
| GPT-5.6 Terra OpenAI | $16K | $5.1K | explicit |
| GPT-5.6 Luna OpenAI | $1.6K | $505 | explicit |
| Gemini 3.8 Flash Google | $5.8K | $1.6K | automatic |
| GLM-5.3 Z.ai | $11K | $3.5K | automatic |
| GLM-5.3 Flash Z.ai | $681 | $237 | automatic |
| DeepSeek V4.1 Flash DeepSeek | $1.1K | $237 | automatic |
| DeepSeek V4 Pro DeepSeek | $4.4K | $902 | automatic |
Output is expensive per token; history is expensive because you pay for it every turn. A token out costs four to six times a token in on most models, which is why the first instinct is to shorten answers. But a twenty-five turn agent session sends its first tool result twenty-four more times, and by the last turn the request is almost entirely things the model has seen. In the coding-agent shape above, 94% of every prompt token billed is a re-read. That is the biggest line on the invoice, it grows with the square of the conversation length, and it is invisible in a per-token price list.
Prompt caching is the lever, and it is a prefix contract. Every major provider will serve a prompt token it has already processed at around a tenth of the price, some automatically, some only where you mark the breakpoints, and the explicit ones charge a quarter more to write what they will later read. The condition is that the request begins with the exact bytes of an earlier one. A timestamp in the system prompt, a session id, a tool list in a different order, a retry that rebuilds the conversation another way: any of them moves the prefix and drops you silently onto the uncached line. The cache also expires, five minutes on most defaults, so a user who thinks for ten minutes pays full price for their history. Stable content first, volatile content last, and the cached-token count on a dashboard from day one, because nothing else tells you when this breaks. On a measured agent loop, cache misses cost 5.6 times more per turn.
The batch tier is half price for work that can wait. Anthropic, OpenAI, Google and Z.ai all list an asynchronous tier at 50%, with results within a day; DeepSeek does not. Classification, extraction, nightly summaries, evaluation runs: anything not attached to a person waiting is candidate. It stacks with caching. Most teams who have never used it have a quarter of their spend that would qualify.
What to watch, if you watch four things. The cached share of prompt tokens, because a drop is a broken prefix. Cost per task rather than per token, because a cheaper model that takes three tries is not cheaper. The ratio of input to output tokens, because it tells you which price matters for you. And retries, because a timeout that is retried is billed twice and appears in no latency chart.
What this model leaves out
Reasoning tokens. On a thinking model the tokens spent thinking are billed as output and are often several times the visible answer. The output slider here is the visible answer only; if your model reasons, multiply that line.
Long-context surcharges and tiered pricing. Several vendors charge more per token above a threshold, typically 200K of context. The simulation prices every token at the base rate.
Cache lifetimes, minimum prefix lengths and the difference between automatic and explicit caching in practice. A 90% hit rate is a good implementation; the default for an unmanaged one is nearer the 53% to 100% measured across serving routes on the next page.
Router fees and the difference between list price and what a router’s upstream actually charges, which is the subject of the next page.