Reupload
All AI ToolsLocal AI?
← Back home

Skill · Anthropic Official Claude Platform Documentation

Cut Claude API costs 90% with prompt caching

Cut Claude API costs 90% with prompt caching

Photo: Deng Xiang on Unsplash

Prompt caching reduces input token costs by 90% on repeated requests by marking large static context (system prompts, documents, few-shot examples) for reuse within a 5-minute window. For RAG systems, support bots, and document processing workflows handling 50+ similar queries daily, this single-parameter change can slash API bills from thousands to hundreds per month without sacrificing output quality.

Prompt caching is a Claude API feature that stores a prefix of your prompt on Anthropic's servers, allowing subsequent requests within the cache TTL to reuse that content at drastically reduced cost. Here's how it works in practice:

Identify the static part of your prompt-typically your system prompt, company knowledge base, or document context that remains constant across requests. Add a single field called cache_control with type "ephemeral" to the last block you want cached. On the first request, Anthropic writes the cached prefix to memory at 1.25x the normal input token rate. On every subsequent request within 5 minutes (or 1 hour for Opus), those same tokens cost only 10% of the standard rate.

A concrete example: Imagine you're running a support chatbot that processes 100 customer inquiries daily using the same 10,000-token company policy document as context. Without caching, that document costs $0.02 × 100 = $2.00 per day. With caching enabled, the first request pays the write cost ($0.025), then each of the remaining 99 requests pays cache-read cost ($0.002)-totaling roughly $0.22 per day. That's a 90% reduction. For companies processing thousands of documents monthly against the same large system prompt, caching can drop monthly API bills from $5,000 to $500 or less. The technique pairs perfectly with batch processing for another 50% discount on async workloads.

Sources & credits

Original source: Anthropic Official Claude Platform Documentation