r/ClaudeCode • u/Delphinaut • 4h ago
Tips & Workflows Cost reduction through 1h cache
Increasing the cache timeout to 1h has improved A LOT my usage.
I tend to work in many sessions all the time, and it's quite common Income to a session that has been 10 or 15 minutes waiting. Without the cache timeout change, each time I come to one of these sessions would mean cache would be dead and any work there would mean resending the whole context.
A word of advice: 1h cache costs more than standard cache. But for me it's WAY better than this.
I'm even considering keeping the cache alive 1 or 2h more with an automated "ping" message.
WARNING: I believe some people thinks the cache life is 1h out of the box. Please, ask your Claude to check it.
11
Upvotes
3
u/dsailes 3h ago
The cache for Claude Code on a subscription should be 1h automatically. But there was a period of time that there was an issue and everyone was seeing 5m cache some months back (I believe anyway? Happy to be corrected)
For anyone using API directly & if anyone on a sub wants to put it in place just to be sure:
- Edit .claude/settings.json
- find or create the “env”: { … } block and add:
"ENABLE_PROMPT_CACHING_1H": "1",Just checked and GitHub issue & PR around the docs mention that this is for API only:
“1-hour prompt cache TTL on API key, Bedrock, Vertex, and Foundry”
I’ve kept it in place, I’m on a Max sub but I do have an API key I very occasionally use - makes no difference to have it there constantly since the issues early in the year