"AI API Pricing Guide 2026: What Every Million Tokens Really Costs"
API pricing is the invisible line between a profitable AI product and a money pit. Here is what every major model actually costs per million tokens in 2026.
The 2026 API pricing table
| Model | Input ($/M tokens) | Output ($/M tokens) | Context | Notes |
|---|---|---|---|---|
| GPT-4o | $2.50 | $10.00 | 128K | Best general-purpose model |
| GPT-4o mini | $0.15 | $0.60 | 128K | Best value small model |
| GPT-5 (if avail) | $5.00+ | $15.00+ | 256K+ | Flagship reasoning |
| Claude 3.5 Sonnet | $3.00 | $15.00 | 200K | Best for long-context coding |
| Claude 3.5 Haiku | $0.80 | $4.00 | 200K | Fast and cheap |
| Gemini 1.5 Pro | $1.25 | $5.00 | 2M | Massive context window |
| Gemini 1.5 Flash | $0.075 | $0.30 | 1M | Cheapest quality model |
| Llama 3.1 405B (via Groq) | $0.59 | $0.79 | 128K | Open-source, fast inference |
| DeepSeek V3 | $0.14 | $0.28 | 128K | Cheapest capable model |
| Mistral Large | $2.00 | $6.00 | 128K | European alternative |
Hidden costs to watch
- Context bloat: Every token in your prompt is billed at input rate. A 50K-token system prompt costs $0.125 per call on GPT-4o — that adds up fast.
- Prompt caching: Anthropic and OpenAI now offer prompt caching (50% discount on cached tokens). Use it for system prompts.
- Vision/multimodal: Image inputs add token costs (an image is ~1,000–2,000 tokens depending on resolution).
- Rate limits: Cheaper tiers have lower rate limits. A spike in traffic can cause 429 errors, not just higher bills.
- Fine-tuning: Training costs $5–$10 per million tokens; hosting a fine-tuned model adds a per-hour fee.
How to cut your bill by 80%
- Route by complexity: Use a cheap model (GPT-4o mini, Gemini Flash) for 80% of queries; escalate to GPT-4o/Claude only for hard ones.
- Compress prompts: Remove examples after the first few-shot turns. Use structured outputs to avoid retrying.
- Cache aggressively: Use Anthropic’s prompt caching for system prompts. Cache for 5 minutes saves 50%.
- Switch to open-source for scale: Llama 3.1 70B on your own GPU costs ~$0.20/M tokens — cheaper than any API at scale.
- Use batch API: OpenAI and Anthropic offer 50% discount for batch (non-real-time) requests.
FAQ
Which API is cheapest? DeepSeek V3 at $0.14/$0.28 per million tokens — but it is a Chinese model with data sovereignty considerations. Gemini 1.5 Flash at $0.075/$0.30 is the cheapest Western option.
How much does a chatbot cost per user? A typical conversation (10 messages, 500 tokens each) costs ~$0.03 on GPT-4o. That is $30 per 1,000 conversations.
Should I use multiple providers? Yes. Fallback routing (try GPT-4o, fall back to Gemini) prevents outages and can save money.
Verdict
Start with GPT-4o mini or Gemini Flash for 80% of your traffic. Add Claude for long-context coding. Add DeepSeek or Llama for cost-sensitive workloads at scale. Prompt caching and smart routing will cut your bill more than any single model switch.