ByteCosts
openai-prompt-caching-gpt-5-6-changes.mdx

AI Coding Agents

OpenAI prompt caching changes in GPT-5.6 and later

The OpenAI prompt caching GPT-5.6 changes introduce paid cache writes, explicit breakpoints, and a 12-hour minimum cache lifetime option in the Responses API. Earlier models handle writes without a separate charge and report cached tokens in 128-token increments. When migrating a Responses API workload, track billed reads and writes separately, then choose a breakpoint and lifetime based on how often you reuse each prefix.

OpenAI’s GPT-5.6 prompt caching changes introduce paid writes, explicit breakpoints, and a 12-hour minimum cache lifetime option in the Responses API. Earlier models handle writes without a separate charge and report cached tokens in 128-token increments. When migrating a Responses API workload, track billed reads and writes separately, then choose a breakpoint and lifetime based on how often you reuse each prefix.

Compare the two OpenAI caching regimes

As of November 30, 2026, OpenAI separates earlier models from GPT-5.6 and later. Both can cache automatically on supported models. The newer regime changes where a prefix ends, what it costs to write, and how you select its lifetime. See the OpenAI prompt caching guide.

BehaviorEarlier OpenAI modelsGPT-5.6 and later
Minimum cacheable prefixVaries with request settings in OpenAI’s current guide. Azure documents a 1,024-token threshold.1,024 visible input tokens. Hidden system content does not count toward the minimum.
Automatic breakpointRegular, model-dependent intervals. The guide gives 2,048-token intervals for GPT-5.5 and GPT-5.5 Pro.End of the latest eligible message in implicit mode.
Cached token reportingExcludes hidden tokens and rounds down to a multiple of 128.Reports the exact eligible boundary, excluding hidden tokens.
Cache write chargeNo additional charge for writing.1.25× ordinary input for "30m", or 2.5× for "12h" in the Responses API.
Cache read chargeModel-dependent cached input rate.0.1× ordinary input for most models. GPT-6.2 Astra, GPT-6.2 Sol, GPT-6.1 Sol, and GPT-6.1 Terra use 0.05×.
Lifetime controlprompt_cache_retention, with "in_memory" and "24h" availability depending on the model.prompt_cache_options.ttl, with a default of "30m" and a Responses API option of "12h".
Explicit breakpoint and routingNo explicit breakpoints. A stable prompt_cache_key can help routing.prompt_cache_breakpoint marks selected boundaries. OpenAI handles routing automatically and a key is optional for separate cache accounting.

OpenAI’s archived pre-GPT-5.6 cookbook also gives a 1,024-token minimum. For earlier models on the OpenAI API, use the current guide’s model comparison when testing eligibility, since it gives a minimum that varies with request settings. See Prompt Caching 201.

On earlier models, OpenAI says in-memory entries typically last 5 to 10 minutes of inactivity and can last up to one hour. Extended retention typically keeps entries available for around 30 minutes and can retain them for up to 24 hours. Where both policies are supported, OpenAI defaults organizations without Zero Data Retention to "24h" and organizations with it to "in_memory". The current guide lists GPT-5.5 and GPT-5.5 Pro as "24h" only. Check the model before reusing a retention setting from an older integration.

On GPT-5.6 and later, the TTL is a minimum for cache-read pricing eligibility. OpenAI may retain coverage longer. The TTL also does not set a deletion deadline or promise a particular latency. The API applies one rate per input token. A 1.25× write costs 1.25 times ordinary input in total for that token.

Choose the boundary and lifetime

  1. Start with the rendered prompt layout. Put reusable developer instructions and reference material ahead of changing questions. Keep tool definitions and their order stable. The cache matches the rendered prefix, so a changed schema near the start can prevent reuse even when the developer message still matches.
  2. Use implicit mode for a thread that mostly appends. With prompt_cache_options.mode set to implicit, the breakpoint falls at the end of the latest eligible message. Eligible messages are user messages, the last tool response in a consecutive group, and the last developer message in the initial consecutive group. You can keep the automatic boundary and add explicit ones. The automatic boundary uses one of the four write slots.
  3. Use explicit mode when requests share a stable prefix and diverge at the question. Set prompt_cache_options.mode to explicit and add prompt_cache_breakpoint: { "mode": "explicit" } to a supported block at the end of the stable material. The prefix through that block must meet the minimum. A changing suffix after the last selected breakpoint uses ordinary input pricing. Explicit-only mode without a breakpoint uses no cache. To reuse a prefix an existing thread cached implicitly, keep implicit mode enabled or place an explicit breakpoint at the same content-block boundary in the follow-up request. Switching modes without that matching boundary misses the saved prefix.
  4. Move reusable instructions into the prefix on GPT-6.2. The guide says models starting with GPT-6.2 render top-level instructions after input, outside eligible breakpoints, and bill those tokens at the ordinary input rate. Put stable instructions in a leading developer message inside input. To mark a boundary there, place the breakpoint on an input_text content block. Keep request-specific guidance in top-level instructions if it belongs to just that request.
  5. Assign the longer lifetime to the prefix that gets reused across gaps. The request-level TTL applies to the implicit breakpoint and any explicit breakpoint without its own TTL. Set prompt_cache_breakpoint.ttl on an individual explicit breakpoint to override it. If a later 12-hour write covers an earlier selected 30-minute prefix, the overlapping tokens are billed once at the longer lifetime. Put the longest-lived shared material first if you want only it to get the longer write.

