Practical guide

How to Estimate Prompt Caching Savings from Cache Hits

Estimate prompt caching savings from reusable prefix tokens and hit rate, including cache-write premiums, break-even hit rate, and storage.

By StackCalcs · Updated · Sources checked

Count only eligible prefix tokens on hits

Prompt caching savings come from repeated input prefixes billed at a cached-input rate. The Prompt Cache Savings Calculator compares the standard input cost of a reused prefix with its cost under caching: hits at the cached-input rate and misses at the vendor’s cache-write rate. It shows the break-even hit rate for the selected model and every other listed model.

Suppose an assistant has a stable 8,000-token policy and tool-definition prefix and receives 5,000 requests a day, of which 4,000 report a cache hit. Enter 8000 prefix tokens, 5,000 requests per day, and an 80% hit rate. The result shows cache-read and cache-write charges and the net difference from billing every prefix at the standard input rate.

Do not enter total prompt tokens if the final messages change on every request. Variable conversation history and user text belong outside the cached prefix. Do not assume a 100% hit rate either; use the provider’s usage data to measure confirmed hits.

Convert a sample into a monthly case

If a seven-day representative sample shows 21,000 hits out of 28,000 requests, model a 75% hit rate at 4,000 requests per day, provided traffic and prompt versions remain stable. Check the hit-rate sensitivity table for a lower case too: deployments, prefix edits, or low traffic can reduce reuse.

The tool excludes minimum cacheable lengths, eligibility rules, eviction, taxes, and discounts. Its result is modeled savings at the entered hit rate, not a promise that a prefix will be cached.

FAQ

What is a cache-hit use?

It is a request where the provider reports that the reusable prefix was served at the cached-input rate. A repeated request is not automatically a hit.

Does the calculator include cache-write cost?

Yes. Misses are billed at the selected vendor’s listed cache-write rate (for example Anthropic’s 1.25× 5-minute or 2× 1-hour write), and Gemini explicit-cache storage is added for the hours you enter.

Official sources

Related calculators

Continue reading