[BUG] Massive token/quota spike and Prompt Caching failure after 1M context hotfix
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?
Describe the bug
After the recent hotfix for the "API Error: Usage credits required for 1M context" issue, token consumption in Claude Code has spiked dramatically.
Upon starting a session, roughly 30% to 40% of the 5-hour token quota is instantly depleted before submitting any complex commands. Subsequently, every minor code change or simple query completely wipes out the remaining quota within minutes.
It heavily implies that Prompt Caching is broken or failing entirely, causing Claude Code to re-index and re-send the entire repository context as input tokens on every single interaction.
To Reproduce
- Start a normal session using Claude Code in a medium-sized repository.
- Observe the initial quota drop immediately after startup (drops by 30-40%).
- Run a minor/simple command (e.g., asking for a code explanation or a small refactor).
- Check the remaining token quota—it will be completely or near-completely depleted.
Expected behavior
Prompt caching should keep the repository context cached after the initial indexing, and subsequent small queries should only consume tokens relative to the new delta/output, not the entire codebase over and over again.
Environment / Context
- Tool: Claude Code CLI
- Model: Claude 3.5 Sonnet
- Repository Size: Medium (Hasn't changed since before the bug occurred)
- Previous State: Prior to the 1M context bug, the exact same project was running efficiently with very low and predictable token usage.
Additional context
This seems to be a regression or side-effect introduced by the recent fix to the 1M context block error. It makes the CLI practically unusable for sustainable development.
(Note: I have also reached out to Anthropic Support regarding account credit adjustments due to this infrastructure drain).
What Should Happen?
Prompt caching should work efficiently after the initial repository indexing. Subsequent small queries or minor code modifications should only consume tokens relative to the new prompt delta and output, rather than re-sending and re-charging for the entire codebase context on every single interaction.
Error Messages/Logs
Steps to Reproduce
- Open a medium-sized project directory in the terminal.
- Launch Claude Code CLI (
claude). - Check the initial token usage or quota immediately after startup (notice a sudden 30-40% drop).
- Run a very simple query or a minor code task (e.g., "explain this 10-line function").
- Check the remaining token quota again (notice the entire 5-hour quota gets completely or near-completely depleted).
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.158
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