Gemini Context Caching: Repeated Documents and Costs

If an app sends the same manual with every question, it pays to process repeated context. Caching can reduce that cost under certain conditions. First check what your model and API support.

One document set connects to several question cards through looping arrows, representing context reuse

Caching can reduce costs when requests reuse the same prefix

Context caching lets the system reuse context such as system instructions or the same document for later requests instead of pricing that portion like entirely new input each time. It does not enlarge the context window or guarantee that the AI answers correctly.

Gemini context caching documentation describes two approaches: implicit caching automatically detects repeated prefixes; explicit caching lets developers create a cache object for supported models and APIs.

Check which caching methods the model and API support

IssueImplicitExplicit
How to beginThe system automatically detects repeated prefixesThe developer creates the cache object.
Expecting a cache hitNot guaranteed for every requestReference a cache created under the relevant conditions
LimitationsThere are version conditions and a minimum number of tokens.Depends on API/supported version There may also be a time-based storage fee.

According to documentation reviewed on October 29, 2026, the Interactions API supports only implicit caching and explicit caching is unavailable from Gemini 4 Argon onward. For supported older models, the documentation recommends the generateContent API for explicit caching. Check the actual model and endpoint rather than assuming every Gemini integration supports the same method.

Gemini API pricing page reviewed on October 15, 2026, lists context caching generally under Paid, but some model and service-tier rows also show cached input under Free. Check your exact model and tier before deciding whether it is free or paid.

For Gemini 4 (Argon onward), the documentation also describes a multi-turn or agent-loop condition: when the next turn adds at least 2,050 tokens, the system caches the entire preceding request, including responses, thinking and function outputs. Otherwise, the final 2,050 tokens of the preceding request are processed at the normal input rate. Do not use the hypothetical 19 hits below as a budget guarantee.

Hypothetical example: A 10,000-token manual and 20 questions

Suppose a manual contains 10,000 input tokens and you ask 20 questions. If no portion is counted as cached input, the manual alone accounts for 10,000 × 20 = 200,000 input tokens excluding questions and answers.

Now suppose the first request is charged normally and all 19 later requests count the entire manual as cached input. That gives 190,000 cached tokens with 10,000 normal input tokens for the manual alone. This is a hypothetical scenario, not an API test or a guaranteed hit rate.

Calculate cost as (normal tokens ÷ 1,000,000 × normal input price) + (cached tokens ÷ 1,000,000 × cached input price) + cache storage cost (if any) + output cost and other services. Add question tokens and any tool calls for the actual workflow. Check current rates on the Pricing page

Compare total cost for the same task at comparable answer quality. If an explicit cache incurs time-based storage fees, two uses of a document may not pay off. Implicit requests can hit or miss individually, so 19 hits cannot be used as a guaranteed budget.

Organize repeated context and measure cache hits

  1. Separate Fixed context such as one version of a manual from questions that change each time
  2. With implicit caching, place repeated content at the start of the request, as Google recommends.
  3. Send requests with similar prefixes within an appropriate period, without assuming every request will hit.
  4. Read usage data such as usage.total_cached_tokens for the Interactions API, or the field documented for your endpoint, then compare actual cost with uncached requests.
  5. When the manual changes, check that the app uses the latest version rather than an old cache.

For a single question about a short file, or a new document on every request, managing a cache may cost more effort than it saves.

Check answers and data policies even when caching is enabled

Caching does not check answers for you. Review the evidence, citations and document version the AI used. Before sending company documents or personal data, check the service’s data policy and retention period.

Start by counting requests that really reuse context. Select a compatible API and model, then measure cache hits and actual cost before deciding whether explicit cache management is worth adding.

Read moreWhat is the Context Window of AI?Separate context-capacity limits from reusing existing context

Sources

Google documentation reviewed October 29, 2026; the caching page was updated October 23. No API calls were made. Figures are hypothetical, not actual prices or guaranteed cache hits.