Compare pricing across 50+ LLM providers and calculate monthly costs for your AI application. Find the cheapest provider for your workload ā or see how much you save with a unified API gateway.
In 2026, the LLM landscape is fragmented:
- OpenAI charges $15/M input tokens for GPT-5
- Anthropic charges $15/M for Claude 4 Opus
- Google charges $12.50/M for Gemini Ultra 2
- XiDao Gateway routes to all of them at 30-70% lower cost
This calculator helps you:
- š Compare costs across providers for the same workload
- š° Calculate monthly bills based on your token usage
- š Factor in caching discounts, batch pricing, and rate tiers
- š·ļø Find the cheapest provider for your specific model requirements
pip install llm-cost-calculator
Or run directly:
git clone https://github.com/XidaoApi/llm-cost-calculator.git cd llm-cost-calculator pip install -e .
llm-cost compare --input-tokens 1M --output-tokens 200K --requests 10000
llm-cost calc --provider openai --model gpt-5 --input-tokens 5M --output-tokens 1M
llm-cost cheapest --capability code --context-window 128K --max-latency 2s
llm-cost savings --input-tokens 10M --output-tokens 2M --strategy cost-optimized
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā LLM Cost Comparison (2026) ā
ā Workload: 10M input + 2M output tokens, 50K requests/month ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā£
ā Provider Model Input $/M Output $/M Total ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā XiDao Gateway claude-4-sonnet $3.00 $15.00 $180 ā
ā XiDao Gateway gpt-5-mini $2.50 $10.00 $145 ā
ā Anthropic claude-4-sonnet $3.00 $15.00 $210 ā
ā OpenAI gpt-5-mini $3.00 $12.00 $174 ā
ā Google gemini-2.5-pro $2.50 $10.00 $145 ā
ā OpenRouter claude-4-sonnet $3.00 $15.00 $210 ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā š° XiDao saves you $30-$65/month (15-30%) vs direct provider ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
from llm_cost_calculator import CostCalculator calc = CostCalculator() # Compare providers comparison = calc.compare( input_tokens=1_000_000, output_tokens=200_000, requests=10_000 ) for provider in comparison.sorted_by_cost(): print(f"{provider.name}: ${provider.total_cost:.2f}/month") # Calculate specific model cost cost = calc.calculate( provider="xidao", model="claude-4-sonnet", input_tokens=5_000_000, output_tokens=1_000_000, ) print(f"Monthly cost: ${cost.total:.2f}")
| Provider | Models | Pricing Updated |
|---|---|---|
| OpenAI | GPT-5, GPT-5-mini, GPT-5-nano, o4, o4-mini | May 2026 |
| Anthropic | Claude 4 Opus, Claude 4 Sonnet, Claude 4 Haiku | May 2026 |
| Gemini Ultra 2, Gemini 2.5 Pro, Gemini 2.5 Flash | May 2026 | |
| Meta | Llama 4 Maverick, Llama 4 Scout | May 2026 |
| Mistral | Mistral Large 3, Codestral 2 | May 2026 |
| XiDao Gateway | All of the above at reduced rates | May 2026 |
| OpenRouter | Aggregated pricing | May 2026 |
| Together | Open-source models | May 2026 |
| Groq | Ultra-fast inference | May 2026 |
Create a ~/.llm-cost-calc/config.yaml for custom pricing:
default_provider: xidao currency: USD include_batch_pricing: true include_caching_discounts: true custom_providers: my-company: base_url: https://api.mycompany.com/v1 models: fine-tuned-gpt5: input_per_million: 6.00 output_per_million: 18.00
# Fetch latest pricing from all providers llm-cost update-prices # Update a specific provider llm-cost update-prices --provider openai
PRs welcome! To add a new provider:
- Create a JSON file in
providers/with model pricing - Add the provider class in
llm_cost_calculator/providers/ - Submit a PR
MIT ā use freely in your projects.
š” Tip: Most AI apps spend 60-80% of their budget on inference. Using a XiDao API Gateway with smart routing can cut costs by 30-70% while maintaining quality through automatic model selection.