Skip to main content

learn.howToCalculate

learn.whatIsHeading

The Claude API Cost Calculator estimates your monthly Anthropic API spend across Claude model variants including Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku, and Claude 3.5 Haiku. It accounts for the distinct input, output, and prompt caching pricing tiers.

Formule

Monthly Cost = (Input Tokens × Input Rate) + (Output Tokens × Output Rate) + (Cached Tokens × Cache Rate)
T_in
Input Tokens (tokens/request) — Average prompt tokens per API call
T_out
Output Tokens (tokens/request) — Average completion tokens per API response
H
Cache Hit Rate (%) — Percentage of input tokens served from prompt cache
N
Monthly Calls (calls/month) — Total API requests per month
P_cache
Cache Price ($/1M tokens) — Reduced rate for cached prompt tokens (typically 90% off)

Guide étape par étape

  1. 1Select the Claude model variant (Opus, Sonnet, Haiku)
  2. 2Enter average input tokens, output tokens, and prompt cache hit rate per request
  3. 3Specify total monthly API call volume
  4. 4View total cost with breakdown showing cache savings potential

Exemples résolus

Entrée
Claude 3.5 Sonnet: 1,500 input tokens, 800 output, 50% cache hit rate, 20,000 calls/month
Résultat
Non-cached input: 15M tokens × $3.00/1M = $45.00. Cached input: 15M × $0.30/1M = $4.50. Output: 16M × $15.00/1M = $240.00. Total: $289.50/month. Cache savings: $40.50.
Entrée
Claude 3 Haiku: 500 input, 200 output, 100,000 calls/month
Résultat
Input: 50M × $0.25/1M = $12.50. Output: 20M × $1.25/1M = $25.00. Total: $37.50/month.

Erreurs courantes à éviter

  • Not leveraging prompt caching for repeated system prompts, which can reduce input costs by 90%
  • Comparing Claude pricing to GPT without normalizing for output quality and token efficiency differences
  • Overlooking that Claude has a 200K context window — very long inputs significantly increase per-request cost

Questions fréquentes

How does Claude pricing compare to GPT-4o?

Claude 3.5 Sonnet ($3/$15 per 1M input/output) is comparable to GPT-4o ($2.50/$10). Claude 3 Haiku ($0.25/$1.25) competes with GPT-4o-mini ($0.15/$0.60). Claude 3 Opus ($15/$75) is the premium option. With prompt caching, Claude can be significantly cheaper for workloads with repeated system prompts.

What is prompt caching and how much does it save?

Prompt caching stores frequently used prompt prefixes (like system prompts) so they do not need to be re-processed on each call. Cached tokens are charged at 90% less than the standard input rate. For applications with long system prompts sent repeatedly, this can reduce input costs by 50-80%.

Prêt à calculer ? Essayez la calculatrice gratuite Claude API Cost

Essayez-le vous-même →

Paramètres