Anthropic prompt caching pricing, worked out
How Anthropic's cache write and cache read are priced, which usage fields carry them, and a worked usage.cost example for two requests that share one cached prompt.
Prompt caching lets a long prompt, such as a system prompt, a codebase summary or a document, be read again at a lower rate on the next request. On the Anthropic Messages API the price depends on two things: whether the tokens were written to the cache or read from it, and how long the cache lives. This post shows where those numbers come from in a response and how one request's cost is worked out, step by step.
The four token counts in a response
A Messages response reports input in three fields, plus output:
| Field | What it counts |
|---|---|
cache_creation_input_tokens | Tokens written to the cache by this request |
cache_read_input_tokens | Tokens read from the cache |
input_tokens | Tokens after the last cache breakpoint that aren't cached |
output_tokens | Tokens the model wrote |
Anthropic's documentation stresses that "input_tokens does NOT represent all input tokens, only the portion after your last cache breakpoint". The total input is cache_read_input_tokens + cache_creation_input_tokens + input_tokens (source).
How Anthropic prices cache tokens
Anthropic prices cache tokens as multiples of the model's base input price (source):
| Token type | Anthropic's rate |
|---|---|
| Cache write, 5-minute lifetime | 1.25 times the base input price |
| Cache write, 1-hour lifetime | 2 times the base input price |
| Cache read | 0.1 times the base input price, with exceptions for some newer models listed on the same page |
"By default, the cache has a 5-minute lifetime." A prompt below the model's minimum cacheable length is processed without caching, and no error is returned. The minimum per model is listed on the same page.
So caching costs more on the first request, which writes the cache, and less on every request that reads it before it expires.
How Cent AI bills the same tokens
Every model on Cent AI has four rates per million tokens: input, cache read, cache write and output. A model that prices the 1-hour cache separately also has a 1-hour cache write rate. The Messages usage fields map to them one to one: input_tokens to input, cache_read_input_tokens to cache read, cache_creation_input_tokens to cache write, and output_tokens to output.
For the Claude models, cache write on Cent AI is billed at the model's input rate, for both the 5-minute and the 1-hour lifetime. These are the rates of one model, per 1M tokens, from the pricing page on 2026-11-14:
| Rate | claude-sonnet-4-6 on Cent AI | Official |
|---|---|---|
| Input | $0.45 | $3 |
| Cache write, 5 minutes | $0.45 | $3.75 |
| Cache write, 1 hour | $0.45 | $6 |
| Cache read | $0.045 | $0.30 |
| Output | $2.25 | $15 |
Cache tokens are billed only when the response reports them. If a response says nothing about cache, every prompt token is billed at the input rate.
A worked example
Two requests send the same 9,700-token system prompt with a cache_control breakpoint, followed by a short question.
The first request writes the cache. Its usage:
{
"input_tokens": 300,
"cache_creation_input_tokens": 9700,
"cache_read_input_tokens": 0,
"output_tokens": 500,
"cost": "0.005625000"
}
At the rates in the table above:
- input: 300 × $0.45 / 1,000,000 = $0.000135
- cache write: 9,700 × $0.45 / 1,000,000 = $0.004365
- output: 500 × $2.25 / 1,000,000 = $0.001125
The sum is $0.005625, and usage.cost shows it with nine decimal places: "0.005625000".
The second request comes within five minutes and reads the cache:
{
"input_tokens": 400,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 9700,
"output_tokens": 600,
"cost": "0.001966500"
}
- input: 400 × $0.45 / 1,000,000 = $0.00018
- cache read: 9,700 × $0.045 / 1,000,000 = $0.0004365
- output: 600 × $2.25 / 1,000,000 = $0.00135
The sum is $0.0019665. The cached 9,700 tokens cost a tenth of what they cost as fresh input; the output is the largest part of this request.
On Cent AI the parts are added in nano-USD and the sum is rounded up once per request, then the minimum of $0.00002 applies. Both examples land exactly on a nano-USD, so nothing is rounded here. usage.cost is the amount charged; you can recompute it from the token counts in the same usage object and the rates in GET /v1/models.
Make the cache work for you
- Put the stable part first. The cache matches a prefix: system prompt and tools first, the changing question last.
- Mark the breakpoint. Add
cache_controlto the last block of the stable part. Cent AI passes it through unchanged. - Check the fields. If
cache_read_input_tokensstays at 0 on the second request, the prefix changed, the cache expired, or the prompt is below the minimum length. - Choose the lifetime. On Cent AI both lifetimes cost the input rate to write on the Claude models, so a 1-hour cache is worth it when requests are minutes apart.
The full formula, including the minimum and the rounding, is in Request cost.
Sources
- platform.claude.com/docs/en/build-with-claude/prompt-caching (opens in a new tab) · accessed 2026-11-14
- cent-ai.dev/pricing (opens in a new tab) · accessed 2026-11-14
- cent-ai.dev/docs/concepts/request-cost (opens in a new tab) · accessed 2026-11-14
Related posts
- Claude, GPT, Gemini, DeepSeek API prices in rupiahpricing · 4 minHow to read AI API rates per 1 million tokens and convert them to rupiah, with worked examples for one request and one coding session.
- Four rates per model, and what each one chargespricing · 2 minInput, cache read, cache write and output each have their own price. How one request is billed, step by step, and why the result is rounded up once.
- Claude Pro or a prepaid API: a break-even exampleclaude-code · 3 minClaude Pro's price from Anthropic's official pages, the cost of one Claude Code turn on a prepaid API, and a break-even example with every assumption stated.