Skip to content
Inference Academy

Prompt-cache savings calculator

Find out whether caching your shared prompt prefix saves money at your traffic, and how much latency it removes.

Free, no sign-up, runs in your browser. Part of Inference Academy, a hands-on course on making LLM inference fast.

Expected cache hit rate

81%

Break-even at about 22% with these prices

Saving

52%

of the per-request cost

Per request

$0.0154

instead of $0.0318

Per month

$222

instead of $458

Time to first token saved, on average

2.16 s

Prefix tokens that do not need prefilling again, weighted by the hit rate.

Model: requests arrive at random, and each use refreshes the cache lifetime, so the hit rate is 1 − e^(−requests per minute × lifetime). Misses pay the cache-write price for the prefix; hits pay the cache-read price. Real hit rates are lower if the prefix is not byte-for-byte identical (a timestamp or user name near the top breaks it) or if traffic spreads across many servers. Check your provider's minimum cacheable length and pricing.

Next step

The maths behind this result

How do engines reuse a cached prompt?

This calculator uses the arithmetic the Inference Engineering course teaches step by step, with diagrams you can step through. The lesson is free to read.

Stay in the loop

New models, what hardware they need, and new lessons

An occasional email when a big open model ships or a new lesson goes up. No spam; unsubscribe in one click.

Share this tool

Frequently asked questions

How does prompt caching save money?

When many requests start with the same prefix, such as a long system prompt, tool definitions or a document, the provider can reuse the work done on that prefix. Cached input tokens are billed at a much lower read price. The first request that writes the cache may cost more than normal input.

What decides the cache hit rate?

How often requests with the same prefix arrive compared with how long the cache stays warm. If requests come more often than the cache lifetime, most of them hit. With a few requests an hour and a five-minute lifetime, many will miss. The calculator models arrivals as random and computes the expected hit rate.

When is prompt caching not worth it?

When the shared prefix is short, when traffic is too sparse to keep the cache warm, or when the cache write price is high compared with the read discount. The calculator shows the break-even hit rate for your prices.

Does caching make responses faster?

Yes. The model skips processing the cached prefix, so time to first token drops, often by most of the prefill time for long prompts. Enter your prefill speed to see the saving.

How do I get good cache hits?

Put the stable content first and the changing content last: system prompt, tools and fixed documents at the start, the user's message at the end. Any change early in the prompt invalidates everything after it.