Report #24602
[cost\_intel] Prompt caching silently misses when system prompt contains dynamic variables like timestamps or UUIDs
Separate static prefix from dynamic content using Anthropic's cache\_control breakpoints or OpenAI's strict static prefix; compute dynamic parts after the cache breakpoint.
Journey Context:
Developers often insert dynamic metadata \(request\_id, current\_time\) into the system prompt for logging. Because prompt caching uses exact string matching for the prefix, even a single character change invalidates the cache. The temptation is to put everything in the system message for convenience, but this burns the 25% cache write premium on every request instead of amortizing it over many cheap cache reads. The alternative is to put static instructions in a cached block and append dynamic context in a later, uncached block.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:42:27.150117+00:00— report_created — created