Prompt Caching - Claude Code
Automatic reuse of cached context for substantial cost reduction.

Prompt caching reuses large, stable parts of your prompt across turns so you don't pay to re-tokenize them every time.
What it does
Claude Code marks static context - system prompts, CLAUDE.md, loaded files - as cacheable. Subsequent turns that reuse the same prefix pay a fraction of the normal per-token cost. This is why long sessions don't cost linearly more per turn as context grows.
When to use it
- Any session with meaningful CLAUDE.md or rule files - caching is already on by default.
- Heavy repos where large file reads recur turn after turn.
- Long debugging sessions where you want predictable costs.
- API-integrated workflows where per-turn cost matters.
Gotchas
- Cache hits require the prefix to be byte-identical. Small CLAUDE.md edits invalidate the cache.
- Cached entries expire - very long gaps between turns pay full price again.
- Caching is configured per model. Check the model config doc if your numbers look off.
Official docs: https://code.claude.com/docs/en/model-config.md#prompt-caching-configuration
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Newsletter
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools, delivered free every week.
Was this helpful?
Related Guides
Related Tools
Claude Code
Anthropic's agentic coding CLI. Runs in your terminal, edits files autonomously, spawns sub-agents, and maintains memory...
View ToolCodeburn
Interactive TUI dashboard that shows exactly where your Claude Code and Cursor tokens are going, in real time.
View ToolClaude Opus 4.7
Anthropic's flagship reasoning model. Best-in-class for coding, long-context analysis, and agentic workflows. 1M token c...
View ToolConductor
Mac app for running parallel Claude Code, Codex, and Cursor agents in isolated workspaces. Watch every agent work at onc...
View ToolRelated Videos

Prompt Caching: Anthropic Claude 3.5 Sonnet's Game-Changing Update!
In this video, we delve into Anthropic's latest release—prompt caching with Claude—right after Google's context caching announcement for Gemini 1.5. We explore the benefits of this technology,...

Open Design: Turn Websites into Design Assets for Cursor & Claude Code
Open Design: Open-Source n8n App That Turns Any Website into a Brand Kit, Design System, HTML + Images The video introduces Open Design, an MIT-licensed full-stack template that combines AI and n8n a

Nimbalyst: The Open-Source Visual Workspace for Building with Codex and Claude Code
Nimbalyst Demo: A Visual Workspace for Codex + Claude Code with Kanban, Plans, and AI Commits Try it: https://nimbalyst.com/ Star Repo Here: https://github.com/Nimbalyst/nimbalyst This video demos N
Related Posts

Claude Outages Are a Workflow Design Problem
Claude outages and 529 overloads expose whether your AI coding workflow has checkpoints, receipts, model-switch paths, a...

Claude Opus 4.8 Is an Agent Honesty Release
Claude Opus 4.8 looks like a benchmark bump, but the developer story is better honesty, dynamic workflows, and effort co...

Anthropic Sonnet 4.5 in Claude Code
Anthropic's Claude Sonnet 4.5 isn't just another model increment. The company claims they've observed it maintaining foc...

HalluSquatting Makes AI Coding Agents a Supply-Chain Problem
A July 2026 paper shows how hallucinated repository and skill names can become promptware delivery paths. The practical...

Setting Up a Spare Mac for Claude Code: The Full Remote Control Guide
A step-by-step guide to configuring an isolated Mac that Claude Code can fully control remotely - from SSH and Dispatch...

Claude Code's Silent 60-Second Timer: A Misfeature Postmortem
How a 60-second auto-continue timer shipped to Claude Code without documentation, what it reveals about agent safety ass...
