API Docs
Platform Guides

Caching & TTL

How to request OpenAI 30-minute and 12-hour cache writes and Anthropic 5-minute and 1-hour cache writes, how usage reports them, and what each is billed at.

Prompt caching works exactly as in the official APIs, and the request fields take effect as sent. Cache reads and cache writes are separate price items; cache prices for each model are on its model page under Models & Pricing on the website.

OpenAI

GPT-5.6 and later models

Applies to gpt-5.6-*, gpt-6-* and gpt-6.1-*. Cache writes are priced by lifetime:

LifetimeHow to requestEndpoints
30 minutes (default)Nothing, or prompt_cache_options.ttl: "30m"Chat Completions, Responses
12 hoursprompt_cache_options.ttl: "12h", or prompt_cache_breakpoint.ttl: "12h" on a breakpointResponses only

The cache-read price does not depend on the lifetime chosen at write time.

How usage reports it and how it is billed

Caching usage is in the input details of usage (input_tokens_details for Responses, prompt_tokens_details for Chat Completions):

FieldMeaningBilled at
cached_tokensCache readsCache-read price
cache_write_tokensTotal cache writesSee below
cache_write_tokens_details.ttl_30m_tokens30-minute writes30-minute write price
cache_write_tokens_details.ttl_12h_tokens12-hour writes12-hour write price
  • When the response includes cache_write_tokens_details, 30-minute and 12-hour writes are billed at their own prices.
  • When the response only reports the cache_write_tokens total, all of it is billed at the 30-minute write price.
  • Only writes the response explicitly marks as 12-hour are billed at the 12-hour price; nothing is inferred.
{
  "usage": {
    "input_tokens": 52000,
    "input_tokens_details": {
      "cached_tokens": 40000,
      "cache_write_tokens": 8000,
      "cache_write_tokens_details": { "ttl_30m_tokens": 3000, "ttl_12h_tokens": 5000 }
    },
    "output_tokens": 900,
    "total_tokens": 52900
  }
}

Here 40,000 tokens are billed as cache reads, 3,000 as 30-minute writes, 5,000 as 12-hour writes and the remaining 4,000 as uncached input. If the response only had "cache_write_tokens": 8000, all 8,000 would be billed as 30-minute writes.

Earlier models

gpt-5.5, gpt-5.4, gpt-5.4-mini and gpt-5.2 have no separate cache-write charge; cache hits are billed at the cache-read price.

gpt-5.5-pro, gpt-5.4-pro and gpt-5.2-pro have no cache-read discount: there is no separate cache-write charge, and all input — including any cached part — is billed at the normal input price. See the gpt-5.5-pro, gpt-5.4-pro and gpt-5.2-pro model pages.

Use the official prompt_cache_retention field to choose how long entries are kept.

Anthropic

Set cache_control on a content block; ttl is "5m" (default) or "1h":

{ "type": "text", "text": "...", "cache_control": { "type": "ephemeral", "ttl": "1h" } }
Usage fieldBilled at
usage.cache_read_input_tokensCache-read price
usage.cache_creation.ephemeral_5m_input_tokens5-minute write price
usage.cache_creation.ephemeral_1h_input_tokens1-hour write price

When the response only has the usage.cache_creation_input_tokens total without the cache_creation breakdown, all of it is billed at the 5-minute write price.

Fast and Standard do not share the cache — see Service Tiers.

How caching interacts with other rules

  • Cache-read and cache-write tokens count toward the long-context input total; in the long-context band, cache items are billed at long-context prices too.
  • On Fast and other tiers, cache items use that tier's prices.
  • A Claude request with inference_geo: "us" also multiplies cache prices by 1.1 — see US-only Inference.