Skip to content

JuanAtLarge/llm-cost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° llm-cost

See what your prompt actually costs across every major AI model. No API key needed.

Built by @JuanAtLarge because I got tired of guessing.

Usage

No install needed:

npx llm-cost-compare "your prompt here"

Examples

# Basic cost comparison
npx llm-cost-compare "Summarize this article in 3 bullet points"

# With a file
npx llm-cost-compare "Summarize this: $(cat mydoc.txt)"

# Specify expected output length
npx llm-cost-compare "Write a blog post about AI agents" --output=1000

# Filter by provider
npx llm-cost-compare "Hello world" --provider=Anthropic

# Show all models (default shows top 10 cheapest)
npx llm-cost-compare "Hello world" --all

# Pipe input
echo "Explain quantum computing simply" | npx llm-cost-compare

Sample Output

πŸ’° llm-cost β€” prompt cost calculator
   by @JuanAtLarge | github.com/JuanAtLarge/llm-cost

πŸ“ Prompt: "Write a blog post about AI agents"
πŸ“Š Estimated tokens: ~8 input / ~4 output

Model                  Provider     Per call      Per 1k calls
──────────────────────────────────────────────────────────────
Gemini 1.5 Flash       Google       $0.000002     $0.0016/1k calls
Mistral Small          Mistral      $0.000002     $0.0022/1k calls
Deepseek V3            Deepseek     $0.000003     $0.0026/1k calls
GPT-4o mini            OpenAI       $0.000003     $0.0030/1k calls
...

πŸ† Cheapest:    Gemini 1.5 Flash (Google) β€” $0.000002/call
πŸ’Έ Most exp:    Claude 3 Opus (Anthropic) β€” $0.000180/call
πŸ“ˆ Cost spread: 90Γ— difference between cheapest and most expensive

Models Included

Provider Models
OpenAI GPT-5.2 Pro, GPT-5.2, GPT-5, GPT-5 Mini, GPT-5 Nano, GPT-4o, GPT-4o mini, GPT-4 Turbo, o1, o1 mini, o3 mini
Anthropic Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 4.5, Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 3 Opus
Google Gemini 3.1 Pro, Gemini 3 Flash, Gemini 2.5 Pro/Flash/Flash-Lite, Gemini 2.0 Flash, Gemini 1.5 Pro/Flash/Flash-8B
Meta/OSS Llama 3.3 70B, Llama 3.1 405B, Llama 3 70B, Llama 3 8B
Mistral Mistral Large, Mistral Small
Deepseek Deepseek V3, Deepseek R1
xAI Grok 2, Grok 3, Grok 3 Mini

Pricing updated March 2026. PRs welcome to keep it current.

Notes

  • Token count is estimated (~4 chars per token for English)
  • Output tokens default to ~50% of input β€” use --output=N for accuracy
  • Prices are API list prices and may not reflect your negotiated rates

License

MIT

About

See what your prompt costs across every major AI model. No API key needed. Run: npx llm-cost

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors