Prompt caching explained: how cache-hit pricing cuts your LLM bill
Published · Updated
Agents and chat apps send the same long prefix again and again: the system prompt, the tool definitions, reference documents, the conversation so far. When a provider recognises that prefix it reuses the earlier work and bills those tokens at a lower **cache read** rate instead of the normal input rate.
Where to see the cache price
Every model in our catalog lists its cache read price next to its input price. The ratio between the two decides how much caching is worth, and it differs a lot between model families.
| Model | Input | Output | Cache read | Context |
|---|---|---|---|---|
| DeepSeek V4.1 Flash 1017 | $0.128 | $0.51 | $0.00255 | 1M |
| Qwen3.8-Max | $1.697 | $5.089 | $0.213 | 1M |
| MiniMax-M3 | $0.266 | $1.063 | $0.054 | 1M |
| GLM-5.3-Flash | $0.072 | $0.25 | $0.021 | 1M |
| GLM-5.3 | $0.715 | $2.50 | $0.179 | 1M |
What a cache hit saves
This table is calculated live from the same prices. It shows the input cost of 1,000 requests that each carry a 100,000-token prompt, once with no cache hits and once with 90% of the prompt served from cache. Output tokens are not included, because caching only changes the input side.
| Model | Cache read price vs input price | No cache hits | With 90% cache hits | Input saving |
|---|---|---|---|---|
| DeepSeek V4.1 Flash 1017 | 2.0% | $12.8 | $1.5095 | 88.2% |
| Qwen3.8-Max | 13% | $169.7 | $36.14 | 78.7% |
| MiniMax-M3 | 20% | $26.6 | $7.52 | 71.7% |
| GLM-5.3-Flash | 29% | $7.2 | $2.61 | 63.7% |
| GLM-5.3 | 25% | $71.5 | $23.26 | 67.5% |
The first column is the one to compare. A model whose cache read price is a few percent of its input price rewards a stable prefix far more than one priced at a quarter of it, so look at that ratio, not only at the headline input price.
How to get more cache hits
- Put what never changes first: the system prompt, tool definitions and reference material come before anything that varies.
- Put what changes last: the latest user message, timestamps and request IDs go at the end. A timestamp near the top of the prompt changes the whole prefix on every call.
- Keep the prefix identical between calls: the same text, in the same order, with the same tools. Providers generally match on an identical prefix, so even reordering the tool list can break a hit.
- Send follow-up requests soon after the first. Caches expire, and how long they last depends on the provider.
- Stay on one model for a conversation. A cache belongs to a single model.
How to check that it is working
Read the usage in the response. In the OpenAI format the cached part is usage.prompt_tokens_details.cached_tokens; in the Anthropic format it is usage.cache_read_input_tokens. Some providers add their own fields, which are passed through as they are (for example DeepSeek's prompt_cache_hit_tokens). If the number stays at zero on a long prompt that you repeat, the prefix is changing between calls.
resp = client.chat.completions.create(model="deepseek-v4.1-flash-1017", messages=messages)
usage = resp.usage
details = usage.prompt_tokens_details
cached = details.cached_tokens if details else 0
print(f"{cached} of {usage.prompt_tokens} prompt tokens came from cache")What to keep in mind
- Cached tokens are billed at the cache read rate in place of the input rate, not on top of it.
- Not every model reports cache hits, and a few price cache writes separately. The model page shows the full price breakdown.
- Prices and time-window discounts change. The tables on this page read the live catalog.