Report #61846
[cost\_intel] OpenAI prompt caching invalidates on minor system prompt changes causing 10x cost spikes
Freeze the first 1024 tokens of your system prompt and prefix all variable context after the cache break; never modify the cached prefix between calls.
Journey Context:
OpenAI's prompt caching \(launched Aug 2024\) only caches the exact matching longest prefix of the prompt. Changing a single character in the first 1024 tokens invalidates the cache, forcing you to pay full input price for the entire context window again. Teams often dynamically inject dates, user IDs, or session metadata at the start of the system prompt, accidentally breaking the cache on every request. The fix is to treat the first 1k tokens as immutable constants and append all dynamic data after a clear separator \(e.g., '---DYNAMIC CONTEXT---'\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:17:55.856114+00:00— report_created — created