A 30-minute read refreshes coverage to at least 30 minutes after the read. If an entry already has valid 12-hour coverage, that read preserves the later expiry without restarting a 12-hour clock. Upgrading existing 30-minute coverage to 12 hours incurs a new 12-hour write for the upgraded tokens. Check the lifetime breakdown before interpreting a lower billed read count after a TTL change.

On GPT-5.6 and later, set prompt_cache_options.prewarm to true in a Responses API request to prepare a known prefix without generating output. The cache writes are billed at the selected lifetime’s rate. Send the follow-up with the same prefix and omit prewarm or set it to false.

Calculate the cost from Responses API usage

On supported models, start with usage.input_tokens and read cached_tokens and cache_write_tokens from usage.input_tokens_details. The nested cache_write_tokens_details object gives ttl_30m_tokens and ttl_12h_tokens. They add up to cache_write_tokens. Derive ordinary input as total input minus billed cached tokens and cache writes. The read counter excludes tokens charged as writes, including coverage upgrades.

Use committed GPT-6.2 Sol rates of $2 for ordinary input, $0.10 for cached input, $2.50 for a 30-minute write, and $10 for output, all per million tokens. Derive the 12-hour write rate as 2.5 times $2, or $5 per million, using the lifetime multiplier from OpenAI’s guide. Compare with the ByteCosts pricing index for current rates.

For a mixed-lifetime request, keep the top-level write count for reconciliation and use its two components for pricing. For example, suppose a response reports 20,000 input tokens, 8,000 reads, 9,000 writes, and a write breakdown of 6,000 short and 3,000 long. That leaves 3,000 ordinary input tokens, and adding the two lifetime components accounts for all 9,000 writes. The estimated input charge is (3,000 × 2 + 8,000 × 0.10 + 6,000 × 2.50 + 3,000 × 5) / 1,000,000 = $0.0368. When migrating, check whether a request you expected to read from cache wrote new long coverage. A metric that only tracks read percentage would miss why it became more expensive.

Assume three requests with a shared 20,000-token prefix, a different 2,000-token suffix each time, and 500 output tokens per request. Under explicit caching, the breakpoint ends at the shared material. The first request writes the prefix and, in the warm scenarios, the next two read it in full. Cost is the sum of the token counts multiplied by their respective rates, divided by 1,000,000. Include output as its own bucket.

Assumed result for the three requestsCalculation at committed ratesEstimated total
No caching (explicit mode with no breakpoint)(66,000 × 2 + 1,500 × 10) / 1,000,000$0.147
One 30-minute write and two full reads(20,000 × 2.50 + 40,000 × 0.10 + 6,000 × 2 + 1,500 × 10) / 1,000,000$0.081
One 12-hour write and two full reads(20,000 × 5 + 40,000 × 0.10 + 6,000 × 2 + 1,500 × 10) / 1,000,000$0.131
Three 30-minute writes, with a miss on each follow-up(60,000 × 2.50 + 6,000 × 2 + 1,500 × 10) / 1,000,000$0.177

When the shorter lifetime already covers the repeat traffic, it costs less. If the repeated calls would each require a fresh short write but can read from one long entry, the longer lifetime has room to pay back its higher write cost. The cause of a missed read determines whether extending the TTL helps. If a tool definition changes before the breakpoint, the longer lifetime leaves you with a more expensive write of a different prefix.

Three 30-minute writes that are never read cost an estimated $0.177, compared with $0.147 at ordinary rates with caching off. If you expect material to be used only once, leave it after the last breakpoint in explicit mode so it bills as ordinary input.

Check the Azure deployment before migrating

As of November 30, 2026, Microsoft documents explicit breakpoints on standard pay-as-you-go deployments for GPT-5.6 and later families. For provisioned throughput managed deployments, it lists explicit breakpoint support beginning with GPT-6. Earlier models such as GPT-5.6 on provisioned deployments continue to use automatic caching. Use the Azure deployment name as model. See the Azure OpenAI prompt caching guide.

The Azure guide lists breakpoints for the Responses, Chat Completions, and Decisions APIs, with 12-hour TTL available on supported Responses and Decisions deployments. It dates applicable 12-hour write charges from November 1, 2026. For the Azure Chat Completions example, look under usage.prompt_tokens_details for cached_tokens and cache_write_tokens. Models before GPT-5.6 reject the newer cache options and breakpoint parameters with a 400 response, so keep these fields behind a deployment capability check during migration.

Test from the endpoint your application will actually use. For example, the Azure guide lists input_text, input_image, and input_file as breakpoint-bearing blocks on Responses, while the Chat Completions list uses different block types. Keep the rendered text and deployment fixed for your first pair of calls. First verify that an eligible prefix writes, then repeat with only the text after the boundary changed and inspect the read count. Use the deployment’s own rates when you price that result. The GPT-6.2 Sol example above uses the committed OpenAI API rates.

Decide what to change in your integration

  • You’re upgrading an older model. Run the same representative workload on both configurations and export input, read, write, and output totals. Compare estimated dollars alongside the cache ratio. See measuring prompt cache hit rate.
  • Your requests share a reference document but have unrelated questions. Mark the end of the reference in explicit mode. Verify that the first call writes it and later calls read it while billing each question as ordinary input.
  • You already set a routing key. Use the prompt cache key routing guide to review the earlier-model routing role and the newer accounting role before changing your key strategy.
  • You’re measuring the Codex CLI. Compare requests from the same client and authentication mode, and look for both writes and reads where you have access to usage. See Codex CLI cache hit rates for the distinction between documented API controls and what clients report.

Sources

How this note was produced

Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.

OpenAI prompt caching changes in GPT-5.6 and later. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/openai-prompt-caching-gpt-5-6-changes/

Sources