OpenAI 12-Hour Prompt Caching Guide (2026): When the 2.5x Write Fee Pays Off
On October 20, 2026, OpenAI added a line to its API changelog that matters more than most model launches: you can now choose a 12-hour prompt cache in the Responses API. The old default was 30 minutes. That's fine for chat loops and useless for the workload most teams actually run, which is a big, stable prefix hit a few times an hour, all day.
There's a catch, and it's the price. Twelve-hour writes cost 2.5 times the normal input rate. So this isn't a free upgrade. It's a bet on reuse, and below I'll show how to tell whether you should take it.
Key takeaways
- On October 20, 2026, OpenAI added a selectable 12-hour prompt cache lifetime to the Responses API, set with
prompt_cache_options.ttlequal to"12h". - A 12-hour cache write costs 2.5 times the uncached input price, which is $5.00 per million input tokens on GPT-6.1 Sol versus $2.00 uncached.
- Cache reads on GPT-6.1 Sol cost $0.10 per million tokens (0.05 times the input price) whether the entry was written with a 30-minute or a 12-hour lifetime.
- A 12-hour write pays for itself on the third request that uses the prefix, while a 30-minute write pays off on the second.
- Claude Sonnet 5.5 offers 5-minute and 1-hour cache writes at $2.50 and $4.00 per million tokens, reads at $0.10 per million, and lists no cache duration longer than one hour.
What OpenAI Changed on October 20, 2026
According to the changelog entry and the updated prompt caching guide, models from GPT-5.6 onward now accept prompt_cache_options.ttl with two values: "30m" (the default) and "12h". It's Responses API only. The older prompt_cache_retention parameter for earlier models is untouched.
You can set the TTL for the whole request, or override it on a single explicit breakpoint with prompt_cache_breakpoint.ttl. Read pricing doesn't change with the lifetime. OpenAI also says it may keep entries longer than the minimum you ask for, and that "12h" is not a deletion deadline and doesn't change data-retention policy.
Cache Pricing: GPT-6.1 Sol vs Claude Sonnet 5.5 vs DeepSeek-V4.1 Flash
All prices are USD per 1 million tokens at standard rates, from vendor documentation checked on October 22, 2026.
| Model | Input | Cached input (read) | Cache write | Output | Context window |
|---|---|---|---|---|---|
| GPT-6.1 Sol | $2.00 | $0.10 | $2.50 (30 min) or $5.00 (12 hours) | $10.00 | 1,050,000 tokens |
| Claude Sonnet 5.5 | $2.00 | $0.10 | $2.50 (5 min) or $4.00 (1 hour) | $10.00 | 1,000,000 tokens |
| DeepSeek-V4.1 Flash (off-peak) | $0.15 | $0.003 | No separate write rate listed | $0.60 | 1,000,000 tokens |
Two footnotes. GPT-6.1 Sol prompts above 272,000 input tokens are billed at 2x the input and cache rates and 1.5x output for the full request. DeepSeek's peak hours (01:00-04:00 and 06:00-10:00 UTC, Monday to Friday, excluding Chinese holidays) charge double the off-peak figures shown. Sources: OpenAI, Anthropic, DeepSeek.
When the 2.5x Write Fee Actually Pays Off
Think of it as a premium you recover. A 12-hour write on GPT-6.1 Sol costs 2.5x, so you pay a 1.5x premium over just sending the tokens uncached. Each later read costs 0.05x, which saves you 0.95x. One read recovers 0.95x, not enough. Two reads recover 1.9x, and you're ahead. A 30-minute write carries only a 0.25x premium, so it pays off on the first read.
Now a concrete case. Say you run an internal support bot with a 50,000-token knowledge-base prefix. Uncached, that prefix costs $0.10 per request at $2.00 per million. Traffic is light: 12 requests spread over nine hours, roughly one every 45 minutes. Assume the worst case, where each 30-minute entry has expired before the next request arrives.
| Strategy (12 requests, 50,000-token prefix) | Prefix cost |
|---|---|
| No caching | $1.20 |
| 30-minute writes, expiring between requests | $1.50 |
| One 12-hour write plus 11 reads | $0.305 |
Yes, the default 30-minute cache can cost 25% more than no caching when gaps are long. OpenAI may keep entries longer than the minimum, so real bills could land better, but you can't budget on "may". Push volume up to 100 requests inside the 12-hour window and the same prefix costs $0.745 against $10.00 uncached.
My rule: if gaps regularly exceed 30 minutes and you'll reuse a prefix at least three times in 12 hours, use "12h". If requests land every few minutes, stay on "30m". Otherwise you're paying double the write fee for nothing.
Turning It On: curl, Python, and Node.js
The cleanest pattern is explicit mode. Put the stable material first with a 12-hour breakpoint, then the changing question after it. In explicit-only mode, content after the last breakpoint is billed at the plain input rate with no write charge. Reusable instructions must sit in an input_text block inside a developer message, because top-level instructions can't carry a breakpoint.
curl https://api.openai.com/v1/responses \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"prompt_cache_options": {"mode": "explicit", "ttl": "30m"},
"input": [
{"role": "developer", "content": [{
"type": "input_text",
"text": "YOUR_50K_TOKEN_KNOWLEDGE_BASE_TEXT",
"prompt_cache_breakpoint": {"mode": "explicit", "ttl": "12h"}
}]},
{"role": "user", "content": [
{"type": "input_text", "text": "Customer question goes here."}
]}
]
}'
In Python, pass the options through extra_body if your SDK version doesn't type them yet, and log the usage fields so you can see what you were billed for:
from openai import OpenAI
client = OpenAI()
KB = open("support_kb_v7.md").read()
def ask(question: str) -> str:
resp = client.responses.create(
model="gpt-6.1-sol",
input=[
{"role": "developer", "content": [{
"type": "input_text", "text": KB,
"prompt_cache_breakpoint": {"mode": "explicit", "ttl": "12h"},
}]},
{"role": "user", "content": [{"type": "input_text", "text": question}]},
],
extra_body={"prompt_cache_options": {"mode": "explicit", "ttl": "30m"}},
)
d = resp.usage.input_tokens_details
written = getattr(d, "cache_write_tokens", 0)
fresh = resp.usage.input_tokens - d.cached_tokens - written
# $2.00 fresh, $0.10 read, $5.00 for 12-hour writes, per 1M tokens
cost = (fresh * 2.00 + d.cached_tokens * 0.10 + written * 5.00) / 1e6
print(f"cached={d.cached_tokens} written={written} input_cost=${cost:.4f}")
return resp.output_text
import OpenAI from "openai";
import { readFileSync } from "node:fs";
const client = new OpenAI();
const KB = readFileSync("support_kb_v7.md", "utf8");
export async function ask(question) {
const resp = await client.responses.create({
model: "gpt-6.1-sol",
prompt_cache_options: { mode: "explicit", ttl: "30m" },
input: [
{ role: "developer", content: [{ type: "input_text", text: KB,
prompt_cache_breakpoint: { mode: "explicit", ttl: "12h" } }] },
{ role: "user", content: [{ type: "input_text", text: question }] },
],
});
const d = resp.usage.input_tokens_details;
console.log({ cached: d.cached_tokens, written: d.cache_write_tokens });
return resp.output_text;
}
How It Compares to Claude and DeepSeek
| Option | Context window | Cache write / read | Best for | Key limitation |
|---|---|---|---|---|
| GPT-6.1 Sol | 1,050,000 tokens | Write 1.25x (30 min) or 2.5x (12 hours); read 0.05x ($0.10 per 1M) | Stable prefixes reused with gaps from 30 minutes to 12 hours | 12-hour writes cost $5.00 per 1M; prompts over 272K input tokens are billed at 2x |
| Claude Sonnet 5.5 | 1,000,000 tokens | Write 1.25x (5 min) or 2x (1 hour); read 0.05x ($0.10 per 1M) | Agent loops and chat traffic that stays inside each hour | Longest listed cache duration is 1 hour |
| DeepSeek-V4.1 Flash | 1,000,000 tokens | No separate write rate listed; cache hit $0.003 per 1M off-peak | High-volume work where the lowest list price wins | Peak-hour rates are double the off-peak figures |
Read prices are identical at $0.10 per million, so the decision is about writes and gaps. If your traffic arrives inside the hour, Claude's 1-hour write at $4.00 is cheaper than OpenAI's $5.00. OpenAI wins when gaps run to hours, since Anthropic's pricing page lists nothing past one hour. DeepSeek is a different game entirely: $0.003 per million cached tokens is close to free, but that's a different model with different quality tradeoffs.
Pitfalls That Quietly Eat the Savings
- An unstable prefix. One timestamp or user ID near the top breaks the match. Anything that changes goes after the last breakpoint.
- Prefixes under 1,024 tokens. That's the minimum cacheable length for GPT-5.6 and later. Smaller prefixes won't cache.
- Too many writes. A request can create up to four cache writes, and the implicit breakpoint uses one of those slots.
- Long-context surcharge. Past 272,000 input tokens on GPT-6.1 Sol, the whole request moves to 2x input and cache rates.
- Not checking usage. If
cache_write_tokensshows up on every call, your prefix is changing or the entry lapsed. Fix that before you celebrate.
Test It Against Your Own Traffic
List prices only get you so far. If you're choosing between GPT-6.1 Sol and Claude Sonnet 5.5 for a cached workload, run the same prefix through both and compare billed usage. KissAPI gives you one OpenAI-compatible endpoint (https://api.kissapi.ai/v1) for GPT and Claude models, which makes that A/B cheap to set up. Whatever gateway you use, confirm the response still reports cached_tokens and cache_write_tokens before you trust a savings number. Count your prefix with the token counter first, then model the spend in the API cost calculator.
FAQ
How do I enable 12-hour prompt caching in the OpenAI API?
Set prompt_cache_options.ttl to "12h" in a Responses API request, or set ttl to "12h" on an individual prompt_cache_breakpoint. The default stays "30m", and unsupported values return a 400 invalid_request_error.
How much does 12-hour prompt caching cost?
A 12-hour cache write costs 2.5 times the uncached input price, which is $5.00 per million tokens on GPT-6.1 Sol. Cache reads cost $0.10 per million tokens on GPT-6.1 Sol regardless of the lifetime you picked.
Is 12-hour caching better than Claude's 1-hour cache?
It depends on request gaps. Claude Sonnet 5.5's 1-hour write costs $4.00 per million tokens versus $5.00 for OpenAI's 12-hour write, so Claude is cheaper when requests arrive within the hour. OpenAI's 12-hour option is the only one of the two that covers gaps longer than one hour.
Compare Cached Prompts Across GPT and Claude
Create a free account at api.kissapi.ai/register and run one prefix through both model families with a single OpenAI-compatible key.
Start Free