12-hour prompt caching: when it pays for recurring AI agents
OpenAI added a 12-hour prompt cache. Compare it with 30 minutes using a reproducible cost example, then measure real cache hits before changing production.

Başlıklar
Your content agent runs at 9 a.m., again at 1 p.m., and checks for news at 5 p.m. Each run starts with the same instructions, tool definitions, and editorial standards. If that shared prefix is long, repeatedly paying to write it can add up. On October 20, 2026, OpenAI added a 12-hour minimum lifetime option for prompt caching in its API. The useful question is not “Should I turn on 12 hours?” It is how often the exact same context is reused and what each cache write costs.
The official changelog confirms the release. For GPT-5.6 and later in the Responses API, OpenAI's prompt caching guide documents prompt_cache_options.ttl with "30m" as the default or "12h". A 30-minute write costs 1.25 times the uncached input-token rate; a 12-hour write costs 2.5 times that rate. Cache reads receive a model-dependent discount. These are total write rates, not surcharges added to ordinary input billing.
When a longer lifetime may help
Imagine an assistant that receives the same brand guide and tool definitions several times a day, with more than half an hour between runs. On GPT-5.6 and later, a stable visible prefix of at least 1,024 tokens can qualify for caching. Put shared instructions and reference material before the changing user request. If the prefix, model, or request shape changes each time, the cache may not match. Do not pad instructions with useless text just to cross the minimum: those extra tokens cost money and may degrade the workflow.
For a short conversation with requests close together, 30 minutes may be enough. For an agent that wakes up throughout a workday, 12 hours may repay its more expensive initial write. The TTL is a minimum window for cache-read eligibility; OpenAI says it is neither a deletion deadline nor a guarantee of lower latency.
A calculation you can reproduce
Assume a stable 2,000-token prefix, three calls four hours apart, and an illustrative uncached input rate of US$1 per million tokens. This example uses a cache-read rate of 10% of normal input, available on some models; substitute the actual rate for yours. We assume each 30-minute entry has expired by the next call, while one 12-hour write receives two successful reads.
| Requests | 30 minutes | 12 hours |
|---|---|---|
| 1 | US$0.0025 | US$0.0050 |
| 2 | US$0.0050 | US$0.0052 |
| 3 | US$0.0075 | US$0.0054 |
Under those assumptions, the third call makes 12 hours cheaper by US$0.0021 for that prefix. This is not a measured bill or a universal break-even rule. A 30-minute entry might survive longer than its minimum lifetime, changing the result. A different model, read discount, or prefix length changes it too.

prefix_tokens = 2_000
requests = 3
input_usd_per_million = 1.00 # Illustrative price
read_multiplier = 0.10 # Replace with your model's rate
def dollars(token_equivalents):
return token_equivalents * input_usd_per_million / 1_000_000
# Assumes a new 30m write for each request.
cost_30m = dollars(prefix_tokens * requests * 1.25)
# Assumes one 12h write followed by two cache reads.
cost_12h = dollars(prefix_tokens * (2.5 + (requests - 1) * read_multiplier))
print(f"30m: ${cost_30m:.4f}")
print(f"12h: ${cost_12h:.4f}")
We ran the calculation locally and checked the code syntax. It prints US$0.0075 and US$0.0054 for these inputs; we did not make a paid OpenAI API call. For a compatible Responses request, OpenAI documents the setting as "prompt_cache_options": {"ttl": "12h"}. Check the guide for the mode and model you use before deploying it.
Test the real workflow
- Identify the stable prefix. Keep shared instructions and tools constant and put changing material later. Confirm the model's cacheable minimum and matching request structure.
- Run a fair comparison. Try 30 minutes and 12 hours at the times your agent actually runs, without changing the prompt, model, or task mix between groups.
- Read the API usage fields. Record
cached_tokens,cache_write_tokens, the per-TTL write breakdown where available, latency, and cost using current pricing. Do not add write tokens twice; they are already included in total input tokens. - Check privacy and support. A cache lifetime does not by itself define the maximum data-retention policy. Verify your data requirements and that your model supports this option.
The practical decision: if your agent reuses a sizable context throughout the day, measure the third and fourth use before adopting 12 hours. If every call changes the prefix or it falls below the minimum, improve the prompt structure first. Primary source: OpenAI's prompt caching guide; release date: October 20, 2026.