LLM tokens and cost
Prompt caching savings calculator.
Compare the cost of requests with and without a cached prompt prefix. You enter the cache write and read multipliers from your provider.
Caching pays off once enough requests read the cached prefix. With an 8,000-token prefix, a 90% hit ratio, a 1.25x write multiplier and a 0.10x read multiplier (examples), 10,000 requests cost $76.40 instead of $202.00, a saving of $125.60 (62.2%). Break-even is a 21.7% hit ratio.
Your numbers
Result
Worked example
8,000 cacheable prefix tokens, 500 changing input tokens, 400 output tokens, 10,000 requests, example prices of $2.00 and $8.00 per 1M, a 1.25x write multiplier and a 0.10x read multiplier. Without caching one request costs (8,500 x 2 + 400 x 8) / 1,000,000 = $0.0202. At a 90% hit ratio the prefix costs 0.9 x 0.10 + 0.1 x 1.25 = 0.215x the base price, so one request costs $0.007640 and 10,000 requests cost $76.40, saving $125.60. Break-even: (1.25 - 1) / (1.25 - 0.10) = 21.7%. At only a 10% hit ratio the saving turns into a loss of $21.60 (10.7% more than no caching).
How it works
Providers that bill cached prompts price the prefix three ways: normal input, a cache write and a cache read. Anthropic's documentation lists the write and read prices as multiples of the base input price (for example 1.25x for a 5-minute write and 2x for a 1-hour write, with reads at 0.1x for most models and lower for some), and says the multipliers differ by model. OpenAI says cached input is discounted by up to 95% and that cache pricing varies by model. That is why both multipliers are inputs here and none are built in.
The page treats the hit ratio as the share of requests that read the cached prefix; every other request pays the write price for it. It assumes the cached prefix is identical on each request and ignores cache expiry timing, minimum cacheable lengths and any extra tokens the provider adds. Treat the result as a planning estimate and confirm with the usage fields your provider returns.
Sources and basis (opened 2026-10-08): Prompt caching - Claude Platform Docs; Prompt caching | OpenAI API. Everything else is arithmetic on your inputs.
All prices on this page are examples you can overwrite, not any provider's current prices. Check your provider's pricing page before you rely on a number. Results are planning estimates, not a quote or financial advice. Everything runs in your browser. Nothing you type is sent or stored.
FAQ
How much does prompt caching save?
It depends on the cacheable share of your prompt and your hit ratio. In this example a 90% hit ratio saves 62.2% of the total cost, and a 10% hit ratio costs 10.7% more than no caching.
What is the break-even cache hit ratio?
When writes cost more than normal input and reads cost less, break-even is (write - 1) / (write - read). With a 1.25x write and 0.10x read that is 21.7%. Above it, caching saves money.
What write and read multipliers should I enter?
Take them from your provider's current pricing page for your exact model. Anthropic publishes them as multiples of the base input price and notes that they vary by model; OpenAI says cached-input pricing varies by model.
Does the cached prefix have to be identical?
Providers match on a prefix, so the repeated content must come first and stay identical from request to request. Put the part that changes at the end of the prompt.