Calculate Claude Prompt Caching Costs
This synthetic Claude Sonnet 5.5 request costs an estimated $0.0359 at Standard global rates, with 12,000 total input tokens and 1,000 output tokens. The same input and output without caching costs $0.0340.
Run the Claude exampleMessages API usage example
Add uncached input, cache reads and cache writes to get the full input count: 1,000 + 4,000 + 7,000 = 12,000. The two durations in cache_creation split those 7,000 writes.
{
"type": "message",
"model": "claude-sonnet-5-5",
"usage": {
"input_tokens": 1000,
"cache_read_input_tokens": 4000,
"cache_creation_input_tokens": 7000,
"cache_creation": {
"ephemeral_5m_input_tokens": 3000,
"ephemeral_1h_input_tokens": 4000
},
"output_tokens": 1000
}
}
Estimated request cost
$0.0359USD
Claude Sonnet 5.5 · Standard · Global
- Uncached input$0.0020 1,000 tokens × $2 / 1M
- Cache read$0.0004 4,000 tokens × $0.10 / 1M
- 5-minute cache write$0.0075 3,000 tokens × $2.50 / 1M
- 1-hour cache write$0.0160 4,000 tokens × $4 / 1M
- Output$0.0100 1,000 tokens × $10 / 1M
Rates checked on . See Claude model pricing and Anthropic's prompt caching documentation.
How to check your own request
- Copy the final
POST /v1/messagesresponse. If you stream, use the final message assembled by your SDK. - Open the calculator and paste your usage JSON. Select the exact Claude model when pasting only the
usageobject. - Keep
cache_creationwhen there are writes. The calculator needs the duration counts to price each write. Use the original response if you only have a total.
Find one request in a Claude Code session
With ccusage installed, run the command below locally. Replace <session-id> with the full ID from ccusage claude session --json. ccusage session guide
ccusage claude session --id <session-id> --json
- In
entries, find the request bytimestampand confirm itsmodel. Keep the session export on your own machine. The calculator expects one request’s Messages API usage. - Prefer the matching Messages API
usageif you captured it. You can also map the entry’sinputTokens,outputTokens,cacheReadTokensandcacheCreationTokenstoinput_tokens,output_tokens,cache_read_input_tokensandcache_creation_input_tokens, respectively. - If
cacheCreationTokensis positive, get the 5-minute and 1-hour counts from the matching original usage. In the example above, the export would show 7,000 writes, while the original usage splits them into 3,000 and 4,000. If you can’t recover that split, leave the request estimate unresolved. - Paste the single request’s usage and select its exact Claude model. Open the request JSON input.
Which amount are you checking?
- Recorded amounts. ccusage’s
--mode displayadds amounts stored in the logs. An entry with no stored amount contributes zero dollars and can still have tokens. - Token-based estimates. ccusage’s
--mode calculateprices the tokens in the selected session. Its defaultautomode uses stored amounts when present and estimates the rest. This calculator prices one supported request at Standard global API rates. - Actual charges. To check an invoice or prepaid credit deduction, use the provider’s billing records for the same account and time window. For a subscription, check the provider’s plan usage and billing separately.
Why this request costs more with caching
The two writes add $0.0095 above the regular input rate, while the cache read saves $0.0076. That leaves $0.0019 in extra cost for this request. Later hits can recover the write cost if they reuse those tokens before the cache expires.
The estimate covers one direct Claude API text request at global Standard rates. Batch pricing, regional rates, tool fees, taxes and private discounts can change the amount on your invoice.