How much does Claude Code API cost per token?

Updated 2026-07-15Asked across Reddit, Quora & Google· Claude Code
Short answer

Claude Code API pricing is per million tokens (as of 2026-07): Claude Opus 4.5 is $5 input / $25 output; Claude Sonnet 4.5 is $3 / $15 (Sonnet 5 has intro pricing of $2 / $10 through Aug 31, 2026); Claude Haiku 4.5 is $1 / $5. Prompt-cache reads cost 10% of input, and the Batch API gives a 50% discount.

Why — the first-principles explanation

API billing counts tokens, not messages. A token is about four characters of English. Every request has two priced sides: input tokens (everything Claude reads—your prompt, files, and history) and output tokens (what Claude writes back). Output is far pricier than input—usually 5×—because generating text is the expensive part.

Model choice is the biggest cost lever. Anthropic offers a ladder: Haiku is the cheapest and fastest for simple work, Sonnet is the balanced default for most coding, and Opus is the most capable for hard reasoning. Since Opus output ($25/MTok) is five times Sonnet's, matching the model to the task is where most savings come from. Claude Code lets you switch mid-session with `/model`.

Two features cut the bill further. Prompt caching stores repeated context (like a big system prompt) so re-reading it costs just 10% of the input price—a huge saving in long coding sessions that revisit the same files. The Batch API halves both input and output prices for non-urgent, asynchronous jobs. Claude Code turns on caching automatically, which is why real per-task costs are often lower than the sticker rates suggest.

An example that makes it click

Imagine paying a translator by the word. Words you hand them to read are cheap (input); words they write for you cost five times more (output). You also choose the translator: a fast junior for simple notes (Haiku), a solid pro for daily work (Sonnet), or a top expert for tricky legal text (Opus)—and the expert charges five times the pro to write. Smart trick: if you keep handing them the same reference page, they memorize it and charge you only a tenth to re-read it. That's prompt caching.

Key facts

Infographic: How much does Claude Code API cost per token — short answer and key facts
Visual summary — How much does Claude Code API cost per token?
CC
Try Claude Code by Anthropic

Anthropic's agentic coding tool that works in your terminal.

Affiliate link — we may earn a commission at no cost to you.
Visit Claude Code ↗
▶ The 60-second explainer (script)

How much does the Claude Code API cost per token? It's priced per million tokens—and a token is about four characters. Every request has two sides: input, what Claude reads, and output, what it writes. Output costs about five times more, because generating text is the expensive part. Your biggest lever is the model. As of 2026, Haiku is cheapest at one dollar in, five out per million. Sonnet, the everyday default, is three and fifteen—though the new Sonnet 5 has intro pricing of two and ten through the end of August. And Opus, the top model, is five and twenty-five. Since Opus output is five times Sonnet's, matching the model to the task saves the most money—switch anytime with slash-model. Two more savers: prompt caching drops repeated content to just ten percent of the input price, and Claude Code turns it on automatically. And the Batch API halves both input and output for jobs that aren't time-sensitive. So real costs often land below the sticker rates.

What authoritative sources say

Anthropic Platform — Pricingofficial — Opus 4.5 is $5/$25, Sonnet 4.5 is $3/$15 (Sonnet 5 intro $2/$10 through Aug 31, 2026), and Haiku 4.5 is $1/$5 per million tokens. source ↗
Anthropic Platform — Pricing (prompt caching, batch)official — Cache read (hit) costs 0.1× the standard input price; the Batch API offers a 50% discount on input and output. source ↗
Claude Code Docs — Manage costsofficial — Claude Code automatically optimizes costs with prompt caching; choose the right model with /model to reduce spend. source ↗

People also ask

Why is output more expensive than input?

Generating text uses more compute than reading it. Output tokens typically cost about 5× input tokens across Claude models.

Which model is cheapest?

Claude Haiku 4.5 at $1 input / $5 output per million tokens. Use it for simple tasks and Opus only for hard reasoning.

How does prompt caching lower cost?

Cached content costs just 10% of the input price to re-read. Claude Code enables caching automatically in long sessions.

Can I get a discount for bulk jobs?

Yes. The Batch API gives a 50% discount on both input and output tokens for asynchronous, non-urgent processing.

Related questions