Prompt Caching
Cut Claude cost and latency by up to 90% with prompt caching: cache the stable prefix (system prompt, tools, documents, history), pay full price once, then read at ~10%.
Last updated
Prompt Caching: Pay Once for the Prefix
Every Claude call re-sends the whole prompt — system, tools, documents, history — and you pay to re-process it every time. Prompt caching makes Claude remember the expensive, stable part, cutting repeated-context cost by up to 90% and latency with it.
The Messages API is stateless, so a RAG call with a 20-page document, or an agent on turn 30, re-sends and re-processes a huge identical prefix every single request. Prompt caching lets you mark that prefix with a cache breakpoint: the first call writes it to a server-side cache; every later call with the same prefix reads it for a fraction of the price and skips reprocessing it. Cache reads cost about 10% of normal input tokens. For any workload with a big, stable prefix — and almost all of them have one — this is the single highest-leverage cost and latency optimization available.
Related
More in LLM & Agentic
LLM Lifecycle
PreviewComplete lifecycle of large language models from pre-training through fine-tuning, RLHF, and deployment — with architecture diagrams and production considerations.
How LLMs Call Tools
PreviewHow LLMs use function calling and tool use — the mechanics behind tool-calling agents, from prompt engineering to structured output.
When to Fine-Tune: The Decision Framework
PreviewShould you fine-tune at all? A structured decision framework for prompt engineering vs RAG vs fine-tuning.
LoRA, QLoRA & PEFT Methods
PreviewHow LoRA works inside transformer layers, QLoRA for memory-efficient training, and the full PEFT method comparison with code examples.
Get full access to all 87+ sections with code examples, diagrams, and interactive animations.
Unlock Premium