all free tools

prompt cache ttl calculator

Prompt caching only pays when the next request arrives before the cache expires. A support bot busy all day keeps a 5-minute cache warm on its own. An intake agent that sees six documents an hour misses most of the time, and pays the 1.25× write price on every miss. Enter the size of the cached prefix and how often requests that share it arrive, and you get the hit rate, the writes a day and the monthly cost of no caching, the 5-minute cache, the 1-hour cache and a keep-alive ping, with the rates at which the answer changes.

free, no sign-up, runs in your browseropen source on GitHub
the cached prefix
the traffic

1-hour cache: $4.61 a month for the prefix, $48 less than no caching

1-hour cachecheapest option
$4.61prefix cost a month
98.1%cache hit rate
60requests a day
optionhit ratewrites / dayper monthvs none
no caching––$53–
5-minute cache38.7%36.8$41−$11
1-hour cache98.1%1.1$4.61−$48

cheapest option at other request rates

requests / hourcheapestper month
0.5no caching$4.40
11-hour cache$7.84
21-hour cache$7.01
41-hour cache$4.70
61-hour cache$4.61
121-hour cache$7.00
301-hour cache$15
601-hour cache$28
2405-minute cache$107

Prefix tokens only: the rest of each request costs the same whichever option you pick. A miss writes the prefix at 1.25× the input price on the 5-minute cache and 2× on the 1-hour cache; a hit reads it at the cache-read rate and resets the timer. The timer runs from the start of each request, so a long generation eats into it. Random arrivals are modelled as a Poisson stream; real traffic is burstier, so if two options are close, measure the start-to-start gaps in your logs. Claude list prices checked 2026-11-10.

questions

how is the hit rate worked out?

A request reads the cache when the previous request sharing the prefix started less than one TTL earlier, since every read resets the timer. With random arrivals the gap between requests is exponential, so a request misses with probability e^(−rate × TTL). With evenly spaced requests it misses only if the spacing is longer than the TTL. The first request of each active day always writes.

what do writes and reads cost?

On the Claude API a cache write costs 1.25× the base input price on the 5-minute TTL and 2× on the 1-hour TTL. A read costs the cache-read rate: 0.05× on Opus 5.5 and Sonnet 5.5, 0.025× on Fable 5.2 and 0.1× on Haiku 5.5. The 1-hour write costs more, so it needs gaps that the 5-minute cache would miss to pay for itself.

what is a keep-alive ping?

While idle, re-send the previous request with max_tokens set to 0 shortly before the 5-minute entry expires. It refreshes the timer and bills one cache read, with no output. It is cheapest where reads are nearly free and gaps are long, but it needs a scheduler and does not work with streaming, structured outputs or the Batch API.

is there a minimum prompt size?

Yes. Prefixes shorter than the model's minimum silently don't cache: 512 tokens on the current Claude models, and 1,024 to 4,096 on some older ones. Check the usage fields of a response: cache_read_input_tokens should be above zero after the first request.

does caching change my rate limits?

On current Claude models, tokens read from the cache don't count toward the input-tokens-per-minute limit, so a higher hit rate also buys throughput. The LLM rate limit planner shows what that does to a backlog.

more free tools

Want the numbers checked against your own process? Book a 20-minute call.