Report #50377
[cost\_intel] Anthropic prompt caching 10x cost spike when system prompt includes dynamic fields
Strip timestamps, request IDs, and session metadata from cached system blocks; use separate uncached blocks for dynamic context
Journey Context:
Anthropic's prompt caching matches cache hits by exact string match. If your system prompt includes 'Current time: 2024-01-15T10:30:00Z' or a unique request\_id, it breaks cache on every request, causing a full re-compute of the expensive prefix. The trap is assuming the cache is 'smart' about content similarity. You must isolate truly static content \(RAG context, core instructions\) in the cached block, and append dynamic context in a separate, uncached block or the user message.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:02:31.877693+00:00— report_created — created