Page languageFrançaisEnglish
Teacher area
Laurent PoupetClaude trainer and artificial intelligence architectStudent area

Category · Models and how they work

What is prompt caching?

Prompt caching means paying less for the start of a call when it is identical to the previous one. At Anthropic, that part costs at most 10% of the input price. Fixed parts go first, and a timestamp at the start breaks the cache.

By , Claude trainer and artificial intelligence architect · Updated

How it works

  • At Anthropic, the end of the fixed part is marked with cache_control. Writing costs a little more than the normal price, and the cache lasts five minutes, renewed on every read.
  • A one-hour duration also exists, with a more expensive write. It is useful when calls are spaced out, for example an agent that resumes a task from time to time.
  • On Azure OpenAI, the cache is generally cleared after five to ten minutes without use, and it is never shared between subscriptions. Some recent models offer extended retention.
  • With reserved capacity, tokens read from the cache do not consume capacity. A good cache read rate therefore directly reduces the number of units to reserve.

Related terms

Where this is taught

  • Track 4 · Programming with Claude and going live

    Prompt Cachinglesson 5 · 1 hour

Lesson content (step-by-step instructions, exercises with solutions, quizzes) is for students only, with an access code received after the first lesson.

See the full program

All glossary terms

Trial lesson · 30 min · $20

Book (new tab)