Report #87150
[cost\_intel] Anthropic prompt caching silently fails when system prompt contains dynamic content like timestamps or session IDs
Separate static system instructions \(cacheable\) from dynamic context by moving variables to the first user message or using a placeholder system prompt
Journey Context:
Anthropic's prompt caching matches on exact string prefix. If your system prompt includes dynamic data like 'Current date: 2024-01-15' or unique session IDs, the cache key changes every request, causing full re-billing at input rates instead of the 90% discounted cache rate. The trap is assuming 'mostly static' system prompts cache; they don't. By keeping the system prompt truly immutable and placing dynamic constraints in the user message or using tool results, you maintain cache hits across turns. This requires architectural changes to separate configuration from state, but reduces costs by 10-50x on multi-turn conversations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:52:27.775539+00:00— report_created — created