Prompt caching is usually described as a discount. That is incomplete.

A cache hit can make repeated input much cheaper, but a cache miss may create a higher-priced cache write. Whether caching saves money therefore depends on the relationship between three prices and one operational metric: the real cache hit rate.

The prompt caching cost formula

Start with only the stable input prefix that is eligible to be reused. Do not include changing user content or output tokens.

  • Uncached baseline = requests × reusable input tokens × uncached input price

  • Cache-read spend = hit requests × reusable input tokens × cache-read price

  • Cache-write spend = miss requests × reusable input tokens × cache-write price

  • Monthly savings = uncached baseline − cache-read spend − cache-write spend

Use prices per million tokens consistently. The calculator performs the unit conversion and also solves for the hit rate where cached and uncached cost are equal.

A worked example

Suppose a workload makes 100,000 requests per month and repeats an 8,000-token eligible prefix. For an illustrative scenario, enter $3.00 per million uncached input tokens, $0.30 for cache reads, $3.75 for cache writes, and an 80% hit rate.

  • Reusable input volume: 800 million tokens

  • Uncached baseline: $2,400

  • Cache-read spend: $192

  • Cache-write spend: $600

  • Cached total: $792

  • Monthly savings: $1,608, or 67%

In that scenario, the break-even hit rate is 21.7%. At a 0% hit rate, caching costs $600 more than the uncached baseline. That reversal is why cache-write pricing belongs in the model.

These are example inputs, not a provider quote. Replace every price with the current rate for the provider, model, cache lifetime, and billing mode you are evaluating.

How to get defensible inputs

  1. Separate the stable prefix. Measure system instructions, tool definitions, schemas, examples, or retrieved context that remain identical across requests.

  2. Verify eligibility. Check current minimum-token, prefix, lifetime, storage, and invalidation rules in provider documentation.

  3. Measure hits in production. Use billing or trace data. A theoretical reuse rate is not the same as a billed cache hit.

  4. Model expiry and churn. Short lifetimes and frequently changing prompts convert expected reads into new writes.

What this calculation does not include

The instrument isolates reusable-input economics. It does not include output-token spend, retries, tools, retrieval, taxes, committed-use discounts, batch pricing, or provider-specific storage charges unless they are already represented in your input prices.

For the full workload budget, use the LLM API Cost Calculator. For the full evaluation sequence, open the AI Evidence Lab.

Run the break-even test

ResearchAudio publishes evidence-led AI briefings for engineers and builders. Get free access →

Keep Reading