Prompt caching savings calculator
Enter a reusable prefix and the number of successful reuses after one cache write. Compare the full request costs with and without caching, including the suffix and output.
Results
- Savings per cache cycle
- $0.17
- Without caching
- $0.32
- With caching
- $0.15
- Savings percentage
- 51.88%
- Minimum reuses to break even
- 1 reuses (2 requests)
| Term | Value |
|---|---|
| Input / output per 1M tokens | $2 / $10 |
| Write / read multipliers | 1.25× / 0.05× |
| Minimum prefix | 512 tokens |
| TTL | 5 minutes |
| Requests in cycle | 10 |
- One initial write and the entered number of successful full-prefix reads. TTL is a planning condition; this tool does not predict cache hits or expiration.
- A negative saving means caching costs more. Equality counts as break-even, not a positive saving. A new write after expiry starts a new cycle.
- Suffix and output costs are included in both totals. Storage fees, tool charges, taxes and regional premiums are excluded; custom terms model write/read billing only.
Prices change often. We list the date we last checked each price; confirm on the provider’s official pricing page before you budget.
How it works
Use one cache cycle: an initial write followed by R successful reads of the same prefix before it expires. P is the prefix size, S the uncached suffix, O the billed output, A the input price and B the output price per million tokens. W and r are the total write and read multipliers. These billing categories follow the linked Anthropic and OpenAI caching guides.
N = R + 1 without cache = N × [(P + S) × A + O × B] ÷ 1,000,000 with cache = [P × A × (W + R × r) + N × (S × A + O × B)] ÷ 1,000,000 saving = without cache − with cache saving % = saving ÷ without cache × 100 minimum reuses = ceil((W − 1) ÷ (1 − r))
The break-even expression is derived by setting cached prefix cost no higher than ordinary prefix cost. It applies when the prefix is eligible, its ordinary cost is positive, W ≥ 1 and r < 1. Equality counts as break-even. A write multiplier of 1 needs zero reuses to tie; a read multiplier of 1 cannot recover a write premium. If the prefix is below the minimum, caching is not applied. Zero baseline cost has no defined savings percentage.
Astra presets model explicit-only caching. Set prompt_cache_options.mode: "explicit" and put prompt_cache_breakpoint: { "mode": "explicit" } on a supported content block immediately after the reusable prefix. Content after that breakpoint uses ordinary input pricing. The 12-hour retention option requires the Responses API. Implicit mode can write changing suffix content and is not modeled here; an unchanged prefix alone does not guarantee the assumed cache hits.
All terms are editable. Blank overrides use the preset; custom mode requires every term. Astra applies its long-prompt prices above 272,000 prefix-plus-suffix tokens, before any price override. TTL records the assumed retention policy; you supply successful reads, not elapsed request times. A changed prefix, missed cache or expired entry needs a separate cycle. This model excludes storage fees and assumes an unchanged suffix/output size across requests. No intermediate values are rounded. Money uses cents, except nonzero sub-cent amounts use three significant digits; percentages use up to two decimal places.
Worked examples
Nine reads after a short-lived write
Claude Sonnet 5.5: a 10,000-token prefix, 1,000-token suffix and 1,000 output tokens, with nine reuses, make ten requests. At $2 input and $10 output per million, no caching costs $0.32. A 5-minute write at 1.25× and reads at 0.05× cost $0.154 before display rounding. Savings are $0.166, or 51.875% (displayed as $0.17 and 51.88%). One reuse is enough to break even.
A one-hour write needs more reuse
Keep that same Sonnet workload but choose a one-hour write at 2×. One reuse means two requests: $0.064 without caching and $0.065 with caching, a $0.001 loss. Break-even requires ceil((2 − 1) ÷ (1 − 0.05)) = 2 reuses. With two reuses, the costs are $0.096 without and $0.078 with caching, saving $0.018.
Frequently asked questions
Does the reuse count include the initial request?
Is a 1.25× write multiplier an extra 125% fee?
How short can a cached prefix be?
Does choosing a TTL guarantee every reuse hits?
Why can savings be negative?
Can I model another provider?
Sources
- Anthropic — Prompt caching pricing, lifetime and minimum prefixes (checked 2026-11-14)
- Anthropic — Model pricing and long context pricing (checked 2026-11-14)
- OpenAI — Prompt caching prices, minimum prefix and lifetime (checked 2026-11-14)
- OpenAI — GPT-6 Astra text pricing and long-prompt tier (checked 2026-11-14)
Last reviewed 2026-11-14; next review due by 2026-12-14. The method is written out above so you can check our math.