Prompt caching savings calculator
Updated
In short: Prompt caching bills a repeated prompt prefix at the cheaper cached-input price. Monthly saving ≈ prefix tokens × hit rate × (input price − cached price), minus any cache-write fee. On DeepSeek V4.1 Flash cached input is 97% cheaper, so a prompt with an 80% stable prefix and 70% hits cuts the input bill by about 54%.
Estimates, before tax. Model prices are BroadNet Inference's published per-1M-token prices, synced 2026-11-14. The hit rate is applied to the whole cacheable prefix; real caches also hit partially, so measure cached_tokens on live traffic.
Report a wrong price or number (email to info@broadnet.ai, with this page's link and your inputs filled in).
How it works
- Enter requests per month, prompt (input) tokens per request and output tokens per request.
- Set the cacheable prefix share (the part of the prompt that is the same every time) and your expected hit rate.
- Pick a model, or choose "Custom prices" and type input, cached input and output prices per 1M tokens. If your provider charges to write the cache, set the write multiplier.
- Read the monthly cost with and without caching, the saving and the break-even hit rate. Copy the link or download CSV.
The formula
prefix = prompt tokens × prefix share
without caching = prompt × input_price + output × output_price
with caching = (prompt − prefix) × input_price
+ prefix × ( hit × cached_price + (1 − hit) × input_price × write_multiplier )
+ output × output_price
break-even hit = (w − 1) × input_price / (w × input_price − cached_price)All prices are per one million tokens; divide token counts by 1,000,000. Only the prefix can be cached, and only on a hit. The rest of the prompt and every output token are billed at the normal price, so caching never reduces the output part of the bill.
Cached-input prices on BroadNet Inference
| Model | Input / 1M | Cached input / 1M | Discount |
|---|---|---|---|
| DeepSeek V4.1 Flash | $0.175 | $0.0055 | 97% |
| GLM 5.3 | $0.78 | $0.173 | 78% |
| Qwen3.8 27B | $0.175 | $0.0435 | 75% |
Prices synced 2026-11-14. A model without a cached price bills repeated input at the full input price.
Worked example
An agent sends 100,000 requests a month with 10,000-token prompts, 80% of which is a stable prefix (system prompt, tools and shared context), and writes 400 output tokens. On DeepSeek V4.1 Flash without caching that is $195.80 a month. With a 70% hit rate it is $100.88, a 48% saving.
How to raise your hit rate
- Put everything that never changes first: system prompt, tool definitions, examples, long reference documents.
- Move anything that changes per request (dates, user names, request IDs) to the end of the prompt.
- Keep tool lists and JSON keys in a fixed order; one reordered item breaks the match after it.
- Append to the conversation instead of rewriting or summarising earlier turns on every call.
- Send related requests close together; caches expire after a period of no use.
- Measure: log
usage.prompt_tokens_details.cached_tokensand compare it withprompt_tokens.
More detail in cached input tokens explained.
Questions
How much does prompt caching save?
It depends on three numbers: how much of each prompt is a stable prefix, how often that prefix is a cache hit, and the cached-input discount. On DeepSeek V4.1 Flash, cached input is 97% cheaper than normal input, so an agent that resends a long, stable context can cut its input bill by more than half. Output tokens are never discounted.
What is a cache hit rate?
The share of requests whose prefix is found in the provider's cache. A hit needs the start of the prompt to match a recent request exactly, token for token. Read it from the API: usage.prompt_tokens_details.cached_tokens divided by prompt tokens.
Does writing to the prompt cache cost extra?
With some providers, yes: they charge a premium on the request that writes the prefix into the cache, so a low hit rate can cost more than no caching. Set the cache-write multiplier to model that (for example 1.25 for a 25% premium). Leave it at 1 for providers that list no write fee, such as BroadNet Inference.
What is the break-even cache hit rate?
The hit rate at which caching stops costing more than it saves. With no write premium, any hit saves money, so break-even is 0%. With a write multiplier w, break-even = (w − 1) × input price ÷ (w × input price − cached price).
Why is my cache hit rate low?
Usually something near the start of the prompt changes each request: a timestamp, a request ID, a reordered tool list or user-specific text above the shared instructions. Put stable content first and variable content last. How to structure prompts for caching.
Do I need to turn caching on?
It depends on the provider. OpenAI caches by default on supported models; Anthropic is opt-in with a cache_control field and charges 1.25× input to write a 5-minute cache and 2× for 1 hour. Check your provider's docs, then confirm hits in usage.prompt_tokens_details.cached_tokens. Provider differences.