Context Caching
The practice of pre-storing recurring system prompts or long documents so that subsequent requests can reuse them at a lower unit price. It suits multi-turn question answering or fixed knowledge base scenarios and can reduce token costs.
Core Facts
Timeline (last 90 days)
Gemini API context caching comes in two forms: implicit caching (the system automatically identifies repeated prefixes) and explicit caching (developers actively create cache objects and specify a TTL).
The context cache is fully readable before it expires and may be captured by logging systems or observability tools; revoking an API key does not trigger cache invalidation.
When processing a long document of 8000 tokens, the KV cache may consume several additional GB of memory.
Whether prompt caching hits depends on byte-for-byte consistency of the request prefix; if even one character at the beginning differs, the entire cache is invalidated.
According to Anthropic's published prices (input $10, output $50, cache read $1, cache write $12.50 per million tokens), the example session in the article costs $16.88, of which cache reads account for 29.6%, cache writes 25.9%, fresh input 14.8%, and output 29.6%.
All Facts (5)
Whether prompt caching hits depends on byte-for-byte consistency of the request prefix; if even one character at the beginning differs, the entire cache is invalidated.
70%UnverifiedGemini API context caching comes in two forms: implicit caching (the system automatically identifies repeated prefixes) and explicit caching (developers actively create cache objects and specify a TTL).
50%UnverifiedThe context cache is fully readable before it expires and may be captured by logging systems or observability tools; revoking an API key does not trigger cache invalidation.
50%UnverifiedWhen processing a long document of 8000 tokens, the KV cache may consume several additional GB of memory.
50%UnverifiedAccording to Anthropic's published prices (input $10, output $50, cache read $1, cache write $12.50 per million tokens), the example session in the article costs $16.88, of which cache reads account for 29.6%, cache writes 25.9%, fresh input 14.8%, and output 29.6%.
50%