Skip to content

Cost and FinOpsGuide

OpenAI's 12-hour prompt cache: when the 2.5x write pays off

Since 20 October the Responses API can keep a prompt prefix cached for at least 12 hours, at the price of a write that costs 2.5 times the input rate. Here is when that pays, how it compares with the 30-minute default, Anthropic's one-hour cache and Gemini's explicit caches, and how to check it is working.

By INFRO Editorial

Published

8 min read

A glowing amber loop on a dark ground passing a ring of lit and unlit nodes around a bright central hub

In short

OpenAI's 12-hour prompt cache, added to the Responses API on 20 October 2026 for GPT-5.6 and later models, keeps a prefix eligible for cache-read pricing for at least 12 hours. A write costs 2.5x the input rate and a read 0.1x (0.05x on GPT-6.1 Sol and Terra), so it pays from the second read inside the window. Use it for shared context that is reused hours apart, where the 30-minute default would expire between requests; for traffic that arrives every few minutes the 30-minute cache at 1.25x is cheaper.

Key takeaways

  • On GPT-5.6 and later, the Responses API takes prompt_cache_options.ttl of 30m (default) or 12h; a 12-hour write costs 2.5x the input rate, a 30-minute write 1.25x.
  • Reads cost 0.1x input on either lifetime, or 0.05x on GPT-6.1 Sol and GPT-6.1 Terra, so a 12-hour entry pays for itself from its second read.
  • The 12-hour option is for context reused hours apart; when requests arrive every few minutes the 30-minute cache is cheaper.
  • Measure with cached_tokens, cache_write_tokens and the ttl_12h_tokens breakdown in the response usage, not with prompt token counts.
  • A 12-hour lifetime is a minimum for read pricing, not a promise of a hit on every request and not a deletion deadline.

OpenAI's 12-hour prompt cache pays off when a prefix is read at least twice inside 12 hours by requests spaced too far apart for the default 30-minute cache. A write to it costs 2.5 times the input rate and a read 0.1 times (0.05 on GPT-6.1 Sol and Terra), so the first read nearly covers the premium and the second puts you ahead1. OpenAI added it to the Responses API on 20 October 2026, describing it as a way to keep "shared instructions, tools, and context cached longer"2.

The rest of this guide is the arithmetic, the request shape, the comparison with Anthropic and Gemini, and how to confirm in production that you are paying for reads rather than writes.

What OpenAI changed

On GPT-5.6 and later models, prompt caching on the Responses API has two lifetimes, set with prompt_cache_options.ttl: "30m", the default, and "12h". Each can be overridden on an individual cache breakpoint with prompt_cache_breakpoint.ttl. These settings are separate from prompt_cache_retention, the older control that earlier models use1.

30-minute (default)12-hour
Settingttl: "30m"ttl: "12h"
Write price1.25x input2.5x input
Read price0.1x input; 0.05x on GPT-6.1 Sol and TerraSame
Minimum lifetime for read pricing30 minutes12 hours
Minimum prefix1,024 visible input tokensSame
Prompt cache lifetimes on GPT-5.6 and later, from OpenAI's prompt caching guide and pricing page, read 2026-10-27.

Three details in the guide shape how you use it1:

  • The lifetime is a minimum, not a contract for hits. "Minimum lifetime" is how long an entry is guaranteed to qualify for read pricing. OpenAI may keep entries longer, and the guide says the minimum does not guarantee that every request reuses stored tensors.
  • Write pricing replaces input pricing. A written token is billed at 1.25x or 2.5x instead of the input rate, not in addition to it.
  • Reads do not restart the 12-hour clock. The guide describes a 30-minute read of an entry with 12-hour coverage as moving expiry to the later of the existing expiry and 30 minutes after the read, with no new write charge. Plan for one 12-hour write per 12 hours of reuse.

For models before GPT-5.6 nothing changed: prompt_cache_retention still takes in_memory or 24h on the models that support it, and those models carry no separate cache-write charge1. The pricing page lists cache-write rates only for the GPT-5.6 and GPT-6 models3.

Break-even arithmetic

Call the write multiplier w, the read multiplier r, and the number of reads one write serves N. Without caching, one write plus N reads would cost (1 + N) units of input. With caching they cost w + rN. Caching is cheaper once N > (w − 1) / (1 − r).

CacheWrite wRead rBreak-even readsPays from
OpenAI 30-minute1.250.10.28The first read
OpenAI 12-hour2.50.11.67The second read
OpenAI 12-hour, GPT-6.1 Sol or Terra2.50.051.58The second read
Anthropic 5-minute1.250.10.28The first read
Anthropic 1-hour20.11.11The second read
Anthropic 1-hour, Opus 5.5 or Sonnet 5.520.051.05The second read
Break-even reads per write, from each provider's published multipliers, read 2026-10-27. Anthropic figures from its prompt caching guide.

The formula ignores output tokens, which are billed the same either way, and assumes every read finds the entry. The second assumption is the one that fails in practice, and it is where the choice of lifetime matters.

Why the 30-minute default can lose for sparse traffic

