DEV Community

ModelHub Dev
ModelHub Dev

Posted on

I Built a Free CLI Tool to Compare AI API Costs — Here's What I Found

If you're a developer using AI APIs, you're probably overpaying — and you probably don't even know how much.

I built ai-model-cost, a free open-source CLI that compares pricing across all major AI providers (OpenAI, DeepSeek, Anthropic, Google, etc.) right from your terminal.

Why I built it

I was migrating our app from OpenAI to DeepSeek and kept bouncing between pricing pages. Each provider has different rates for input/output, different tiers, volume discounts — it's a mess. So I wrote a tool that does the math for you.

The cost gap is real

Here's what I found comparing 100M tokens/month (60/40 input/output split):

Provider Model Monthly Cost
DeepSeek (official) V4 Flash ~$10
ModelHub (reseller) V4 Flash ~$21
Google Gemini 2.0 Flash ~$22
OpenAI GPT-4o mini ~$33
Anthropic Claude Haiku 3.5 ~$85
OpenAI GPT-5.5 ~$910

The most expensive vs cheapest: 93x difference.

How to use it

# Compare everything
npx ai-model-cost --tokens=100M --compare

# Check a specific model
npx ai-model-cost --model=deepseek-v4-flash

# Quick scan
npx ai-model-cost
Enter fullscreen mode Exit fullscreen mode

What I learned

  1. DeepSeek V4 Flash is absurdly cheap — it's 93x cheaper than GPT-5.5 for similar quality
  2. OpenAI GPT-4o mini is the best value within OpenAI's lineup — 27x cheaper than GPT-5.5, same quality tier
  3. Claude is consistently the most expensive — great for complex reasoning, overkill for basic tasks
  4. Most developers should run this tool before committing to a provider

What's next

I'm planning to add:

  • Token estimation based on your actual usage (import from OpenAI/ModelHub billing)
  • Latency benchmarks alongside cost
  • Weekly price update notifications

Get it

npx ai-model-cost --compare
Enter fullscreen mode Exit fullscreen mode

Or check the code on GitHub. PRs welcome.


Note: I run ModelHub which is one of the providers in the comparison. The tool is unbiased — it shows all providers sorted by price, including ones I don't operate.

Top comments (0)