---
title: "Prompt Caching"
description: "Prompt caching is an inference optimization that reuses computation for a repeated prefix of model input. When multiple requests begin with the same system instructions, examples, documents, or tool definitions, the provider can cache the intermediate attention state for that prefix instead of recomputing it from the first token each time."
canonical_url: "https://promptmetheus.com/resources/llm-knowledge-base/prompt-caching"
---

> Index of every page on this site: [llms.txt](https://promptmetheus.com/llms.txt)

Prompt caching is an inference optimization that reuses computation for a repeated prefix of model input. When multiple requests begin with the same system instructions, examples, documents, or tool definitions, the provider can cache the intermediate attention state for that prefix instead of recomputing it from the first [token](https://promptmetheus.com/resources/llm-knowledge-base/token) each time.

Caching can reduce latency and input-processing cost for applications with long, stable prompts. Typical candidates include:

- a large [system message](https://promptmetheus.com/resources/llm-knowledge-base/system-message);
- shared reference documents;
- extensive [few-shot examples](https://promptmetheus.com/resources/llm-knowledge-base/few-shot-prompt);
- tool schemas used by an [AI agent](https://promptmetheus.com/resources/llm-knowledge-base/ai-agent); and
- a long conversation history reused across successive turns.

Prompt caching normally requires exact or near-exact prefix matching. Stable content should therefore appear before request-specific data. Reordering tools, changing whitespace, inserting timestamps, or modifying early instructions may invalidate the cached prefix even if most content is unchanged.

Prompt caching does not increase the [context window](https://promptmetheus.com/resources/llm-knowledge-base/context-window) or improve answer quality directly. The model still receives the same input; the optimization changes how efficiently that input is processed. It also differs from [agent memory](https://promptmetheus.com/resources/llm-knowledge-base/agent-memory), which stores information for later retrieval rather than cached model computation.

Providers may use different cache lifetimes, minimum prefix lengths, write costs, and accounting rules. Applications should monitor cache-hit rates and effective cost rather than assuming that a long static prompt is being reused.

Prompt caching is one lever in [token economics](https://promptmetheus.com/resources/llm-knowledge-base/token-economics). It can lower the effective price of repeated input tokens, but it does not reduce output-token cost or eliminate the need to design compact, relevant context.

Sensitive data remains subject to the provider's storage and retention controls. Developers should verify how cached prefixes are isolated between organizations and whether caching is compatible with their data-governance requirements.

See the [Anthropic prompt caching documentation](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for an implementation based on explicit cache breakpoints.

## Sitemap

See the full [sitemap](https://promptmetheus.com/sitemap.md) for all pages.
