Low cache hit rate around 40% and very slow responses in Claude Code
Quick fix
Set CLAUDE_CODE_ATTRIBUTION_HEADER to false in .claude/settings.json to stop dynamic headers from breaking third-party model prompt caching.
Symptom
Section titled “Symptom”命中率只有40%多,而且速度特别慢Cache hit rate is only just over 40%, and responses are very slow.
When Claude Code connects to third-party models such as DeepSeek or Codex, it injects a dynamic attribution header (CCH). Because this header changes on every request, it breaks prompt caching. Cache misses can drop the hit rate from about 90% to 40% or 70%, causing very slow responses and increased token usage.
Open or create the local Claude Code configuration file.
In the env section, set CLAUDE_CODE_ATTRIBUTION_HEADER to "false" to stop Claude Code from injecting the dynamic attribution header.
// .claude/settings.json{"env": {"CLAUDE_CODE_ATTRIBUTION_HEADER": "false"}}
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- What if setting CLAUDE_CODE_ATTRIBUTION_HEADER to false does not fix slow responses or high token usage?
- Some users report the issue persists after changing the setting. This may be caused by delayed server-side adaptation for a specific model. Community reports indicate switching to minimax2.7 or deepseek v4 can restore normal speed.
- Can this also cause simple messages to take more than ten minutes?
- Yes. Cache misses force the third-party model to reprocess the full context, causing severe response delays. Disabling the dynamic attribution header usually fixes this.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.