Request 2 caches its request content (not the response) changedbuild-with-claude/prompt-caching
Nearest release: v2.1.308, published 2 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+4added
Lines−4removed
From line
819
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits26to this page, all time
### Replacing the `max_tokens=1` workaround ### Replacing the max\_tokens=1 workaround
The whole hunk
from line 819, old and new numbered
/
from line 819
819819
820820The response includes detailed cache information like the following:
821821
822```json Output
822```text Output wrap
823823{
824824 "usage": {
825825 "input_tokens": 2048,
from line 850
850850* When you want to improve your rate limit utilization, because cache hits are not deducted against your rate limit.
851851
852852<Note>
853 The 5-minute and 1-hour cache behave the same with respect to latency. You generally see improved time-to-first-token for long documents.
853 The 5-minute and 1-hour caches behave the same with respect to latency. You generally see improved time-to-first-token for long documents.
854854</Note>
855855
856856### Mixing different TTLs
from line 1088
10881088
10891089The API returns an empty `content` array:
10901090
1091```json Output
1091```text Output wrap
10921092{
10931093 "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
10941094 "type": "message",
from line 1522
15221522
15231523`max_tokens: 0` is also rejected inside a [Message Batches](https://platform.claude.com/docs/en/build-with-claude/batch-processing) request. Pre-warming targets time-to-first-token, which does not apply to batch processing, and a cache entry written during batch processing would likely expire before the follow-up request runs.
15241524
1525### Replacing the max\_tokens=1 workaround
1525### Replacing the `max_tokens=1` workaround
15261526
15271527Before `max_tokens: 0` was available, some applications used `max_tokens: 1` warm-up calls to achieve the same effect. The `max_tokens: 0` approach is preferred: no output is produced, so there is no single-token reply to discard, no output tokens are billed, and the intent of the request is unambiguous.
15281528
No line in this hunk matches that.