LLM Cost Calculator
Calculate and compare API costs for GPT-4o, Claude, Gemini, Llama, and more. Estimate daily, monthly, and yearly costs based on your usage patterns.
LLM Cost Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: Cost = (Input Tokens / 1M × Input Rate) + (Output Tokens / 1M × Output Rate)
Worked example — $225/month — switching to GPT-4o mini would cost ~$13.50/month (94% savings)
Formula
Cost = (Input Tokens / 1M × Input Rate) + (Output Tokens / 1M × Output Rate)
Each API request costs the sum of input token charges and output token charges. Multiply tokens used by the per-million rate for that model. Scale by number of requests for daily/monthly projections.
Worked Examples
Example 1: SaaS Chatbot on GPT-4o
Problem:Estimate monthly cost for a chatbot handling 500 requests/day with average 2,000 input tokens and 1,000 output tokens.
Solution:Cost per request: (2000/1M × $2.50) + (1000/1M × $10.00) = $0.005 + $0.01 = $0.015 Daily: $0.015 × 500 = $7.50 Monthly: $7.50 × 30 = $225.00
Result:$225/month — switching to GPT-4o mini would cost ~$13.50/month (94% savings)
Example 2: Document Processing Pipeline
Problem:Process 1,000 documents/day, each with 5,000 input tokens and 200 output tokens, using Claude 3.5 Sonnet.
Solution:Cost per doc: (5000/1M × $3.00) + (200/1M × $15.00) = $0.015 + $0.003 = $0.018 Daily: $0.018 × 1,000 = $18.00 Monthly: $18.00 × 30 = $540.00
Result:$540/month — Claude Haiku would be ~$45/month for simpler extraction tasks
Frequently Asked Questions
How do LLM API costs work?
LLM APIs charge based on token usage, with separate rates for input (prompt) and output (completion) tokens. Prices are typically quoted per 1 million tokens. Your total cost depends on: (1) which model you use, (2) how many tokens are in each request and response, and (3) how many requests you make. Output tokens are usually 2-5× more expensive than input tokens because generating each one requires a full model forward pass.
How do I choose the right model for my budget?
Start with the cheapest model that meets your quality requirements. For simple tasks (classification, extraction, summarization), smaller models like GPT-4o mini, Claude Haiku, or Gemini Flash often perform well at 10-50× lower cost. Use premium models (GPT-4o, Claude Sonnet, Gemini Pro) for complex reasoning, creative writing, or code generation. Run benchmarks on your specific use case — a smaller model might achieve 95% of the quality at 5% of the cost.
What are strategies to reduce LLM costs?
Key strategies include: (1) Use prompt caching for repeated prefixes (50% input savings). (2) Batch API requests for non-real-time tasks (50% savings). (3) Optimize prompts to reduce token count. (4) Set max_tokens limits. (5) Use fine-tuned smaller models for specific tasks. (6) Implement response caching for identical queries. (7) Use streaming to detect and stop poor responses early. (8) Consider self-hosted open-source models for very high volumes.
Are open-source models really cheaper?
It depends on scale. Via API providers (Together AI, Fireworks, etc.), open-source models like Llama 3.1 70B are significantly cheaper than proprietary models. For self-hosting, you need GPU infrastructure — a single A100 GPU (~$1-2/hour on cloud) can serve Llama 70B. At ~100K+ requests/day, self-hosting often becomes cheaper than API calls. Below that, API providers are usually more cost-effective due to infrastructure complexity.
How do you turn a per-token cost into a defensible per-seat price?
Work upward from cost per request. Multiply the modelled cost per request by the requests an average account makes in a month to get the variable cost of serving that account, then repeat the calculation for the heaviest plausible user rather than the mean, because token spend has a long tail and a small number of accounts running maximal context can consume several times the average. A flat monthly subscription only holds if the price covers that tail as well as your gross margin; where it does not, metered credits or a hard monthly token ceiling move the variance back to the customer.
What counts as a token, and how does tokenization affect the bill?
A token is a subword unit produced by the model's tokenizer, usually a byte-pair encoding, not a word or a character. For ordinary English prose a common rule of thumb is roughly four characters or about three-quarters of a word per token, so 1,000 tokens is a page or so of text. Efficiency drops for source code, JSON, long identifiers, and non-Latin scripts, where the same visible content can consume noticeably more tokens and therefore more money.
Why does a long multi-turn conversation get more expensive with every turn?
Chat endpoints are stateless, so the entire transcript is resent as input on each call. If each completed exchange adds about 300 tokens of history, the tenth request carries roughly nine exchanges, or about 2,700 extra input tokens, before the new question is even counted. Summed over ten turns that is around 13,500 tokens of resent history. Input volume therefore grows with the square of turn count, which is why sliding windows, rolling summaries, and prompt caching matter in chat products.
Why can a reasoning model cost more than its output rate suggests?
Reasoning models generate an internal chain of thought before emitting the visible answer, and those hidden thinking tokens are billed at the output rate even though they never appear in the response. A reply of 200 visible tokens can therefore be charged as several thousand. They also consume the completion token limit, so a limit set for the visible answer alone can truncate the response. Budget these workloads from measured usage figures rather than from expected answer length.
How do you convert a fixed monthly budget into a per-request token allowance?
Invert the cost formula. Divide the budget by monthly requests to get cost per request, subtract the expected output charge, then divide the remainder by the input rate. With a 300 dollar budget, 500 requests a day and a 30-day month, that is 15,000 requests at 0.02 dollars each. At an output rate of 10 dollars per million and 500 output tokens, output costs 0.005, leaving 0.015; at an input rate of 2.50 per million that funds 6,000 input tokens per request.
What extra cost lines does a retrieval-augmented generation pipeline add?
Three beyond the completion itself. Indexing charges an embedding fee for every chunk of the corpus and again after each re-index. Each query pays a small embedding charge to vectorise the question. The dominant line is the retrieved context: pulling the top five chunks of 400 tokens each injects 2,000 extra input tokens into every prompt, which at an input rate of 2.50 dollars per million adds 0.005 dollars per query. Reranking models, if used, bill separately.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Related Calculators
🧮Fine Tuning Cost Calculator
Estimate the cost of fine-tuning an LLM based on training tokens, epochs, and model size.
🧮Cloud Storage Cost Calculator
Calculate cloud storage cost with interactive inputs and clear steps.
🧮AI Image Generation Cost Calculator
Calculate the cost of generating AI images across Midjourney, DALL-E, and Stable Diffusion plans.
🧮Bandwidth Time Transfer Calculator
Calculate bandwidth time transfer with inputs, formulas, and instant results.
🧮Download Time Calculator
Calculate download time with inputs, formulas, and instant results.
🧮Throughput Efficiency Calculator
Calculate throughput efficiency with inputs, formulas, and instant results.
🧮Base64 Encode & Decode Calculator
Calculate base64encode decode with inputs, formulas, and instant results.
🧮Hash Checksum Calculator
Calculate hash checksum with inputs, formulas, and instant results.