Model economics
Prompt caching cost: calculate the break-even point
Calculate cache writes, cache reads and uncached costs with a worked example, then check whether real reuse makes caching worthwhile.
By AI Choice Atlas editorial · Published
Original worked examples are hypothetical, not measured product results. Sources checked 2026-11-09.
First identify the part of the prompt that repeats
Prompt caching can change the price of reused input, but a repeated document is not automatically a billable cache hit. Separate a request into stable instructions or reference material, changing input and generated output. Then check what the selected provider and model actually allow you to cache.
This guide uses an invented rate card to make the arithmetic visible. It is not a quote for OpenAI, Anthropic or another provider. The original example assumes one cache write followed by complete reads of the same eligible prefix within its lifetime. Real workloads can have partial hits, additional writes or no reuse at all.
The practical question is not simply how large the cache discount looks. It is how many reads you receive for each write, at the rates and retention settings your application uses.
An 8,000-token prefix used three times
Assume an 8,000-token shared prefix, an uncached input price of $2 per million tokens, a cache-write price of $2.50 per million and a cache-read price of $0.20 per million. Assume there are no storage fees in this hypothetical rate card. Unique input and output are excluded from this first calculation because their amounts are identical in both scenarios.
Without caching, the prefix costs 8,000 × $2 ÷ 1,000,000 = $0.016 per request. Three requests cost $0.048. With caching, the first write costs $0.020. Each later read costs $0.0016. One write and two reads therefore cost $0.0232.
The difference is $0.0248 for these three uses of the prefix. That is a reduction in this input component, not a percentage reduction in the entire API bill. At one use, the write costs $0.020 against $0.016 uncached, so caching is more expensive under these assumptions. At two uses, write plus read is $0.0216 against $0.032 uncached.
Find the reuse threshold
Let N be the total number of requests sharing the prefix, I the ordinary input rate, W the write rate and R the read rate. With one write and N minus one successful reads, the two costs are prefix_tokens × N × I ÷ 1,000,000 and prefix_tokens × [W + (N − 1) × R] ÷ 1,000,000.
When I is greater than R, caching is cheaper if N is greater than (W − R) ÷ (I − R). For the invented prices above, the threshold is 2.30 ÷ 1.80, about 1.28. The smallest whole number of uses that saves money is therefore two. Equality would mean equal costs, not a saving.
This shortcut depends on its assumptions. It cannot account for repeated expiry, mixed cache lifetimes, partial reads or a change in prompt size. If the read rate is not below the ordinary rate, do not apply the inequality mechanically. Compare the full cost expressions instead.
A miss can change the answer
Consider the same three requests, but suppose each needs a new write because the eligible prefix is unavailable or changed. Three writes now cost $0.060 rather than the $0.0232 estimated for one write and two reads. The uncached comparison is still $0.048. A budget based on perfect reuse has reversed the result.
Treat this as a scenario, not a prediction of any provider's exact miss billing. Inspect usage records to identify how misses, writes, reads and ordinary input are reported for your API. Do not count the same tokens twice if a total-input field already includes cache categories.
OpenAI's current documentation explains matching rendered prefixes and eligible lookup boundaries. Keeping the same words at the front may be insufficient if the required boundary is missing. Check the documentation for the model and request configuration you actually send rather than copying a setup from another model.
Technical references: OpenAI prompt caching guide
Put the rest of the bill back in
Add changing input and output after calculating the repeated component. Suppose each of the three requests also has 1,000 uncached input tokens at $2 per million and 500 output tokens at a hypothetical $10 per million. That adds $0.007 per request, or $0.021 overall. The full examples become $0.069 uncached and $0.0442 with the assumed cache hits.
The dollar difference remains $0.0248, but its share of the full bill is smaller than its share of the repeated-prefix cost. Include other applicable fees separately. Anthropic's published pricing distinguishes ordinary input, cache writes and reads, demonstrating why one generic discount cannot stand in for a complete rate card.
Technical references: Anthropic pricing documentation
Check these inputs before forecasting savings
Measure a small representative workload before relying on the estimate. Inspect usage rather than inferring hits from the fact that your application sent similar prompts. Keep the uncached baseline as a comparison, and test the behavior of the resulting answers as well as the charges.
- Exact model and endpoint, with current ordinary, write and read rates.
- Reusable prefix length and any minimum cacheable length.
- Eligible cache boundaries and settings for the chosen API.
- Lifetime, request spacing and expected reads per write.
- Observed ordinary-input, write and read token categories.
- Unique input, output and any additional fees outside the prefix.
Use the calculator as a baseline
Atlas's cost calculator uses base uncached text rates from a dated catalog. It does not simulate cache writes, reads or expiry. Use it to establish the baseline, then calculate the cache scenario separately with current source prices and measured reuse. A transparent range from no reuse to observed reuse is more useful than a single optimistic discount.
Sources and scope
Provider rules and supported features can change. These sources support the technical background; the worked examples and decision checklists are authored for this article.
- OpenAI prompt caching guide
Supports rendered-prefix matching, eligible lookup boundaries, model-specific minimums and usage-category checks. No model-specific threshold or price is asserted here.
- Anthropic pricing documentation
Supports distinct ordinary input, cache-write and cache-read price categories. The 8,000-token scenario and all example rates are synthetic, not provider quotes.