Most providers, including OpenAI, DeepSeek, and Kimi, cache prompts automatically. For Claude, enable caching by specifying cache_control in the request body.
OpenAI
Cache pricing:- Cache writes are free.
- Cache reads cost 0.5 times the standard input price.
Claude
Cache pricing:- Cache writes cost 1.25 times the standard input price.
- Cache reads cost 0.1 times the standard input price.
cache_control to the message content object you want to cache. You can cache system or user messages. For example, to cache a system message:
- Claude 3.7 Sonnet, Claude 3.5 Sonnet, and Claude 3 Opus require 1,024 tokens.
- Claude 3.5 Haiku and Claude 3 Haiku require 2,048 tokens.
DeepSeek
Cache pricing:- Cache writes are free.
- Cache reads cost 0.1 times the standard input price.
Gemini
Cache pricing:- Cache writes are free.
- Cache reads cost 0.25 times the standard input price.
