Claude is priced per token, and a request's cost is never one number — it's the sum of up to four separate token buckets, each billed at its own rate relative to the model's base input price: regular (uncached) input at the full input rate, cache writes at a premium over the input rate, cache reads at a steep discount off the input rate, and output at the (much higher) output rate. The exam-relevant mental model is: cost is optimised per completed task, not per token and not per request — a cheaper-looking call that fails and needs a retry can cost more overall than a pricier call that succeeds once.
The four token buckets
Every response's usage object can report all four:
- Regular input (
input_tokens) — billed at the model's full input rate. Anything not cached falls here. - Cache write (
cache_creation_input_tokens) — writing a new cache entry costs more than an ordinary input token: roughly 1.25x the input rate for the default 5-minute TTL, or 2x for a 1-hour TTL. Caching is not free to set up — it pays off only across multiple reads of the same prefix. - Cache read (
cache_read_input_tokens) — roughly 0.1x the input rate. This is the actual saving: a cached prefix served on a later call costs about a tenth of what it would cost fresh. - Output (
output_tokens) — billed at the output rate, which is roughly five times the input rate on every current tier. A verbose response is disproportionately expensive compared to an equally-sized chunk of input.
Why output costs more, and why max_tokens isn't a cost lever
Because output is priced several times higher than input, trimming a rambling response is usually a bigger lever than trimming a similarly-sized block of input — a tighter prompt ("answer in 2–3 sentences") or an explicit output-shape example does more than shaving a few hundred tokens off a system prompt. It's tempting to reach for max_tokens as the control here, but it isn't one: max_tokens is an enforced ceiling the model is never told about. Hitting it truncates the response mid-thought (stop_reason: "max_tokens") — that's a failed attempt, not a cost saving, and in agentic workloads a capped run still spends tokens without producing a usable result, so cost per completed task doesn't actually improve.
Common exam distractor
An answer that frames cost purely in terms of "number of requests" is incomplete. Two requests with a bloated context and a rambling response can cost far more than twenty lean ones — token volume across all four buckets, not call count, is what's billed.
Estimating and verifying spend
Two tools make token cost concrete instead of guessed. The token counting endpoint (messages.count_tokens) returns an exact input token count for a given system/messages/tools payload without running inference — useful as a pre-flight gate on unbounded user input, or to sanity-check a prompt change before it goes live. And every response's usage object is the ground truth after the fact: if cache_read_input_tokens stays at zero across repeated, near-identical requests, something is silently breaking the cache (a timestamp interpolated into the system prompt, unsorted JSON, a varying tool list) and the caching lever from Lesson 2.5 isn't actually engaged, regardless of what the code appears to do.
Non-text input has its own token cost
Token economics isn't only about prose. Images are tokenized by pixel area, roughly one token per 28×28-pixel patch — so cost scales with resolution, not with how much visually "matters" in the image. Sending a full-resolution screenshot when the task only needs to read a small label wastes input tokens for no accuracy benefit; downscaling to a size like 1280×720 caps a single image near roughly 1,200 tokens and is a genuine, quality-neutral cost lever, distinct from anything covered by caching or batching. A large PDF processed as a document input adds up similarly — per-page token cost, not per-byte — which matters when estimating the cost of a document-heavy workload before it ships.
Organisation-level spend vs. per-call spend
Everything above computes cost from a single response's usage object, which is the right level for optimising one call. For total spend across an application or an org, the Usage and Cost Admin API reports the same four buckets in aggregate — grouped by model, API key, or workspace — without spending any tokens to read, since report reads aren't inference calls. The exam-relevant distinction: per-call usage tells you whether one change helped; the Admin usage/cost reports tell you whether that change actually moved the bill, and they're the tool for confirming a cost optimisation after it ships, not just estimating one beforehand.
Key concept
The Batches API discounts every token type — regular input, cache writes, cache reads, and output — by 50%, on top of whatever caching already saved. It only applies to latency-insensitive, asynchronous work (Lesson 2.5).