One of the most common horror stories in AI product development is the bill shock — a founder builds a prototype, gets a few hundred users, and suddenly receives a $4,000 monthly API invoice they didn't anticipate. Token costs are not intuitive, and without a model for estimating them before launch, you're flying blind.
Here's a practical framework for calculating your AI API costs before they become a problem.
Step 1: Understand How You're Charged
Nearly all commercial LLM APIs charge separately for input tokens (the tokens in your prompt + context) and output tokens (the tokens the model generates). Output tokens are almost always 2–5× more expensive than input tokens.
A simplified cost formula:
Monthly Cost = (Monthly Input Tokens × Input Price/M) + (Monthly Output Tokens × Output Price/M)
Step 2: Estimate Your Token Usage Per Request
Measure or estimate the average tokens per request for your application. A rough guide:
- Simple chatbot Q&A: ~500 input tokens, ~300 output tokens per turn
- Document summarisation: ~8,000 input tokens, ~500 output tokens
- Code generation from specs: ~2,000 input tokens, ~1,500 output tokens
- RAG-augmented query: ~3,000–5,000 input, ~500 output
Step 3: Project Your Monthly Volume
Multiply your per-request usage by your expected monthly request volume. Be realistic — include retries, background processing jobs, and admin usage, which often add 30–50% overhead to the "user-facing" volume estimate.
Step 4: Apply Current Pricing (2026 Reference)
| Model | Input $/M tokens | Output $/M tokens |
|---|---|---|
| GPT-4o Mini | $0.15 | $0.60 |
| Gemini 2.0 Flash | $0.075 | $0.30 |
| Claude 3 Haiku | $0.25 | $1.25 |
| GPT-4o | $2.50 | $10.00 |
| Claude 3.5 Sonnet | $3.00 | $15.00 |
| Gemini 1.5 Pro | $1.25 | $5.00 |
A Worked Example
Suppose you're building a customer support chatbot. You expect 10,000 conversations per month, each averaging 5 turns. Each turn uses ~800 input tokens and ~400 output tokens.
- Monthly input tokens: 10,000 × 5 × 800 = 40M tokens
- Monthly output tokens: 10,000 × 5 × 400 = 20M tokens
Using GPT-4o Mini: (40M × $0.15) + (20M × $0.60) = $6 + $12 = ~$18/month
Using GPT-4o: (40M × $2.50) + (20M × $10.00) = $100 + $200 = ~$300/month
This is why model selection is a financial decision, not just a performance decision. The cheaper model here costs 94% less — and for most customer support use cases, GPT-4o Mini is more than capable enough.
Cost Reduction Strategies
- Use the cheapest model that meets your quality bar — benchmark your task with Mini/Flash tier before defaulting to the premium tier
- Implement prompt caching — OpenAI, Anthropic, and Google all offer significant discounts for repeated prompt prefixes
- Compress your system prompt — a 2,000-token system prompt sent on every call adds up fast; cut it to the essentials
- Set output token limits — many models generate verbose answers by default; constraining max_tokens reduces cost
- Switch high-volume tasks to open-source self-hosted — at 500M+ tokens/month, Ollama + Llama 4 Scout is almost always cheaper than any API
Compare Models by Cost Per Token
ModelFinder's built-in cost calculator lets you estimate costs across multiple models instantly — enter your token volume and compare.
Open Cost Calculator →