By default, the Claude prompt cache has a 5-minute lifetime, refreshed at no additional cost each time the cached content is used. If 5 minutes is too short, you can use a 1-hour cache duration at additional cost. The choice depends on the gaps between your requests: a cache that expires before the next request is wasted money, and a 1-hour write that is only read once costs more than a 5-minute write.
Prerequisites
- The gaps between your requests, in minutes.
- The write cost multipliers: a 5-minute entry costs 1.25 times the base input price to write, and a 1-hour entry costs 2 times.
- The read cost: cache reads cost a fraction of the base input price, 0.1 times on most models.
Steps
Step 1: Measure the gaps
Look at the gaps between your requests over a real session. If the gaps are under 5 minutes, the default lifetime holds; if they run to 20 or 40 minutes, the 5-minute cache expires between requests.
Step 2: Compare the write costs
A 5-minute write costs 1.25 times the base input price, and a 1-hour write costs 2 times. The 1-hour entry pays for itself only if it is read enough times to cover the higher write cost; the 5-minute entry pays for itself after the second request in its window.
Step 3: Pick the lifetime
Pick 5 minutes for chatty sessions with short gaps, and 1 hour for sessions with long gaps between requests. Write the choice and the gap measurement down, so the next person does not re-decide it from memory.
Worked example: Cedar Street Library reference desk
The fictional Cedar Street Library answers reference questions with the same cached catalogue guide. Gaps between questions are 20 to 40 minutes.
| Lifetime | Write cost | Gap covered | Verdict |
|---|---|---|---|
| 5 minutes | 1.25x base input | Under 5 minutes | Expires between questions |
| 1 hour | 2x base input | Up to 60 minutes | Covers the 20 to 40 minute gaps |
The 5-minute cache expires between the library’s questions, but the 1-hour cache covers the 20 to 40 minute gaps, so the library chooses the 1-hour lifetime.
Expected result. The chosen lifetime covers the measured gaps between your requests, and the write cost is justified by the reads it enables. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.
Limits
- The lifetime is measured from the start of the request that writes or reads the entry, not from the end of its response.
- A 1-hour write that is read only once costs more than a 5-minute write; check the read count.
- Prices and multipliers can change; check the current pricing page.
