{"slug": "openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now", "title": "OpenAI 12-Hour Prompt Cache Is Live: What Agent Developers Must Do Now", "summary": "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.", "body_md": "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.\n\n## What Changed\n\nOpenAI’s [Responses API](https://developers.openai.com/api/docs/guides/prompt-caching) 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.\n\nThe 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.\n\nSeparately, OpenAI announced that logged-in [Codex](https://developers.openai.com/codex/changelog) 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.\n\n## The Pricing Math You Need to Know Before Touching It\n\nThe 12-hour option is not free to deploy. Here’s where developers get burned:\n\n| Option | Write cost | Read cost | \n|---|---|---|\n| No caching | 1.0x input rate | 1.0x input rate | \n| 30-minute (default) | 1.25x input rate | 0.1x input rate | \n| 12-hour | 2.5x input rate | 0.1x input rate | \n\nWriting 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.\n\nThe 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.\n\n## When to Use 12h and When to Stay at 30m\n\nThe 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.\n\nUse 12-hour TTL for: persistent coding agents that pause 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.\n\n## Structure Your Prompt Correctly or the Cache Won’t Hit\n\nThe 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.\n\nThe 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.\n\nTo 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.\n\n## The Practical Takeaway\n\nThe 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](https://developers.openai.com/cookbook/examples/prompt_caching101). 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.\n\nFor the full technical reference, see the [OpenAI API changelog](https://developers.openai.com/api/docs/changelog) and the [DEV Community breakdown](https://dev.to/piekwerk/openais-12-hour-prompt-cache-is-live-split-your-agent-context-into-two-ttls-522p) of the TTL options and pricing examples.", "url": "https://wpnews.pro/news/openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now", "canonical_source": "https://byteiota.com/openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now/", "published_at": "2026-10-24 07:10:46+00:00", "updated_at": "2026-10-24 07:42:38.452622+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "developer-tools", "ai-infrastructure"], "entities": ["OpenAI", "Responses API", "Codex", "ChatGPT Work", "GPT-5.6", "GPT-6.1 Sol"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now", "markdown": "https://wpnews.pro/news/openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now.md", "text": "https://wpnews.pro/news/openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now.txt", "jsonld": "https://wpnews.pro/news/openai-12-hour-prompt-cache-is-live-what-agent-developers-must-do-now.jsonld"}}