Skip to main content
← All posts

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.

Prices per million tokens, read live from the catalog
ModelInputOutputCache readContext
DeepSeek V4.1 Flash 1017$0.128$0.51$0.002551M
Qwen3.8-Max$1.697$5.089$0.2131M
MiniMax-M3$0.266$1.063$0.0541M
GLM-5.3-Flash$0.072$0.25$0.0211M
GLM-5.3$0.715$2.50$0.1791M

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.

Input cost of 1,000 requests, each with a 100,000-token prompt, with and without cache hits
ModelCache read price vs input priceNo cache hitsWith 90% cache hitsInput saving
DeepSeek V4.1 Flash 10172.0%$12.8$1.509588.2%
Qwen3.8-Max13%$169.7$36.1478.7%
MiniMax-M320%$26.6$7.5271.7%
GLM-5.3-Flash29%$7.2$2.6163.7%
GLM-5.325%$71.5$23.2667.5%
Input cost of 1,000 requests, each with a 100,000-token prompt, with and without cache hits

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.

Next steps