Prompt caching calculator
What prompt caching saves on a workload — with and without the cache, the break-even hit rate, and each provider's minimum cacheable prompt.
What it does
Most workloads send the same beginning on every call — a system prompt, tool definitions, a document — followed by something that changes. Providers can cache that prefix, and bill a call that finds it cached at a lower rate.
Enter the prefix, the part that changes, the output, how many calls you make and what share of them find the prefix cached. The calculator prices the calls with and without caching, and tells you the hit rate above which caching starts to save money.
Everything runs in your browser. Nothing you enter is sent anywhere.
How it computes
Three kinds of call, each priced by the function Salyro prices usage with (calculateCost), from the model's own price list:
- Without caching — the whole input at the ordinary input rate.
- A cache hit — the prefix at the cached-input rate, the rest at the ordinary rate.
- A cache miss — the whole input, with the prefix billed as a cache write at the price list's cache-write rate. Where a provider's own page says writes are billed — Anthropic's does — misses are always billed this way. Only where nobody has read how a provider bills writes can you choose As ordinary input instead.
The hit rate turns into a number of calls, rounded to the nearest whole call. The first call is always a miss: the cache is empty until a call writes it. The break-even rate is where the savings on hits pay for the extra cost of misses:
break-even = (miss − uncached) ÷ (miss − hit)
It is rounded up to a tenth of a percent: above the rate shown, caching costs less. With only a few calls, the hit rate rounds to whole calls, so a result near the break-even can land on either side of it. When even every call after the first hitting the cache would not pay back the write premium, the calculator says the break-even cannot be reached for that number of calls.
What it does not know
- No fallback to the input rate. A model whose price list states no cached-input rate — or no cache-write rate, when misses are billed as writes — is not priced. The calculator will not invent a rate the provider did not state.
- Minimum prompt lengths and cache lifetimes are the providers' own, read from their documentation. Where a page could not be read they are unknown. A prefix shorter than the minimum is not cached at all, and the provider returns no error — so the calculator prices every call as uncached.
- It does not model how your traffic arrives. The hit rate is yours to estimate: calls that share a prefix must arrive before the cache entry expires.
- It does not model longer cache lifetimes that some providers sell at a higher write price.
FAQ
Why does caching cost more at a low hit rate?
On providers that bill a cache write above the ordinary input rate, every miss costs more than a call without caching. Caching pays once enough calls are hits. The break-even line gives that point.
Why is a model "not priced" here?
Its price list states no cached-input rate, or no cache-write rate while misses are billed as writes. Anthropic's page says writes cost more than ordinary input, and Salyro's price list has no cache-write rate for its models yet, so a workload with misses on an Anthropic model is not priced here rather than priced at the input rate.
Does Salyro cache prompts?
Caching is done by the provider, on the requests you send it. This calculator describes the provider's billing.
Sources
Prices come from Salyro's catalogue, with the revision and each provider's pricing page named under the result. Minimum cacheable lengths and cache lifetimes name the provider page they were read from, and the date.
Where the numbers come from
- Model and pricing data is a snapshot of the catalogue Salyro itself uses, taken when this site was built.
- Facts about models and providers that are not in that catalogue carry their own source and the date they were checked, and are shown as unknown where no reliable source exists.
