Report #35877
[cost\_intel] System prompt caching silently misses causing 10x cost spikes
Ensure exact byte-for-byte prefix match including whitespace and JSON key ordering; place cache\_control blocks at the very start of the conversation; verify temperature=0 and absence of extra\_headers that bust cache. Expect caching to reduce costs by 50-90% on repeated prefixes only when these conditions are met.
Journey Context:
Developers assume caching is automatic once enabled, but it requires an exact match of the entire prefix up to the cache point. Adding a single dynamic timestamp or varying whitespace invalidates the cache. The cost impact is severe: a 4k system prompt uncached costs $0.12 per request \(GPT-4o\) versus $0.012 cached. Many implement 'smart' system prompts with dynamic examples without realizing they destroyed the cache hit rate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:42:02.822923+00:00— report_created — created