GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - XidaoApi/llm-cost-calculator: Compare LLM pricing across 50+ providers and calculate monthly costs for AI applications. Find the cheapest model for your workload.

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
llm_cost_calculator
llm_cost_calculator
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

LLM Cost Calculator (2026)

License Stars Last Commit Release

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.

Why This Tool?

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

Installation

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 .

Quick Start

Compare all providers for a workload

llm-cost compare --input-tokens 1M --output-tokens 200K --requests 10000

Calculate monthly cost for a specific model

llm-cost calc --provider openai --model gpt-5 --input-tokens 5M --output-tokens 1M

Find cheapest provider for your requirements

llm-cost cheapest --capability code --context-window 128K --max-latency 2s

Show savings with XiDao gateway routing

llm-cost savings --input-tokens 10M --output-tokens 2M --strategy cost-optimized

Output Example

╔══════════════════════════════════════════════════════════════════════╗
ā•‘                    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      ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•

Programmatic Usage

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}")

Supported Providers (2026)

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
Google 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

Configuration

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

Update Pricing

# Fetch latest pricing from all providers
llm-cost update-prices

# Update a specific provider
llm-cost update-prices --provider openai

Contributing

PRs welcome! To add a new provider:

  1. Create a JSON file in providers/ with model pricing
  2. Add the provider class in llm_cost_calculator/providers/
  3. Submit a PR

License

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.

About

Compare LLM pricing across 50+ providers and calculate monthly costs for AI applications. Find the cheapest model for your workload.

xidaoapi.com

Topics

2026aianthropicapi-costsapi-gatewayclaudecost-calculatorcost-optimizationcost-trackinggeminigooglegptllmmulti-provideropenaiopenai-compatibleopenrouterpricingpythontoken-counting

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.