Skip to content

Context Caching

A technology where the provider remembers processed context and does not recalculate it on subsequent requests. This saves money and speeds up responses.

How It Works

The LLM processes context through attention: each new request recalculates all previous messages. If the dialogue is long — this is expensive.

Caching solves the problem: an unchanging prefix (system prompt, history) is calculated once and saved. On subsequent requests, the model processes only the new part.

Why It Is Needed

  • Money — reprocessing the same prefix is cheaper (providers like DeepSeek and Anthropic have separate rates);
  • Speed — fewer calculations on the prefix;
  • Long Dialogues — makes them cheaper.

Where It Works

  • DeepSeek — contextual caching with automatic storage;
  • Anthropic Claude — prompt caching;
  • OpenAI — automatic prefix caching.

How to Use It Effectively

Keep unchanging parts (system prompt, instructions) at the beginning, and variables at the end. Then the prefix is cached entirely.

See Also

← All Terms