DEV Community

Johmisking
Johmisking

Posted on

I paused Claude Code for 0 to 65 minutes to see when the prompt cache expires

You work in Claude Code all morning, go to lunch, come back and send one more message. The first reply is slow and your usage jumps. The usual suspect is the prompt cache: once it expires, the next message has to re-process the whole conversation.

But how long does the cache actually last? Guides say five minutes, others say an hour, and in April 2026 there was a whole controversy about it. I couldn't find anyone who had simply waited and measured, so I did.

The test

  • Claude Code 2.1.295, Opus 5.5, medium effort, signed in with a subscription, headless (-p), no MCP servers
  • Turn 1: build a small brick-breaker game in one index.html
  • Wait 0, 4, 6, 15, 30, 55 or 65 minutes
  • Turn 2 in the same session (--resume): "Make the ball red and slightly faster."
  • Each pause in its own session, all started within a minute of each other, run twice (October 20, 2026)

If the cache lasts five minutes, the cost should jump between 4 and 6 minutes. If it lasts an hour, between 55 and 65.

Results

First model call of the next message, mean of two runs. Cost is Claude Code's API list-price estimate.

Pause Read from cache Written to cache Next message cost
0 min 41,436 496 $0.039
4 min 43,232 466 $0.042
6 min 42,440 496 $0.042
15 min 43,076 502 $0.041
30 min 42,636 494 $0.043
55 min 43,183 502 $0.043
65 min 15,925 27,460 $0.253

Up to 55 minutes nothing changed. At 65 minutes the cache was gone: 27,460 tokens had to be written again and the same message cost 507% more. Both runs agreed. Every cache write in the log was ephemeral_1h.

Why an hour, and when it's five minutes

Per Claude Code's docs, the default lifetime depends on how you sign in:

How you sign in Main conversation Subagents, compaction, etc.
Subscription, within included usage 1 hour 5 minutes
Subscription, drawing on usage credits 5 minutes 5 minutes
API key or cloud provider 5 minutes 5 minutes

On Opus 5.5 a one-hour cache write costs $8 per million tokens (+100% vs normal input), a cache read $0.20 (-95%). So the expiry tax grows with conversation size: re-writing a 200,000-token conversation costs about $1.60 before your message does anything.

Before a long break

We only measured pause lengths; these come from the docs:

  • Under an hour: do nothing.
  • Long break, same task: /compact before you leave. It's cheap while the cache is warm, and leaves only a small summary to re-cache.
  • Long break, new task: /clear (the docs say it costs nothing).
  • Check: from v2.1.251, /usage shows whether the cache is warm or cold.
  • Choose the TTL yourself: promptCacheTtl (5m or 1h, v2.1.242+). Run claude -p "hello" --output-format json and look for ephemeral_1h_input_tokens vs ephemeral_5m_input_tokens to see which you get.

One small project and two runs, so treat the exact numbers as an example. The full write-up, with the pricing table, the bigger-session math and the limitations, is here:

👉 https://tokensave.app/blog/claude-code-cache-break-cost

Raw logs and CSV are open under CC BY 4.0.

Top comments (0)