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-calculatorOr 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 10000llm-cost calc --provider openai --model gpt-5 --input-tokens 5M --output-tokens 1Mllm-cost cheapest --capability code --context-window 128K --max-latency 2sllm-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 openaiPRs 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.