LLM API Cost Calculator
Estimate API spend from input and output volumes, and compare the same workload across models and providers.
≈ 4,000 chars
≈ 2,000 chars
3,000 / month · 36,500 / year
$3/M in · $15/M out · 1000k ctx
Prices are per 1M tokens (2025 list pricing). Costs may vary with volume discounts, caching, or promotions. Verify current rates on provider websites.
How LLM pricing works
Almost all providers price per million tokens, with input and output charged at different rates.
cost = (input ÷ 1M × input_rate) + (output ÷ 1M × output_rate)
- input
- Prompt tokens: system prompt, history, retrieved context, tool schemas
- output
- Generated tokens, including any billed reasoning tokens
- input_rate
- Price per million input tokens
- output_rate
- Price per million output tokens — typically 3–5× the input rate
Worked example
- Requests per month
- 100,000
- Input per request
- 2,000 tokens → 200M total
- Output per request
- 500 tokens → 50M total
- At $3 / $15 per million
- (200 × $3) + (50 × $15)
$600 + $750 = $1,350 per month
Note that output is 20% of the token volume and 56% of the cost. Optimising prompt length while ignoring response length is the most common way to work on the wrong half of the bill.
What actually reduces the bill
Roughly in order of impact per unit of effort:
- Prompt caching —A long stable prefix — system prompt, few-shot examples, a document — can be cached by the provider and re-billed at a large discount, often 90% off. This is usually the single biggest saving available, and it requires only that you put the stable content first and keep it byte-identical.
- Route by difficulty —Most production traffic is easy. Send it to a small model and escalate only what needs a large one. A tiered setup routinely cuts spend by more than half with no quality loss on the easy majority.
- Cap output length —Output is the expensive half. Setting max_tokens and asking explicitly for brevity has a direct, immediate effect.
- Trim retrieval —RAG pipelines routinely stuff far more context than needed. Retrieving 3 well-ranked passages instead of 20 usually improves quality as well as cost, since irrelevant context degrades attention.
- Batch where latency allows —Most providers offer an asynchronous batch tier at around half price for work that can wait.
- Trim tool schemas —Tool definitions are billed on every request. Verbose descriptions and unused tools are a permanent tax.
About
The AI Cost Calculator computes exact API costs for 11 major language models using current July 2026 pricing. Enter your expected input tokens, output tokens, and requests per day to see per-request, daily, monthly, and annual cost breakdowns. The "Compare all models" table sorts all models by monthly cost so you can instantly find the most cost-effective option for your use case. All calculations are done client-side with no API calls.
How to use
- 1 Select a model from the dropdown — models are grouped by provider.
- 2 Enter the average number of input tokens per request (your prompt length).
- 3 Enter the average number of output tokens per request (model response length).
- 4 Enter how many requests per day you expect to make.
- 5 Cost cards update instantly — per request, daily, monthly, and annual.
- 6 Click "Compare all models" to see a full table sorted by monthly cost.
- How are token costs calculated?
- Cost = (input_tokens × input_price_per_token) + (output_tokens × output_price_per_token). Prices are per million tokens. For example, Claude Opus 4.8 costs $5 per million input tokens and $25 per million output tokens. Multiply by requests/day × 30 to get monthly cost.
- Why are input and output tokens priced differently?
- Processing input (reading context) is computationally cheaper than generating output. Output tokens require autoregressive generation — each new token is predicted one at a time — so they cost 2-6× more than input tokens across most providers.
- How can I reduce my LLM API costs?
- Use a smaller/cheaper model for simpler tasks (Claude Haiku, Gemini Flash, DeepSeek V4 Flash). Cache repeated prompts with provider prompt-caching features. Reduce system prompt length. Limit max_tokens. Use streaming to detect and stop early. Batch requests where possible.
- Are the prices up to date?
- Prices reflect published rates as of July 2026. Note that some providers charge premium rates above a long-context threshold (e.g. GPT-5.x doubles input pricing past 272K tokens); the calculator uses standard rates. LLM pricing changes frequently — always verify current rates on the provider's official pricing page before making budget decisions.
In-depth guides
More in AI Tools
See all ai tools.