Skip to content

Browse catalog

Search catalog

[READY] Type a title, tag, or description.

NOTES // snippet

Prompt cache TTL split

LAST_MODIFIED
2026.10.26
CATEGORY
snippet

Claude Code keeps two cache buckets: the main conversation and everything else (subagents). Each control takes 5m or 1h; any other value is ignored. Requires v2.1.242 or later.

Use

If you sign in with an API key or a cloud provider, give the main conversation a one-hour cache:

{
  "promptCacheTtl": "1h",
  "subagentPromptCacheTtl": "5m"
}

Environment variable equivalents: CLAUDE_CODE_PROMPT_CACHE_TTL and CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL. A bucket you do not set keeps the five-minute default. FORCE_PROMPT_CACHING_5M=1 overrides both.

Check the effect in /cost, which shows a per-session cache line. Mechanics: Don’t break the prompt cache.

Sources

  1. Prompt caching in Claude CodeAnthropic
  2. Claude Code changelogAnthropic
claude-codeprompt-cachingcost

Related_Notes