Prompt cache configuration
To enable prompt caching:
- For
v1/messagesandv1/messages/streaming, add a cache control object after each content object with these properties:"type": "cache_control""data": true
- For
v2/messages, add a cache control object after each content object with these properties:"cachePoint":{"type":"default"}"
The cache block stays the same for all requests during the five-minute TTL (Time To Live).
Prompt cache for v2/messages and v2/messages/streaming
o {
"modelId": "claude-sonnet-4-20250514-v1:0",
"messages": [
{
"role": "user",
"content": [
{
"text": "ITEM: FILTER-HYD-P3 | Hydraulic Filter P3 | $34.90 | Stock: 87\nITEM: PUMP-CENT-2HP | Centrifugal Pump 2HP | $1240.00 | Stock: 12\n... [5,000+ items] ..."
},
{
"cachePoint": {
"type": "default"
}
},
{
"text": "What is the stock level and price for the Hydraulic Filter P3 Series?"
}
]
}
]
}