InfyCalculator
💻

Prompt Caching Savings Calculator

Estimate how much prompt caching saves when a long shared prefix (system prompt, context, docs) is reused across many requests, at the provider’s cache discount.

Cached tokens per request
Requests per month
Input price per 1M tokens
Cache discount
Loading calculator…

How it works

Prefix cost = cached tokens × requests ÷ 1M × price · Savings = prefix cost × cache discount%

When many requests share a long, unchanging prefix — a big system prompt, few-shot examples or retrieved context — prompt caching lets the provider skip re-processing it and bills those tokens at a steep discount, often 75–90% off. The savings scale with both prefix length and request volume, so caching pays off most for high-traffic apps with heavy shared context and barely matters for one-off calls. Note this models only the cached prefix; the variable part of each prompt and the output tokens are billed at full price on top.

Worked example

A 5,000-token prefix reused across 100,000 requests is 500M prefix tokens/month. At $3 per million that is $1,500 without caching; a 90% cache discount saves $1,350, leaving $150 — about $16,200 saved per year.

Frequently asked questions

What can actually be cached?

The stable prefix of your prompt — system instructions, tool definitions, few-shot examples and retrieved documents that do not change between calls. The dynamic tail (the user’s latest message) is not cached and is billed normally.

Is there a cost to writing the cache?

Some providers charge a small premium to create or refresh a cache entry, then discount reads heavily. If your prefix is reused many times before it expires, the read savings dwarf the write cost — this calculator models the read savings, so treat it as a slight upper bound.

Why doesn’t caching help my app?

If each request has a different prefix, or you send few requests before the cache expires (often a few minutes), there is little to reuse. Caching rewards high volume over a shared, long-lived prefix.

Related calculators

Educational estimate — real costs and memory depend on your provider, framework, model architecture and pricing, which change often. Verify against your own bills and profiling before committing budget.