Skill · Anthropic Claude Blog
Slash Claude API Costs 90% With Prompt Caching
Photo: Growtika on Unsplash
Stop reprocessing identical system prompts and context on every API call. Prompt caching stores repeated prompt prefixes and reuses them across requests at 90% off standard input pricing, dramatically cutting costs for RAG systems, multi-turn conversations, and batch workflows.
Claude's prompt caching feature lets you mark portions of your prompt as cacheable-typically system instructions, tool definitions, and static context-so the API reuses the processed representation across requests instead of reprocessing identical tokens every time. This is especially powerful for production workflows where the same large instruction set or knowledge base gets sent repeatedly.
To implement it, you mark a cache breakpoint using cache_control: {"type": "ephemeral"} on content blocks that are at least 1024 tokens (for Sonnet/Opus models). On the first request, Claude processes everything normally. On subsequent requests with an identical prefix, the system retrieves the cached version from the cache layer and only processes the new suffix tokens you add-paying roughly 10% of standard input price for cached hits.
A real example: if you run a customer support chatbot using a 20,000-token company knowledge base, sending that base on every customer message costs $4 per 100 requests on Claude Sonnet 5.5. Cached, the same 100 requests cost about $0.25, because only the customer's actual message (the non-cached suffix) incurs full pricing. Stack this with the Batch API (50% additional discount for async work) and you're looking at 95%+ total savings on token costs.
Note that cached prefixes expire after 5 minutes by default-refreshed on every cache hit-so the TTL matters for your traffic pattern. For high-frequency workloads, the 5-minute default is usually fine. For sparse queries, consider the 1-hour TTL option (available via ttl: "1h" in your API request).
Sources & credits
Original source: Anthropic Claude Blog