Skip to content
Payment & usagePrompt caching

Prompt caching

Automatic caching, explicit Claude markers and discount calculation order.

Model protocol

Caching and its billing apply with and without a server prompt. Confirmed Claude cache reads cost 10 times less than regular input, and Fable 5.1 reads cost 40 times less. The 25% discount, when eligible, applies after cache pricing. A cache hit is not guaranteed.

ModelRegular input / 1M5m write / 1M1h write / 1MRead / 1M
claude-haiku-4-5$1.00$1.25$2.00$0.10
claude-sonnet-5$3.00$3.75$6.00$0.30
claude-opus-5$5.00$6.25$10.00$0.50
claude-opus-4-8$5.00$6.25$10.00$0.50
claude-fable-5 (without a server prompt)$10.00$12.50$20.00$1.00
claude-fable-5-1 (without a server prompt)$10.00$12.50$20.00$0.25

Regular uncached input costs 1×. A standard 5-minute cache write is billed at 1.25× input, an explicit 1-hour write at 2×, and a later cache read at 0.1×, or 0.025× for Fable 5.1. Fable 5 rates and historical charges stay unchanged. A warm-up request can therefore cost more than regular input, while savings appear on subsequent matching requests.

How a hit happens

  • Caching uses the stable request prefix: tool definitions, system text and the beginning of message history.
  • A hit means this beginning matched a recent request byte-for-byte. Changing even the first character resets the match entirely.
  • The cache lives for a few minutes and is refreshed on every hit.
  • The first sufficiently large cacheable request of a new session usually "warms up" the cache, so a hit can begin on the second request. A hit is not guaranteed every time; that's normal.

Getting the most out of it

  1. Stable beginning. Keep the system prompt and instructions identical between requests — no on-the-fly edits.
  2. No variables at the start. Timestamps, random ids, user names — put them at the END of the prompt: a changed first byte kills the whole prefix match.
  3. Append-only conversation. Add new messages to the end of the history; don't edit or reshuffle old ones.
  4. Stable tools. The same set and order of functions on every request — tool definitions are part of the prefix too.
  5. Large documents go into system once. Put knowledge bases and code at the start; changing questions at the end.
  6. Keep the pace. A follow-up within a few minutes hits the cache; after a long pause the first request warms it up again.

Explicit cache_control in Messages

Claude /v1/messages and /v1/messages/count_tokens support cache_control: top-level automatic caching and explicit markers in eligible system/content blocks and client-tool definitions. The default TTL is 5 minutes; use "ttl": "1h" for an hour. usage.cache_creation separates 5m/1h writes.

How to verify

  • The "Prompt cache" strip on the dashboard — total savings so far.
  • The "cache" column in the "Recent requests" log — per-request hits.
  • In the API response: usage.cache_read_input_tokens (Anthropic) or usage.prompt_tokens_details.cached_tokens (OpenAI).
json
{
  "usage": {
    "input_tokens": 9900,
    "cache_read_input_tokens": 27451,
    "output_tokens": 56
  }
}
DashboardThe "Prompt cache" strip — your savings are already being countedBillingRates and the charging formula

Kimi, Composer and Grok

  • Kimi. Cache reads are billed at a separate lower rate; live rates and a spend breakdown are on Kimi · Pricing, reserve and usage. The prompt_cache_key field is accepted and passed to the model as it is.
  • Composer and Grok. A cache_control marker inside a block is accepted and ignored; it does not control caching. Caching is automatic. Accounted reads appear in Messages usage.cache_read_input_tokens and Chat Completions usage.prompt_tokens_details.cached_tokens.
  • Cache writes are free for Composer and Grok. That is not a rounding or an unknown: the cache-creation rate is zero, so cache_creation_input_tokens in the response is always 0.

Documentation sections

On this page