Cost explainer · As of 2026-11-20

Claude Code prompt caching cost: 5 minutes or 1 hour depends on how you pay

As of November 20, 2026, the answer depends on how you are billed: a Claude subscription running inside plan usage asks for the 1-hour cache, while API keys, usage credits and cloud providers default to 5 minutes. On the API-key path you can move the main conversation to an hour by setting promptCacheTtl to 1h (Claude Code v2.1.242 or later), and Anthropic's official multipliers still apply: a 5-minute cache write costs 1.25x the input price, a 1-hour write 2x, and a cache read 0.1x on most models.

Updated 2026-11-20

Prices change: on QCode, Claude, GPT and Chinese models are billed per token — live rates on /models.

#5 minutes vs 1 hour#cache read 0.1x#cache write 1.25x / 2x#promptCacheTtl=1h

Four numbers to remember

5 minutes

Default cache lifetime on the API-key path

API keys, usage credits and cloud providers get 5 minutes per request; a subscription gets 1 hour only inside plan usage, and the main conversation drops back to 5 minutes once you spill into usage credits.

1.25x

5-minute cache write: 1.25x the input price

Writing to the cache costs more than sending the same tokens as plain input, but later hits bill at the cache-read rate; Anthropic's pricing page lists 5-minute writes at 1.25x base input, with the entry valid for 5 minutes.

2x

1-hour cache write: 2x the input price

A 1-hour write bills at 2x base input and keeps the entry warm for an hour. It suits sessions where you step away for minutes to an hour, while on short bursts that never idle past 5 minutes the premium goes unused.

0.025x

Fable 5.2 cache reads cost only 0.025x

Fable 5.2, Mythos 5.2, Fable 5.1 and Mythos 5.1 bill hits at 0.025x the input price, which puts Fable 5.2 at $0.20 per million tokens; Opus 5.5 and Sonnet 5.5 sit at 0.05x, and every other model at 0.1x.

Which requests get 5 minutes and which get an hour

As of November 20, 2026, the docs sort every request into two buckets: the main conversation (interactive turns, non-interactive -p runs, Agent SDK turns, plus the helpers Claude Code runs inline) and everything else (subagents, workflows, in-process teammates, forks, compaction, session titles). Claude Code picks the TTL per request: unless you choose one yourself, only a Claude subscription inside plan usage asks for an hour, while API keys, usage credits and cloud providers get 5 minutes for the main conversation.

On a subscription the rest still gets 5 minutes, apart from the small set of helper requests Anthropic controls server-side, which get one hour; on API keys, usage credits or cloud providers both buckets are 5 minutes. The official sentence reads: Unless you choose a TTL yourself, Claude Code requests the one-hour TTL only on a Claude subscription within your plan's included usage.

That is exactly where community confusion lands, and one developer wrote in a forum: I still don't understand if cache lasts for 5 minutes or one hour.

What changed: TTL controls, a cache panel, and the same write premiums

Three things in the docs as of November 20, 2026 bear directly on this bill.

  1. 1You can pick the TTL yourself: promptCacheTtl or CLAUDE_CODE_PROMPT_CACHE_TTL covers the main conversation, subagentPromptCacheTtl or CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL covers everything else, and all four controls require Claude Code v2.1.242 or later; FORCE_PROMPT_CACHING_5M=1 outranks them all, then the bucket's environment variable, then the bucket's setting.
  2. 2The cache state is visible: since v2.1.251 the Session block in /usage adds a Prompt cache (main) line with the hit share, the miss count, whether the cache is warm and the TTL in force; from v2.1.260 it also names a likely cause for the last miss, such as tool definitions changing.
  3. 3The multipliers are unchanged: 1.25x for a 5-minute write, 2x for a 1-hour write, and 0.025x to 0.1x for reads depending on the model. In community threads dated 2026-11-15 and 2026-11-17, one user worked out that broken caches had made a workflow more expensive, and another was still asking whether the cache lasts 5 minutes or 1 hour. For comparison, OpenAI's gpt-6.2-sol official table splits cache writes into 30m write and 12h write ($2.00 input, $10.00 output, $0.10 cached input, $2.50 for a 30m write, $5.00 for a 12h write), tier names that are not the same as Claude's 5 minutes and 1 hour.

Three dates: two community threads and one official check

2026-11-15

A user posts a breakdown: broken caches made part of a Claude Code workflow more expensive. The thread points at switching models mid-session, editing tool definitions, and the first message after a break longer than the cache lifetime (community reports, not an official conclusion; the amount is not quoted here).

2026-11-17

In another thread a developer writes that they still cannot tell whether the cache lasts 5 minutes or 1 hour. The official docs answer it with a two-row table: a subscription inside plan usage gets 1 hour for the main conversation, while API keys, usage credits and cloud providers get 5 minutes.

2026-11-20

The official rules as of November 20, 2026: subscriptions inside plan usage default to 1 hour, API keys and cloud providers to 5 minutes, changing the TTL requires v2.1.242 or later, and the multipliers remain 1.25x for a 5-minute write, 2x for a 1-hour write and 0.025x and up for a read.

