Summary
Anthropic prompt caching not working - missing cache_control headers in API requests
Steps to reproduce
- Configure OpenClaw with
cacheRetention: "long" for Anthropic provider
- Send multiple messages to the agent within 1 hour
- Check Anthropic API logs at console.anthropic.com/logs
- Observe all requests show "Standard" service tier with no cache_creation_input_tokens or cache_read_input_tokens
Expected behavior
First API request: Shows cache_creation_input_tokens (~30k) as cache is created
Subsequent requests (within 1 hour): Show cache_read_input_tokens (~30k) + regular input_tokens (~500)
Result: 90% cost reduction per message after initial request
Actual behavior
All API requests show "Standard" service tier with only input_tokens field (~30k tokens)
No cache_creation_input_tokens or cache_read_input_tokens fields present
Every message costs full token amount (15-20x more expensive than expected)
Rate limits (30k tokens/min) hit after 1-2 messages, making Sonnet 4.5 nearly unusable

OpenClaw version
2026.2.14
Operating system
macOS Sequoia (Darwin 24.6.0) on Apple Silicon
Install method
npm global
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response
Summary
Anthropic prompt caching not working - missing cache_control headers in API requests
Steps to reproduce
cacheRetention: "long"for Anthropic providerExpected behavior
First API request: Shows cache_creation_input_tokens (~30k) as cache is created
Subsequent requests (within 1 hour): Show cache_read_input_tokens (~30k) + regular input_tokens (~500)
Result: 90% cost reduction per message after initial request
Actual behavior
All API requests show "Standard" service tier with only input_tokens field (~30k tokens)
No cache_creation_input_tokens or cache_read_input_tokens fields present
Every message costs full token amount (15-20x more expensive than expected)
Rate limits (30k tokens/min) hit after 1-2 messages, making Sonnet 4.5 nearly unusable
OpenClaw version
2026.2.14
Operating system
macOS Sequoia (Darwin 24.6.0) on Apple Silicon
Install method
npm global
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response