The 30-minute write pays from the first read, but only if a read arrives while the entry is alive. Traffic that reuses a prefix every two hours, such as a scheduled summary job, a support desk overnight, or an agent a developer resumes after lunch, can find the entry gone. In the worst case every request pays the 1.25x write and never reads, which costs more than no caching at all. That is the gap the 12-hour lifetime fills.

How to enable it

Prompt caching is on by default for supported models. In OpenAI's implicit mode the platform places one breakpoint at the end of the latest eligible message; in explicit mode you place every breakpoint, and a request with none creates no cache writes. A request can create up to four cache writes, and in implicit mode the automatic breakpoint uses one of them1.

To put a whole request on the 12-hour lifetime, set the request-level option:

responses-12h.json
{
  "model": "gpt-6.1-sol",
  "prompt_cache_options": { "ttl": "12h" },
  "input": [
    { "role": "developer", "content": [{ "type": "input_text", "text": "<shared policy, tools and examples>" }] },
    { "role": "user", "content": [{ "type": "input_text", "text": "Summarize ticket 4812." }] }
  ]
}

To keep only the long-lived part on 12 hours and the session on 30 minutes, OpenAI's guide shows explicit mode with a different lifetime per breakpoint: a request-level "prompt_cache_options": {"mode": "explicit", "ttl": "30m"}, a "prompt_cache_breakpoint": {"mode": "explicit", "ttl": "12h"} on the shared developer instructions, and a breakpoint with no ttl (so 30 minutes) on the session context1. Two placement rules from the guide: top-level instructions cannot hold an explicit breakpoint, so put reusable instructions in an input_text block of a developer message; and the cached prefix must be byte-identical, so keep timestamps, request ids and per-user data after the last breakpoint.

On GPT-5.6 and later, prompt_cache_key is optional and routing is automatic; keys are useful to keep cache accounting separate per customer and to prevent cache-hit probing across users1.

How the alternatives compare

Anthropic. Claude's cache has a 5-minute default and a 1-hour option set with "ttl": "1h" on cache_control. Writes cost 1.25x and 2x the input rate; reads 0.1x, or 0.05x on Opus 5.5 and Sonnet 5.5 and 0.025x on Fable 5.1. Each read refreshes the lifetime at no charge, and a top-level cache_control turns on automatic breakpoint placement4. For steady traffic a 1-hour Anthropic entry that is read at least once an hour can live all day on a single write. Anthropic loses to OpenAI's 12-hour option when gaps between reads exceed an hour; OpenAI's option loses when reads are frequent, because Anthropic's refresh keeps one cheaper write alive indefinitely.

Gemini. Implicit caching is on by default for Gemini 2.5 and later, with a 4,096-token minimum on Gemini 4 Argon, 3.8 Flash and 3.6 Flash5. Explicit caches on generateContent take any TTL ("no minimum or maximum bounds"), default to one hour, and bill storage for as long as the tokens persist; they are not available for Gemini 4 Argon and later, which use implicit caching only6. Gemini 3.8 Flash lists $0.75 input, $0.075 cached and $0.50 per million tokens per hour of storage through 31 December 2026, doubling on 1 January 20277. Twelve hours of storage is $6.00 per million tokens held, so at those rates an explicit cache needs roughly nine reads in the window before it beats sending the prefix uncached. Storage pricing favours short TTLs with dense traffic; OpenAI's 12-hour write favours sparse traffic.

OpenAI 12-hourAnthropic 1-hourGemini explicit
Cost to keep a prefixOne 2.5x write per 12 hoursOne 2x write, refreshed by readsStorage per token-hour
Loses whenReads are minutes apartReads are more than an hour apartReads are few compared with hours stored
Controlprompt_cache_options or per breakpointcache_control with ttlCache object with a TTL or expiry time
Long-lived prompt caches compared, from each provider's documentation read 2026-10-27.

Measure it

Do not judge caching from prompt token counts. OpenAI's usage object separates what you paid for1:

  • usage.input_tokens_details.cached_tokens: billed cache reads; it excludes tokens charged as writes.
  • usage.input_tokens_details.cache_write_tokens: tokens written in this request.
  • cache_write_tokens_details.ttl_30m_tokens and ttl_12h_tokens: the split of those writes by lifetime; they do not overlap and sum to cache_write_tokens.

The healthy pattern for a 12-hour prefix is one request with ttl_12h_tokens near the prefix length, then reads on later requests. Track per workload, per day: write tokens, read tokens, and reads per write. If reads per write falls below two, the 12-hour option is costing you money; if ttl_12h_tokens appears on many requests in the same window, the prefix is changing between them.

On data handling, OpenAI states that prompt caching is compatible with Zero Data Retention, that the cache holds encrypted key-value tensors rather than prompt text with a maximum retention of 24 hours, that the 12-hour setting is not a deletion deadline, and that caches are not shared across organizations or regional processing boundaries1.

Checking cache behaviour through INFRO

INFRO is a control plane in front of the provider accounts you connect; OpenAI bills you directly for every token, cached or not, and INFRO's charge is a separate subscription.