Confirmed billing rules vs community misreadings

Confirmed (Claude Code caching doc and Anthropic's pricing page)

Checkable as of November 20, 2026

  1. 1Defaults: a subscription inside plan usage gets 1 hour for the main conversation and 5 minutes for everything else, apart from the server-controlled helper requests, which get one hour; API keys, usage credits or cloud providers get 5 minutes for both buckets.
  2. 2Multipliers: a 5-minute write is 1.25x base input, a 1-hour write 2x, and a read 0.1x on most models.
  3. 3Per-model hit prices: Fable 5.2 and Mythos 5.2 at 0.025x ($0.20 per million tokens), Fable 5.1 and Mythos 5.1 at 0.025x ($0.25), Opus 5.5 at 0.05x ($0.20), Sonnet 5.5 at 0.05x ($0.10), all other models at 0.1x.
  4. 4Prices on the same row: Fable 5.2 is $8 input and $40 output with a $16 1-hour write; Opus 5.5 is $4 and $20 with an $8 1-hour write; Sonnet 5.5 is $2 and $10 with a $4 1-hour write.
  5. 5Verification: run claude -p "hello" --output-format json, where ephemeral_1h_input_tokens means a 1-hour write and ephemeral_5m_input_tokens means a 5-minute write.
  6. 6Timing and minimums: every hit refreshes the entry at no additional cost, the lifetime runs from the request, and the minimum cacheable prompt is 512 tokens for Fable 5.2, Mythos 5.2, Fable 5.1, Mythos 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5.

Community misreadings and what is still unpublished

  1. 1'An API key can get an hour for nothing.' Not by default: only promptCacheTtl set to 1h does it, and requests outside the main conversation stay at 5 minutes until you set their TTL too.
  2. 2'An hour is always cheaper.' The docs describe the opposite for short bursts that never idle past 5 minutes, where the higher write rate applies and the longer lifetime goes unused.
  3. 3'A cache hit costs nothing.' Hits bill at 0.025x to 0.1x depending on the model, below the standard input rate but not zero.
  4. 4'Changing effort always rebuilds the cache.' On Fable 5.1 and later, Opus 5.5, Sonnet 5.5 and Haiku 5.5 the cache stays intact by default with an API key or a subscription; on most other models each effort level has its own cache.
  5. 5'A subagent reads the parent cache.' Its first request does not, because the prefixes differ; a fork does, since it inherits the parent exactly.
  6. 6No single official answer: how far 1 hour is available on each cloud platform and gateway depends on that platform's docs, and Anthropic's own doc only says it varies by model on Amazon Bedrock.

Keep the default 5 minutes vs set 1 hour for the main conversation

Default 5 minutes: continuous work with gaps under 5 minutes

The 5-minute cache refreshes at no additional cost every time it is used, so as long as your requests stay under 5 minutes apart the entry stays warm and the 1.25x write applies only to new content. This fits a long editing run or back-to-back tool calls; leave for longer than 5 minutes and the first message back reprocesses the whole context.

promptCacheTtl set to 1h: step away and come back

Setting the main conversation to 1h bills writes at 2x and buys an hour of tolerance for idle gaps. The doc's own trade-off sentence: It costs more on short bursts of work that never idle past five minutes, where the higher write rate applies and the longer cache lifetime goes unused. In other words, if you often step away and return, that premium is what buys you the skipped full-context reprocess.

Five steps: read the TTL in force, then decide whether to change it

  1. 1Read the real TTL first: run claude -p "hello" --output-format json and check usage.cache_creation, where ephemeral_1h_input_tokens marks a 1-hour write and ephemeral_5m_input_tokens marks a 5-minute write. Inside a session, /usage shows a Prompt cache (main) line with the hit share, the miss count and the TTL in force while the cache is warm.
  2. 2To get an hour, put "promptCacheTtl": "1h" in settings.json, or set CLAUDE_CODE_PROMPT_CACHE_TTL=1h (v2.1.242 or later); to give both buckets an hour, set ENABLE_PROMPT_CACHING_1H=1. When you reach any gateway through ANTHROPIC_BASE_URL, the official note is that part of the one-hour request travels in the anthropic-beta header, so the gateway must forward it unchanged; after setting it, use step ① to confirm ephemeral_1h_input_tokens appears.
  3. 3When debugging, force both buckets back to 5 minutes with FORCE_PROMPT_CACHING_5M=1 and compare, since it outranks every other control.
  4. 4Stop rebuilding the cache: do not switch models, edit tool definitions or change working directory mid-session, because the cache is effectively scoped to one machine and directory; give subagents a longer TTL with subagentPromptCacheTtl, and note that effort changes keep the cache by default on Fable 5.1 and later, Opus 5.5, Sonnet 5.5 and Haiku 5.5.
  5. 5With QCode, set ANTHROPIC_BASE_URL to https://api.qcode.cc/api and ANTHROPIC_AUTH_TOKEN to your cr_ key, then repeat step ① to confirm the TTL.

Run Claude Code on per-token billing: cache rates are on /models

QCode bills per token. In Claude Code, set ANTHROPIC_BASE_URL to https://api.qcode.cc/api and ANTHROPIC_AUTH_TOKEN to your cr_ key. The Claude Code side of the TTL settings is covered above; behind a custom ANTHROPIC_BASE_URL the cache lives wherever your requests are forwarded, so whether caching works depends on the service you connect to — after setting it up, run claude -p "hello" --output-format json and check ephemeral_5m_input_tokens and ephemeral_1h_input_tokens yourself.

Per-model cache write and cache read rates are listed model by model on qcode.cc/models, and that page is the reference. Not ready for a monthly plan? Pay-as-you-go Packs start at $4 for a one-time quota you use within 7 days; if you already have a Personal Plan, add a booster pack when you need more quota.

Frequently asked questions

Why does the same model cache for only 5 minutes on an API key?

Because Claude Code picks the TTL per request and per billing type. In the official table a subscription inside plan usage gets 1 hour for the main conversation, while API keys, usage credits or cloud providers get 5 minutes there. Outside the main conversation a subscription also gets 5 minutes, apart from the small set of helper requests Anthropic controls server-side, which get one hour; on API keys, usage credits or cloud providers those requests get 5 minutes too. To keep an hour on an API key, set promptCacheTtl to 1h yourself on v2.1.242 or later, which is what the docs prescribe.

Is the 1-hour cache worth it?

It depends on the gap between requests. If you use a prefix more often than every 5 minutes, keep the 5-minute cache, because it keeps refreshing at no additional charge; the 1-hour cache suits prompts used less often than every 5 minutes but more often than every hour, such as an agentic side-agent that runs longer than 5 minutes or a long conversation waiting on a user. The premium is that writes bill at 2x the input price.

Why does a cache read cost anything?

Because the server does read that prefix again, just far cheaper than plain input: 0.1x on most models, 0.05x on Opus 5.5 and Sonnet 5.5, and 0.025x on Fable 5.2, Mythos 5.2, Fable 5.1 and Mythos 5.1. Anthropic's pricing page gives the arithmetic: with a 1.25x write on the 5-minute duration, caching starts paying off after 1 cache read.

What does a Fable 5.2 cache read actually cost?

It is $0.20 per million tokens: Fable 5.2 lists $8 per MTok of base input and hits bill at 0.025x, so $8 × 0.025 = $0.20. On the same row a 1-hour write is $16 per MTok, and a 5-minute write works out to $8 × 1.25 = $10 per MTok (worked example, Anthropic list prices only, no QCode pricing).

Does changing effort level throw away the cache?

Not by default on Fable 5.1 and later, Opus 5.5, Sonnet 5.5 or Haiku 5.5: the docs say the cache stays intact there with an API key or a subscription. On most other models each effort level has its own cache, so changing effort mid-session recomputes the entire request. The docs suggest picking the model and effort at the top of a session and saving /compact for natural breaks between tasks.

Do subagents get a cache?

Yes, but a separate one. A subagent starts its own conversation with its own system prompt and tool set, so its first request cannot read the parent cache, and it warms a cache of its own across its turns. It sits outside the main conversation's TTL bucket, so it gets 5 minutes even on a subscription until you choose a longer subagentPromptCacheTtl. The parent cache is unaffected; a fork is the exception and reads the parent cache on its first request.

Sources

Claude Code official prompt caching documentation, code.claude.com/docs/en/prompt-caching, and the costs page, code.claude.com/docs/en/costs (checked 2026-11-20); Anthropic's official pricing page, platform.claude.com/docs/en/about-claude/pricing, and the prompt caching guide, platform.claude.com/docs/en/build-with-claude/prompt-caching (checked 2026-11-20); OpenAI's official pricing page, developers.openai.com/api/docs/pricing (2026-11-20, used only to compare cache tier names); qcode.cc/models (2026-11-20, the reference for cache write and cache read rates); community material comes only from public discussion threads and is labeled as user reports in the text. Everything above was checked on 2026-11-20.

Get the TTL right first, then move to a per-token key

Create a QCode account for a cr_ key, set ANTHROPIC_BASE_URL=https://api.qcode.cc/api in Claude Code, and call multiple models billed per token; cache rates are on /models.

Related reading

Crypto payment guide

Nine coins, 56 networks, zero platform fee for AI coding API credits.

Anthropic's and OpenAI's pricing pages plus the Claude Code caching and costs docs were checked on 2026-11-20 and are authoritative at code.claude.com, platform.claude.com and developers.openai.com; QCode-side rates follow qcode.cc/models. QCode.cc is an independent API access service with no affiliation to and no endorsement from Anthropic, OpenAI or other vendors. Every dollar figure above is a vendor's official list price, and the worked examples only illustrate the billing multipliers.

Not sure where to start?

Try it for a week

Small Pack: $4 for $30 of quota, valid 7 days

Use it every day

Starter: $9.00/month with $5 of quota every day — just $0.060 per $1 of quota, vs about $0.113 for the Medium Pack