Skip to content
AI Primer
release

OpenAI extends API prompt caching to 12 hours

OpenAI adds 12-hour API prompt caching that can be mixed with the 30-minute default in one request. It also announces permanent cache reuse for logged-in Codex and Work users.

5 min read
OpenAI extends API prompt caching to 12 hours
OpenAI extends API prompt caching to 12 hours

TL;DR

  • API requests can now mix 12-hour caching for shared instructions with the 30-minute default for newer context, according to OpenAIDevs' announcement.
  • Longer caching doubles the write rate: the linked caching guide lists 2.5× ordinary input pricing for 12h versus 1.25× for 30m. Read rates stay unchanged.
  • Logged-in Codex and Work users get cached-context reuse on older conversations, as a community recap notes; a separate announcement promises that reuse “forever.”

A later 12-hour breakpoint can pull the entire earlier prefix into the higher write rate. Upgrading a live 30-minute entry charges a fresh write with no credit, and “12h” sets a minimum lifetime rather than a deletion deadline.

12h and 30m in one request

Per-prefix TTLs are the best part of OpenAI's October 20 API update. The option is available in the Responses API on GPT-5.6 and later models.

The documented request structure separates shared material, session context, and the current question:

The session breakpoint inherits the request's 30m setting. Explicit-only mode leaves the current question after the last breakpoint, so those tokens incur ordinary input pricing without a cache-write charge; the placeholder prefixes still need enough real content to qualify for caching.

Cache write pricing

Cache-write rates replace ordinary input pricing rather than adding a surcharge, under OpenAI's pricing rules.

| Lifetime | Write rate | Read rate on most eligible models |
| --- | --- | --- |
| 30m, the default | 1.25× uncached input | 0.1× uncached input |
| 12h | 2.5× uncached input | 0.1× uncached input |

GPT-6.1 Sol reads cost 0.05× ordinary input with either lifetime.

At the 0.1× read rate, three uses of an identical prefix within 12 hours cost 2.7× that prefix's ordinary input price: one write plus two reads. If each request instead arrives after its 30-minute coverage has completely expired, three default writes cost 3.75×.

With only two uses under those assumptions, the totals reverse: 2.6× for the long-lived cache versus 2.5× for two short-lived writes. Those calculations exclude new input and generated output.

Overlapping breakpoints

Each breakpoint covers the entire prefix before it. Within a request, each token is billed once at the longest selected lifetime covering it, according to the cache-lifetime rules.

For a cold cache, OpenAI gives two examples:

  • 12h at 2,000 tokens, then 30m at 5,000: 2,000 tokens receive 12-hour writes; the remaining 3,000 receive 30-minute writes.
  • 30m at 2,000 tokens, then 12h at 5,000: all 5,000 tokens receive 12-hour writes. The later write also gives the earlier selected breakpoint 12-hour coverage.

Lifetime changes have separate billing and refresh behavior:

  • Upgrade from 30m to 12h: covered tokens incur a new 12-hour write without credit for the earlier write. Tokens already covered by a valid 12-hour entry remain reads.
  • Read using 30m: coverage extends to at least 30 minutes after the read. Existing longer coverage is preserved, but the read does not restart a 12-hour clock or trigger another write charge.

Codex and Work cache forever

Logged-in Codex and Work users received an open-ended promise: “we keep cache forever,” with guaranteed cache hits when returning to old conversations or resuming after hours away.

OpenAI could absorb the pricing difference when an old session resumes, kunchenguid speculated. A physical cache miss could still receive cached pricing, the commenter explained in a follow-up.

For the API, OpenAI's documentation explicitly says the minimum lifetime governs eligibility for cache-read pricing. It does not guarantee that every request reuses stored KV tensors or has lower latency.

Prefix matching and cache boundaries

Cache reuse requires the full rendered prefix to match, including model-provided instructions and relevant request settings, according to OpenAI's prefix-matching documentation.

The implementation has several concrete boundaries:

  • Minimum length: GPT-5.6 and later require 1,024 visible input tokens. Hidden OpenAI system content does not count toward that threshold.
  • Write slots: each request can create up to four cache writes. Keeping the implicit breakpoint uses one slot, leaving three for explicit writes.
  • Placement: explicit breakpoints attach to supported content blocks. Top-level instructions cannot contain one; the documented alternative places reusable instructions in an input_text block inside a developer message.
  • Prefix changes: tool definitions and ordering, Structured Outputs schemas, reasoning effort, verbosity, and compaction can change the rendered prefix and prevent reuse from the first changed token onward.
  • Reasoning updates: supported GPT-6 models accept an appended configuration_update item that changes reasoning effort while preserving the earlier prefix, unlike changing the request-level reasoning.effort setting.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 2 threads
TL;DR1 post
Codex and Work cache forever2 posts
Share on X