The option reaches OpenAI. On an OpenAI connection, INFRO's POST /v1/responses sends the body as you wrote it, so prompt_cache_options and per-breakpoint settings reach OpenAI unchanged. A request INFRO has to translate for a Chat Completions target cannot carry them. See coding agents.

Reads are visible per request. Each request row and response carries the provider's cached token count (prompt_tokens_details.cached_tokens on chat, input_tokens_details.cached_tokens on Responses), and usage analytics group requests and estimated provider cost by model, key and project. Traffic changes raise a finding when the cached share of prompt tokens on a model drops by 10 percentage points or more, the usual sign that a prefix stopped matching.

What INFRO does not do yet. INFRO's estimate does not price OpenAI cache writes separately: written tokens are estimated at the ordinary input rate, so a 12-hour write, billed at 2.5x, is under-estimated in INFRO's figures. Use OpenAI's own usage fields above, or reconciliation against your provider's cost report, for the true write cost. INFRO's own response cache is a different feature: a hit there never reaches your provider at all.

Questions readers ask

How do I turn on OpenAI's 12-hour prompt cache?
On the Responses API with a GPT-5.6 or later model, set prompt_cache_options.ttl to "12h" for the request, or set ttl "12h" on a single prompt_cache_breakpoint inside an input content block. The default lifetime is "30m". OpenAI documents the option for the Responses API; its guide does not describe it for Chat Completions.
How much does a 12-hour cache write cost?
2.5 times the model's input rate, against 1.25 times for a 30-minute write. Reads cost 0.1 times the input rate on either lifetime, or 0.05 times on GPT-6.1 Sol and GPT-6.1 Terra. The write price replaces the input price for the tokens written; it is not an extra fee on top.
When is the 12-hour cache worth it?
When the same prefix of at least 1,024 tokens is read at least twice within 12 hours and the requests are far enough apart that a 30-minute entry would have expired. For requests a few minutes apart, the 30-minute cache costs less per write and is refreshed by its reads.
How do I know the 12-hour cache is working?
Read the response usage: input_tokens_details.cached_tokens counts billed cache reads, cache_write_tokens counts tokens written, and cache_write_tokens_details splits writes into ttl_30m_tokens and ttl_12h_tokens. One ttl_12h write followed by cached reads on later requests is the pattern you want.
Does a 12-hour cache keep my prompt for 12 hours?
OpenAI says the cache stores encrypted key-value tensors, not prompt text, with a maximum retention of 24 hours, and that the 12h setting does not set a deletion deadline or change the data-retention policy. Prompt caching is compatible with Zero Data Retention, and caches are not shared across organizations.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • Usage and cost per request

    Available with a plan

    Every request records its model, latency, token or unit counts, and estimated provider cost, queryable by project and key.

    Read the documentation for Usage and cost per request
  • Traffic changes

    Available with a plan

    Changes in your traffic that come with no error: a model answered by a new snapshot, longer answers, a lost prompt cache, more fallbacks, answers cut off by the length limit, slower responses or a new error mix. Each finding names the likely cause and the estimated weekly change in provider cost. INFRO sees request metadata, not answers, so it does not judge answer quality.

    Read the documentation for Traffic changes
  • Provider cost reconciliation

    Available with a plan

    Daily comparison of estimated spend against the cost reported by OpenAI's and Anthropic's own cost APIs, using a separate admin credential, with the likely cause of a persistent gap and a suggested rate you can apply. Included on every plan.

    Read the documentation for Provider cost reconciliation
  • Claude Code and Codex through INFRO

    Available with a plan

    Point Claude Code, the Claude Agent SDK, Codex or the OpenAI Agents SDK at INFRO by changing the base URL and the key. Anthropic's Messages API and OpenAI's Responses API, with routing, budgets refused before the call, guardrails and the request log applied as on every other request.

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.Prompt caching (opens in a new tab) — OpenAI. Accessed Oct 27, 2026.
  2. 2.Changelog (opens in a new tab) — OpenAI. Accessed Oct 27, 2026.
  3. 3.Pricing (opens in a new tab) — OpenAI. Accessed Oct 27, 2026.
  4. 4.Prompt caching (opens in a new tab) — Anthropic. Accessed Oct 27, 2026.
  5. 5.Context caching (opens in a new tab) — Google. Accessed Oct 27, 2026.
  6. 6.Context caching (generateContent) (opens in a new tab) — Google. Accessed Oct 27, 2026.
  7. 7.Gemini Developer API pricing (opens in a new tab) — Google. Accessed Oct 27, 2026.

About this article

Lifetimes, parameters, multipliers, usage fields and data-handling notes were read on 2026-10-27 from OpenAI's prompt caching guide, changelog and pricing page; Anthropic's prompt caching guide; and Google's Gemini caching, explicit caching and pricing pages. The break-even formula and the request costs in the examples are illustrative arithmetic at list rates, not measurements. INFRO behaviour is described from its documentation and checked against the `/v1/responses` ingress and the OpenAI Responses usage reader in the gateway source.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.