cd /news/ai-agents/openai-12-hour-prompt-cache-is-live-… · home › topics › ai-agents › article
[ARTICLE · art-156614] src=byteiota.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

OpenAI 12-Hour Prompt Cache Is Live: What Agent Developers Must Do Now

OpenAI shipped a 12-hour prompt cache TTL option in its Responses API on October 20, Day 16 of a 28-day improvement sprint, adding a `prompt_cache_options.ttl: "12h"` parameter that keeps system prompts and tool definitions warm across multi-hour gaps in agent workflows. Writing a 12-hour cache entry costs 2.5x the input rate versus 1.25x for the default 30-minute TTL, so developers need one write plus three reads within the window before the option beats sending the prefix uncached; OpenAI's example of a 20,000-token prefix used hourly for 12 hours on GPT-6.1 Sol drops from $0.48 uncached to about $0.12 with the 12-hour TTL, a 75% reduction. OpenAI also announced that logged-in Codex and ChatGPT Work users get permanent cache retention with no expiry, a product-level change outside the API.

read4 min views1 publishedOct 24, 2026
OpenAI 12-Hour Prompt Cache Is Live: What Agent Developers Must Do Now
Image: Byteiota (auto-discovered)

OpenAI shipped 12-hour prompt caching in its Responses API on October 20 — Day 16 of the company’s ongoing 28-day improvement sprint. The change adds a single parameter, prompt_cache_options.ttl: "12h", that keeps your system prompt and tool definitions warm across the multi-hour gaps that routinely break daily agent workflows. If you’re building persistent agents on GPT-5.6 or later, this is the cost optimization you’ve been waiting for. The catch: the pricing math punishes you if you apply it in the wrong places, and most developers will.

What Changed #

OpenAI’s Responses API has offered prompt caching since last year, defaulting to a 30-minute TTL. Cached prefix reads come in at 0.1x the normal input rate — a 90% discount — but a prefix that hasn’t been hit within 30 minutes goes cold. For agents that check in every few hours, that meant paying full input price every single time.

The new "12h" TTL option extends the warm window to 12 hours. Set it in the prompt_cache_options block at the message or breakpoint level, and OpenAI keeps that prefix cached for up to 12 hours after the last write. You can also mix TTLs within a single request: cache the system prompt at 12 hours and let the recent conversation window ride the 30-minute default.

Separately, OpenAI announced that logged-in Codex and ChatGPT Work users now get permanent cache retention — no expiry at all. Resume a task from yesterday and you’re guaranteed a cache hit. That’s a product-level change outside the API; API developers still work within the TTL options described here.

The Pricing Math You Need to Know Before Touching It #

The 12-hour option is not free to deploy. Here’s where developers get burned:

Option Write cost Read cost
No caching 1.0x input rate 1.0x input rate
30-minute (default) 1.25x input rate 0.1x input rate
12-hour 2.5x input rate 0.1x input rate

Writing a 12-hour cache entry costs twice as much as the 30-minute write. You need four total uses within the 12-hour window — one write plus three reads — before the 12-hour option becomes cheaper than sending the prefix uncached each time. If your agent only hits that context twice in a workday, you’ve paid more, not less.

The payoff is real when the usage pattern fits. Consider a 20,000-token prefix used once per hour for 12 hours on GPT-6.1 Sol: sending it uncached each time costs $0.48. With the 30-minute TTL, the cache expires between hourly calls so you write it fresh every time — that’s $0.60, actually worse. With 12-hour TTL, you write once and read eleven times, landing at about $0.12. That’s a 75% reduction. Same context, very different costs depending on access pattern.

When to Use 12h and When to Stay at 30m #

The decision is straightforward once you frame it correctly: use 12-hour caching when the gap between reuses is consistently greater than 30 minutes but less than 12 hours. That describes daily agent workflows — morning standup, midday check-in, end-of-day review. It does not describe a chatbot responding every few seconds or an agent processing a burst of requests in a tight loop.

Use 12-hour TTL for: persistent coding agents that for hours mid-task, background worker agents operating on an hourly schedule, and document analysis agents that reference the same large context throughout a workday. Stay with the default 30-minute TTL for: customer-facing chatbots with rapid back-to-back turns, agents making multiple API calls in quick succession, and any scenario where the context itself changes frequently.

Structure Your Prompt Correctly or the Cache Won’t Hit #

The cache only activates when the prefix is at least 1,024 tokens. Short system prompts won’t benefit. More importantly, anything that changes between calls must go at the end of your prompt. If a timestamp, user ID, or dynamic value appears inside your cached prefix, the prefix won’t match and you get a cold miss every time.

The correct structure: system instructions at the top, tool definitions and schemas next, static reference documents and few-shot examples after that — and only then the dynamic content (current task, conversation history, per-user values). Keep tool definition ordering stable across requests; use allowed_tools to filter what’s callable rather than removing tool definitions from the block.

To verify cache hits are actually occurring, check usage.prompt_tokens_details.cached_tokens in the response. A non-zero value confirms a cache hit. Cache hits land in 128-token increments starting at 1,024. If that field is consistently zero on a long prompt, your dynamic content is likely contaminating the prefix.

The Practical Takeaway #

The 30-minute TTL was designed for sessions, not for the hour-long gaps that define how developers actually use always-on agents. The 12-hour option fills that gap without requiring architectural changes — just a parameter addition and a prompt reorganization. Apply it to the stable, high-token prefix at the top of your agent context. Don’t apply it universally. Audit your cache hit rate with cached_tokens before and after the change. If you’re building on GPT-5.6 or later with agents that check in throughout the day, this one update should noticeably reduce your API spend.

For the full technical reference, see the OpenAI API changelog and the DEV Community breakdown of the TTL options and pricing examples.

── more in #ai-agents 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/openai-12-hour-promp…] indexed:0 read:4min 2026-10-24 · —