Claude API Cost Calculator
Calculate Anthropic Claude API costs for Claude 4 Sonnet, Opus, Haiku and Claude 3.5 models.
Understanding Claude API pricing
Claude's API is priced per token β the basic unit of text the model processes. Tokens are roughly 4 characters or 0.75 words on average. Pricing has two components: input tokens (the text you send to the model, including system prompts and conversation history) and output tokens (the text the model generates in response). Input tokens are always cheaper than output tokens.
Cost = (Input tokens Γ Input price per 1M) + (Output tokens Γ Output price per 1M)
Example: Claude Sonnet 4 ($3 input / $15 output per 1M tokens)
Send 500 tokens, receive 200 tokens:
Cost = (500 Γ $3/1,000,000) + (200 Γ $15/1,000,000)
= $0.0015 + $0.0030 = $0.0045 per callReducing API costs: practical strategies
Token counting rule of thumb
English text: ~1 token per 4 characters (~0.75 words)
Code: ~1 token per 3β4 characters
Non-English: varies; CJK often 1 char = 1β2 tokens
Estimating tokens:
Tweet (280 chars) β 70 tokens
Blog post (1,000 words) β 1,300 tokens
Book chapter (5,000 words) β 6,500 tokens
GPT-4 context window (128K tokens) β 96,000 words β 192 pagesFrequently asked questions
How is Claude API pricing calculated?
You are charged per token for both input (your prompt) and output (the response), with different rates per model. This tool estimates cost from your token counts.
What is a token?
A token is a chunk of text β roughly 4 characters or 0.75 words of English. Both your prompt and the model's reply are measured in tokens.
Why are output tokens more expensive than input?
Generating text is more computationally demanding than reading it, so most providers price output tokens higher than input tokens.
How can I reduce my Claude API costs?
Trim unnecessary context from prompts, cap the output length, choose a smaller model where it suffices, and reuse cached context when supported.
Cost = (Input tokens / 1000 Γ input rate) + (Output tokens / 1000 Γ output rate) Prices per 1K tokens (as of 2025). Verify at anthropic.com/pricing as prices may change.