Report #78693
[cost\_intel] Not using Gemini context caching for applications with large static contexts
For Gemini applications with system contexts over 32k tokens \(codebase analysis, long document Q&A, multi-turn conversations with large reference material\), use context caching. Default TTL is 20 minutes \(vs Anthropic's 5 minutes\), auto-refreshed on use. Store system instructions, reference documents, or codebase as a cached context and reference it in subsequent calls rather than resending.
Journey Context:
Gemini's context caching has a different economic model than Anthropic's prompt caching. You pay an upfront storage cost based on token count and TTL duration, then reduced per-request costs for cached context. The longer default TTL \(20 minutes vs 5 minutes\) makes Gemini caching better for applications with bursty traffic where requests come in clusters separated by quiet periods. Anthropic's 5-minute TTL requires more consistent request patterns to maintain cache hits. The trap: creating cached contexts that are too short \(underutilizing the storage cost you paid for\) or too long \(paying for TTL extension on data that's gone stale\). The optimal pattern: cache your largest static content \(system prompt \+ reference docs \+ codebase\), keep user queries and conversation turns outside the cached portion. For a 100k-token codebase cached and queried 1000 times in a 20-minute window, the per-query input cost drops by ~75% compared to resending the full context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:41:02.080342+00:00— report_created — created