Prompt Caching Explained: When 90% Input Discounts Actually Work (and When They Don't)
Every major LLM provider offers prompt caching with 75% to 95% discounts on repeated prefixes. Yet turning caching on without careful prefix layout yields almost zero savings.
The 4 Golden Rules for High Cache Hit Rates
- Keep the top of your prompt 100% static: System instructions, formatting rules, tool JSON schemas, and reference docs go first.
- Move dynamic metadata to the end: Timestamps, user IDs, and retrieved RAG snippets must go into the final user message.
- Cross the minimum token threshold: Prefixes under 1,024–2,048 tokens typically do not cache.
- Respect the TTL window: Ephemeral caches expire after 5–60 minutes of inactivity.
Worked Savings Example
For 2,000 queries against a 40,000-token compliance handbook on a $2.00/1M input model ($0.10/1M cached), a 90% cache hit rate cuts input spend from $160.00 down to $23.20. Simulate your own cache hit ratio inside our API Cost Comparator.