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.
1-hour cache: $4.61 a month for the prefix, $48 less than no caching
| option | hit rate | writes / day | per month | vs none |
|---|---|---|---|---|
| no caching | – | – | $53 | – |
| 5-minute cache | 38.7% | 36.8 | $41 | −$11 |
| 1-hour cache | 98.1% | 1.1 | $4.61 | −$48 |
cheapest option at other request rates
| requests / hour | cheapest | per month |
|---|---|---|
| 0.5 | no caching | $4.40 |
| 1 | 1-hour cache | $7.84 |
| 2 | 1-hour cache | $7.01 |
| 4 | 1-hour cache | $4.70 |
| 6 | 1-hour cache | $4.61 |
| 12 | 1-hour cache | $7.00 |
| 30 | 1-hour cache | $15 |
| 60 | 1-hour cache | $28 |
| 240 | 5-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
- ai roi & token cost estimatorMonthly Claude API cost, cost per task and ROI for a workload
- eu ai act compliance auditorRisk tier, obligations and dates for one AI system
- agent workflow fit scorerIs this process a good fit for AI agents, and what shape?
- ai build vs buy calculatorThree-year cost: SaaS tool, custom agents, or keep it manual
- ai accuracy proof calculatorHow many test cases prove a vendor's accuracy claim?
- ai model routing calculatorWhat sending each request to the cheapest capable model saves
- human review staffing calculatorHow many reviewers an AI workflow's escalations need
- ai vendor scorecardWeighted comparison of AI vendors, with must-haves and a swing check
- gdpr dpia screener for aiDoes this AI use of personal data need a DPIA?
- agent loop cost calculatorWhat a tool-calling agent costs per task as its context grows
- llm judge agreement calculatorDoes your LLM judge agree with people beyond chance? Cohen's kappa
- escalation threshold calculatorAt what confidence should an AI workflow hand a case to a person?
- rag vs long context cost calculatorWhole corpus in a cached prompt, or retrieve chunks per query?
- agent reliability calculatorEnd-to-end accuracy of a multi-step agent, and which step to fix
- llm eval a/b test calculatorIs prompt or model B really better than A on the same golden set?
- llm rate limit plannerHow long a backlog takes under your API rate limits, and how many workers to run
Want the numbers checked against your own process? Book a 20-minute call.