Your One-Hour Cache Window Probably Isn't an Hour
I’d been treating a growing context window as free, as long as the session stayed inside the one-hour cache window. The discount is real, but it has nothing to do with the hour — and outside a subscription the hour isn’t an hour.
How this works, in 60 seconds
The model remembers nothing between turns. Every message you send re-transmits the entire conversation — system prompt, project context, every prior message, every tool result, every file Claude read an hour ago. It’s all rented per turn, not bought once.
Prompt caching is how the API avoids reprocessing the part that didn’t change. It matches on the prefix: the start of the request. Whatever it recognizes, it bills at a steep discount instead of full input price — which is why it’s the whole game on a big prefix.
Cache entries expire after a period of inactivity, and every read resets the timer for free. So a session you’re actively working never ages out. Expiry bites in the gaps — the coffee, the meeting, the overnight.
For the mechanism, Anthropic’s prompt caching docs; for how Claude Code applies it, How Claude Code uses prompt caching.
What the discount actually is
| Operation | Cost vs. base input |
|---|---|
| Uncached input | 1× |
| Cache write — 5-minute TTL | 1.25× |
| Cache write — 1-hour TTL | 2× |
| Cache read — most models | 0.1× |
| Cache read — Opus 5.5, Sonnet 5.5 | 0.05× |
| Cache read — Fable 5.1 | 0.025× |
Rates as of October 2026.
The discount belongs to caching, not to the hour. Both TTLs read at the same rate. The one-hour TTL buys you lifetime and doubles your write cost.
A growing session is not one cached entry. Because matching is prefix-based, every turn re-reads the entire prior conversation and writes the new delta. Per-turn cost still climbs with context size, just at the cached rate.
You may not be on the 1-hour TTL at all
The one-hour TTL depends on how you authenticate and how much you’ve spent.
| Request bucket | Subscription, within plan usage | Usage credits, API key, cloud provider |
|---|---|---|
| Main conversation | 1 hour | 5 minutes |
| Everything else — subagents, compaction, workflows, forks | 5 minutes | 5 minutes |
Subagents and compaction run on five minutes on either plan. Once a subscription spills into usage credits, the main conversation drops to five minutes too — exactly when you’re watching cost. The subscription-versus-API-rates line moves more than your bill.
Set promptCacheTtl (or CLAUDE_CODE_PROMPT_CACHE_TTL) to 1h to override it. To see which one you’re actually getting:
claude -p "hello" --output-format json
(That’s non-interactive mode — one shot to stdout, no REPL.)
Read usage.cache_creation: one-hour writes land in ephemeral_1h_input_tokens, five-minute writes in ephemeral_5m_input_tokens.
Compact at a seam — and Claude Code may do it for you
Compaction isn’t free either. Summarizing is a separate request carrying your system prompt, tools, and the whole history.
While the cache is warm, that request reads your prefix at the cached rate and, in Anthropic’s words, “costs a fraction of what the context size suggests.” After the window has lapsed, there’s no cache left to read, so it reprocesses the entire history as uncached input. Which is why /compact is at its most expensive on a session you resumed the next morning.
Compact before you walk away, while the cache is still warm, not when you get back. You may not need to: idleCompaction is on by default and compacts a conversation past 200,000 tokens after about 54 idle minutes on the one-hour TTL. Set it to false to stop it.
That leaves the manual habit mattering most where idle compaction doesn’t reach — any session on the five-minute TTL, or under that 200,000-token gate.
The rule that survives all of this
Compact at a seam — task finished, test green, commit landed — while you can still read the summary and correct it. Not at the auto-threshold mid-task, when it drops the file state and stack trace you were about to need.
Do you know which TTL your current session is on?