When Does LLM Prompt Caching Pay Off?
Calculate prompt caching break-even from write and read prices, then compare TTLs, missed reuse, usage fields, and actual billing for the same workload.

Prompt caching pays off when discounted reads save more than creating or rewriting the cache costs. Count the repeated tokens that actually receive cache-read pricing, subtract the write premium, and compare the result with sending the same input without caching.
For the direct-provider rates below, one full read repays a short-lived cache write. Longer-lived writes need two full reads. That is a calculation for these models and prices, not a promise that your next request will hit the cache or that a gateway will bill it the same way.
Start with the reusable prefix—the instructions, tools, or reference document that stays the same—then add changing input, output, and any other charges to get the whole-request cost.
Check the model, price tier, and lifetime together
These direct-provider prices were checked November 30, 2026, in USD per million tokens. The OpenAI example uses GPT-6.2 Sol, Standard processing, short-context rates through the Responses API. The Anthropic example uses Claude Sonnet 5.5 through the direct Messages API at standard rates. Batch, accelerated processing, long-context, regional, and third-party platform rates are outside this comparison.
| Model | Ordinary input | Cache read | Short-lifetime write | Longer-lifetime write | Output |
|---|---|---|---|---|---|
| GPT-6.2 Sol | $2.00 | $0.10 | $2.50 / 30 minutes | $5.00 / 12 hours | $10.00 |
| Claude Sonnet 5.5 | $2.00 | $0.10 | $2.50 / 5 minutes | $4.00 / 1 hour | $10.00 |
Sources: OpenAI's Standard pricing table and Anthropic's model pricing table. The listed write price is the total price of writing those tokens, not a surcharge to add to ordinary input pricing for the same tokens. Both selected models have a read multiplier of 0.05; do not substitute a generic 0.1 multiplier from another model.
Time to live (TTL) describes the applicable cache lifetime. It does not guarantee every potential reuse becomes a billed read. Keep the selected caching mode and exact model with your rate snapshot; older models can use different controls and billing rules.
Calculate the write premium against actual reads
For one model and rate tier, define:
- P: ordinary input price per million tokens.
- U: ordinary input tokens, excluding cache reads and writes.
- W: tokens charged as cache writes; w: write price divided by P.
- R: tokens charged as cache reads; r: read price divided by P.
- S: any separately applicable storage or caching fee, in dollars.
For the same input-token workload:
Uncached input cost = (U + W + R) × P / 1,000,000
Cached input cost = (U + wW + rR) × P / 1,000,000 + S
Saving = [R(1 − r) − W(w − 1)] × P / 1,000,000 − S
With multiple write lifetimes, replace W(w − 1) with the sum of each write bucket's premium. Do not charge the same tokens once as ordinary input and again as a write.
For one write followed by k full reads of an identical-length prefix, with S = 0, caching is cheaper when:
k > (w − 1) / (1 − r)
Equality means equal cost, not a saving. The thresholds for the checked rates are:
| Contract | w | r | Reads must exceed | Minimum subsequent full reads |
|---|---|---|---|---|
| Either model's short write | 1.25 | 0.05 | 0.2632 | 1 |
| Sonnet 5.5, 1-hour write | 2.00 | 0.05 | 1.0526 | 2 |
| GPT-6.2 Sol, 12-hour write | 2.50 | 0.05 | 1.5789 | 2 |
The write request itself is not one of those reads. For partial hits, changing prefix lengths, or additional writes, use token counts in the general formula instead of counting requests.
Price ten uses of one prefix
Worked example using synthetic usage: ten requests each contain a 10,240-token stable prefix and a 256-token uncached question, and each generates 512 output tokens. Assume the prefix is eligible and matches in full. The fast-reuse scenario has one write and nine billed full reads. It contains no prewarming request or extra storage charge.
| Scenario | Prefix charge | Changing input + output | Whole workload estimate |
|---|---|---|---|
| Same tokens without caching | $0.204800 | $0.056320 | $0.261120 |
| Sonnet 5.5, 5-minute write | $0.034816 | $0.056320 | $0.091136 |
| Sonnet 5.5, 1-hour write | $0.050176 | $0.056320 | $0.106496 |
| GPT-6.2 Sol, 30-minute write | $0.034816 | $0.056320 | $0.091136 |
| GPT-6.2 Sol, 12-hour write | $0.060416 | $0.056320 | $0.116736 |
For example, the short-lifetime prefix charge is:
(10,240 × $2.50 + 9 × 10,240 × $0.10) / 1,000,000 = $0.034816
The common $0.056320 consists of 10 × 256 × $2 / 1,000,000 for questions and 10 × 512 × $10 / 1,000,000 for output. Keeping those charges visible prevents a prefix-only discount from becoming a claim about the entire bill.
This example fixes output length for arithmetic; it is not a cross-model quality or latency comparison. If your output or tool usage changes, recalculate the whole workload. A non-generating prewarm still needs its own write/usage row rather than disappearing from the budget.
Choose a TTL from the gaps between requests
Consider a second synthetic trace for the same ten-request workload. Request starts are at minutes 0, 1, 45, 46, 90, 91, 135, 136, 180, and 181. Responses finish before the next listed request. Each pair reuses the same prefix; the gaps between pairs are 44 minutes.
For the short-TTL scenarios, suppose usage records show the prior entry is no longer eligible at each pair's first request: five full writes and five full reads. For the longer-TTL scenarios, suppose all nine later requests receive read pricing.
| Contract | Assumed writes / reads | Prefix charge | Whole workload estimate |
|---|---|---|---|
| Sonnet 5.5, 5 minutes | 5 / 5 | $0.133120 | $0.189440 |
| Sonnet 5.5, 1 hour | 1 / 9 | $0.050176 | $0.106496 |
| GPT-6.2 Sol, 30 minutes | 5 / 5 | $0.133120 | $0.189440 |
| GPT-6.2 Sol, 12 hours | 1 / 9 | $0.060416 | $0.116736 |
The lifetime rules make this distinction useful. Anthropic's caching guide measures lifetime from the start of a write/read request and refreshes it on reuse. A long response consumes that window; the one-hour case can span this trace through repeated refreshes.
OpenAI's caching guide documents 30-minute and Responses-only 12-hour options for the selected model generation. Its minimum lifetime does not establish an exact deletion deadline. Upgrading valid short coverage to 12 hours incurs a new long-lifetime write without crediting the earlier write. Do not treat an upgrade as a free read or infer billed misses solely from elapsed time.
The sparse-trace write counts above are assumptions to verify against usage, not an expiry measurement. If every short-cache attempt instead becomes a write, ten writes cost $0.256000 for the prefix—25% more than its $0.204800 uncached baseline. A write-heavy workload can lose money despite enabling caching successfully.
Normalize usage before applying the formula
Request counts cannot tell you how many tokens received each price. For the selected API modes, use these field relationships:
| API surface | Ordinary input U | Cache read R | Writes by lifetime |
|---|---|---|---|
OpenAI Responses with prompt_cache_options |
usage.input_tokens − cached_tokens − cache_write_tokens |
input_tokens_details.cached_tokens |
input_tokens_details.cache_write_tokens_details.ttl_30m_tokens and ttl_12h_tokens |
| Anthropic Messages | usage.input_tokens |
usage.cache_read_input_tokens |
usage.cache_creation.ephemeral_5m_input_tokens and ephemeral_1h_input_tokens |
OpenAI detail fields are under usage.input_tokens_details; Anthropic's write components sum to usage.cache_creation_input_tokens. Each pair of lifetime components replaces its write total in the cost calculation; it is not additional usage. A missing field or an unexpected negative derived U needs investigation, not a guessed zero.
For a synthetic mixed-lifetime input record, let U = 256, R = 4,096, short writes = 2,048, and long writes = 4,096. Both providers process 10,496 input tokens, but their ordinary-input fields differ: OpenAI reports an inclusive input total of 10,496; Anthropic's input_tokens is 256.
At the selected rates, the input estimate is $0.0265216 for GPT-6.2 Sol and $0.0224256 for Sonnet 5.5. The difference comes from the long-write rate, not from processing fewer tokens. Add output and any separately billed service charges afterward.
Turn the calculation into a billing check
On GPT-6.2 Sol’s Responses API, top-level instructions are billed as ordinary input on every request. Put reusable instructions in a developer message at the start of input. For the worked example, use explicit-only caching and mark the end of the stable prefix with prompt_cache_breakpoint on an input_text block. Put the changing question after that boundary. The reusable prefix must reach 1,024 tokens. OpenAI prompt caching
On Claude Sonnet 5.5’s Messages API, the minimum cacheable prefix is 512 tokens. Place cache_control on the final stable block and put the question in a later block. For either model, repeat the eligible prefix and check the cache-read tokens in the returned usage before budgeting for a discount. Anthropic prompt caching
For each attempt, record the provider/account, exact model, API surface, pricing tier, rate date, timestamp, prefix version, requested TTL, ordinary input, reads, writes by lifetime, output, and attributable charge. Do not store API keys or confidential prompt text in ordinary cost logs.
Aggregate read tokens divided by total input tokens gives a token hit share. It is not a dollar saving, and averaging per-request percentages can hide large misses. Compare the correctly priced sum with the same-token baseline, then match the estimate to billing records using the usage and billing reconciliation guide. Keep unmatched charges and timeouts unresolved until they can be attributed.
These supplier examples are not Tokenhot quotes. For a Tokenhot route, verify its cache support, bucket mapping, rates, and final charges separately; an upstream usage field alone does not establish what the gateway charged. If you use AWS instead, follow the Amazon Bedrock prompt-caching guide and its platform-specific billing boundaries rather than importing these direct-provider prices.
Before increasing traffic, calculate both the expected reuse case and a write-heavy case from your own trace. Choose the longer lifetime when the rewrites it avoids repay its premium, and confirm that decision against the actual net charge.
Count billed cache reads and write premiums, then compare fast and sparse reuse of the same prefix. Direct-provider calculations stay separate from Tokenhot's actual charges.


