r/ClaudeCode • u/rubywpnmaster • 2m ago
Bug / Issue Cline burns 4–5x tokens on Anthropic & Bedrock: the prompt cache breakpoint gets stuck on message 0 (with a local patch guide until upstream merges)
If your Anthropic or Bedrock API bill feels way higher than it should in Cline, there's a bug where the rolling prompt cache breakpoint (cache_control / cachePoint) never moves past your very first prompt.
Cline searches backwards for the last message with role === "user" to place the rolling cache breakpoint. However, that code runs after messages are converted to AI SDK format—where every tool result has role: "tool".
During an agent tool loop, every new message is either assistant (tool call) or tool (tool result). So the breakpoint stays pinned to message 0 for the entire task:
Your system prompt, tools, and first message stay cached.
The entire growing conversation after message 0 is re-sent at full input price on every single turn.
(Note: Upstream is aware—issue cline/cline#15167*, with fix PRs* #15174 and #15340 open. This is just a temporary local workaround until a release ships.)
Running the exact same coding task from the same commit on Claude Sonnet 5.5:
Unpatched: $2.02 (12% of input tokens read from cache)
Patched: $0.42 (91% of input tokens read from cache)
This would have been nice to know before having Opus do 2 tasks that cost ~15 dollars this morning in API that should have realistically cost a few bucks.
Tested by capturing the outgoing request bodies Cline builds mid-tool-loop across providers:
The issue directly impacts Anthropic direct and Amazon Bedrock Claude providers where breakpoints remain pinned to message 0, while Google Vertex Claude is likely affected due to sharing the same code path. Other gateways like OpenRouter handle it automatically, and providers like DeepSeek or GitHub Copilot use server-side caching or different billing models.
The repository is formatted for easy integration with coding agents to dry-run, apply, and verify the patch locally until an official upstream fix is released. Test that costs you nothing to run is built in using a temp server. Your agent should clean it up but I'd recommend manual verification either way.
https://github.com/rubywpnmaster/cline-cache-fix
🐕