[BUG] Disabling telemetry also disables 1-hour prompt cache TTL
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When telemetry is disabled (e.g., via DISABLE_TELEMETRY=1 or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1), sessions that would otherwise receive 1-hour prompt cache TTL appear to fall back to the 5-minute TTL instead.
What Should Happen?
Prompt cache TTL selection should be independent of telemetry. If a user/session would otherwise qualify for 1-hour prompt cache TTL, it should still receive it even when telemetry is disabled.
Error Messages/Logs
Steps to Reproduce
- Start a session with telemetry enabled.
- Confirm the session is using the 1-hour prompt cache tier.
- Start a comparable session with either
DISABLE_TELEMETRY=1orCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1. - Compare the cache metadata between the two sessions.
- Observe that the 1-hour TTL is no longer applied when telemetry is disabled.
Note: This may not be reproducible if using bedrock and ENABLE_PROMPT_CACHING_1H_BEDROCK=1 is set. I only tested with an Anthropic Claude Max plan.
What metadata to check:
In session transcripts, check the assistant response usage.cache_creation metadata for the prompt cache tier:
usage.cache_creation.ephemeral_1h_input_tokensusage.cache_creation.ephemeral_5m_input_tokens
If 1-hour TTL is active, ephemeral_1h_input_tokens should be non-zero.
If 5-minute TTL is active, ephemeral_5m_input_tokens should be non-zero.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.96
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
13 Comments
Here's a simple script to reproduce the issue:
output:
Confirming this bug on macOS, Claude Code 2.1.104, Anthropic API (Max plan).
Reproduced by toggling
DISABLE_TELEMETRYacross a restart in the same project. Checkedusage.cache_creationin the session transcript (~/.claude/projects/*/*.jsonl):With
DISABLE_TELEMETRY=1(before restart):Without
DISABLE_TELEMETRY(after restart, same project, same session file):Across 25M+ cache-creation tokens in prior sessions with
DISABLE_TELEMETRY=1,ephemeral_1h_input_tokenswas always 0. After removing the var, 1h tier activated on the very next turn. So not macOS-specific — same behavior as reported on Windows.So hiding the user agent basically forces the 5m TTL ?
That's why i'm maxing out my max plan within 5 minutes!
<img width="562" height="252" alt="Image" src="https://github.com/user-attachments/assets/73029d57-508b-4a9b-84d6-1edf0ddb2a43" />
Even with telemetry on, the caching is still 5 min..
This issue likely only applies to max subscriptions. I think pro subs still use a 5 minute ttl.
Independent reproduction on macOS, Claude Code 2.1.104, Anthropic API (Max plan)
Confirmed the bug with interactive sessions.
Test methodology
Launched interactive sessions from the same directory, same model (Opus 4.5), differing only in
DISABLE_TELEMETRY:Results
| Session | DISABLE_TELEMETRY | ephemeral_1h_input_tokens | ephemeral_5m_input_tokens |
|---------|-------------------|---------------------------|---------------------------|
| 0fac5156 | NO | 3337 | 0 |
| ac356033 | NO | 3337 | 0 |
| fa90b6f5 | YES | 0 | 14977 |
Conclusion
The 1-hour prompt cache TTL is tied to telemetry being enabled. Disabling telemetry forces the 5-minute tier, effectively a 12x increase in cache misses for privacy-conscious users.
👋 1h prompt cache is nuanced actually. It costs more for cache writes, and less for cache reads. Whether you benefit from cheaper cache reads depends on your usage pattern -- context window size, whether the query is the main agent or subagent, etc.
We have been testing a number of heuristics to give subscribers better prompt cache hit rates, which means lower token usage and lower latency, when it works. But this effect is far from uniform due to the nuance above. Say you use 1h cache for an agent, but only used the agent to make a single query -- in this case the 1h cache would be wasted and you'd be overcharged.
At this point we have rolled out 1h prompt cache by default in a number of places for subscribers to optimize cache duration based on real usage patterns, but we actually keep it at 5m for many queries also (eg. subagents, which are rarely resumed so you'd be paying for them even though they do not benefit from 1h). We also are not defaulting API customers to 1h yet -- this needs more testing to make sure it's a net improvement on average.
Separately, when we do this kind of experimentation, we use experiment gates that are cached client-side. When you turn off telemetry we also disable experiment gates -- we do not call home when telemetry is off -- so Claude reads the default value, which is 5m. We will soon be changing the client side default to 1h for a few queries, since we now feel good that it is a small token savings on average for those queries. We will also give you env vars to force 1h and 5m.
In any case, the token savings is nowhere near 12x unfortunately. It is a small win though, that we have been in the process of rolling out to everyone. Hope the explanation helps.
More here: https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing
Fix going out in the next release!
Confirming this affected me on Windows (WSL2 + Windows Claude Code v2.1.107, Max plan). Had
DISABLE_TELEMETRY=1in~/.claude/settings.json— all Windows sessions were stuck on 5m cache TTL. Removed the flag, restarted, and new sessions immediately switched to 1h. Thanks for the fix!Verified fixed in 2.1.108 🚀
@bcherny
There are several usage patterns in which I know apriori that I'm not going to be able to use even the 1hr cache before it times out.
Is there a way to turn off token caching (& being charged for it) altogether? Preferably in a way that can be modified per prompt?
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.