What Are Tokens and Why You Pay for Them — A Developer's Guide to AI Pricing
What Are Tokens and Why You Pay for Them
You use AI every day. But do you know what a token actually is?
It’s not a word. It’s not a character. It’s the unit that determines how much you pay for every single API request.
Token ≠ Word
LLMs don’t process text like humans. They break everything into pieces called tokens. And each model breaks text differently.
Take the word “development”:
- GPT-4o tokenizes it into 3 tokens:
devel+op+ment - Claude tokenizes it into 2 tokens:
develop+ment
Same word. Different token count. Different cost.
This means the same prompt sent to two models at the same price-per-token can cost completely different amounts. The tokenizer is the hidden variable in every AI pricing comparison.
The Real Pricing Table (May 2026)
Here’s what 1 million input tokens costs across major models:
| Model | 1M Input | 1M Output | Best For |
|---|---|---|---|
| Claude Opus 4 | $15.00 | $75.00 | Complex reasoning, code |
| GPT-4o | $2.50 | $10.00 | General tasks, balanced |
| Claude Sonnet 4 | $3.00 | $15.00 | Code, analysis |
| Gemini 2.5 Pro | $1.25 | $10.00 | Long context, multimodal |
| GPT-4o-mini | $0.15 | $0.60 | Simple tasks, high volume |
| Claude Haiku 4.5 | $0.80 | $4.00 | Fast responses, triage |
Source: AI API Pricing Comparison 2026
The spread is massive. Claude Opus costs 100x more than GPT-4o-mini per input token. Are you using the right model for each task?
Cost Per Token vs Cost Per Result
Here’s where most developers get pricing wrong: they compare price-per-token and pick the cheapest model.
But two models at $5/MTok can cost completely different amounts for the same task. Why?
- Different tokenizers — same text, different token count
- Different completion lengths — one model might be more verbose
- Different accuracy — a cheaper model might need 3 retries to get it right
What actually matters is cost per successful result, not cost per token.
Example: Code Review Task
| Model | Tokens Used | Cost | Accuracy | Cost Per Correct Result |
|---|---|---|---|---|
| Opus 4 | 3,200 | $0.29 | 95% | $0.31 |
| Sonnet 4 | 2,800 | $0.05 | 88% | $0.06 |
| GPT-4o-mini | 4,100 | $0.003 | 62% | $0.005 |
For a code review, Sonnet gives you 88% accuracy at 6 cents. Opus gives you 95% at 31 cents. Mini gives you 62% at half a cent — but you’ll spend more time fixing its mistakes.
The right answer depends on what you’re building. Production code review? Use Opus. Linting suggestions? Mini is fine.
How One Endpoint Becomes $2,100/Month
Let’s trace a real scenario:
Single API request:
prompt: 847 tokens → $0.012
response: 2,341 tokens → $0.058
total: $0.07 per request
Scale it:
1,000 requests/day → $70/day
30 days → $2,100/month
And that’s just one endpoint. Most applications have 3-5 AI-powered features, each making hundreds of requests.
The Smart Approach: Route, Cache, Monitor
The developers cutting 60-80% of their AI costs aren’t switching to worse models. They’re doing three things:
1. Smart Routing
Route each query to the cheapest model that can handle it:
// Simple classification → use mini ($0.15/MTok)
// Code generation → use Sonnet ($3/MTok)
// Complex architecture → use Opus ($15/MTok)
A typical split of 70% mini / 20% mid / 10% premium reduces average cost by 60-80%.
2. Prompt Caching
If your system prompt is 2,000 tokens and you send 1,000 requests/day, you’re paying for those 2,000 tokens 1,000 times. Prompt caching reduces that to nearly zero after the first request.
3. Real-Time Monitoring
You can’t optimize what you can’t see. A proxy that logs every request gives you:
- Cost per model, per project, per day
- Token usage patterns (are you over-prompting?)
- Budget alerts before you overspend
Start With Visibility
Before optimizing anything, answer one question: how much does each of your projects cost per day?
If you can’t answer that, you’re flying blind — just like Uber’s 5,000 engineers who burned $10M+ in four months.
Veltrix Platform gives you that visibility in 5 minutes. One proxy endpoint, all providers, every token tracked.
→ model: claude-opus-4-6
→ tokens: 1,847
→ cost: $0.032
→ latency: 340ms
→ project: my-saas
Know your costs. Then optimize them.
Veltrix Platform — FinOps for AI tokens. Visibility, savings, and governance without changing your code. Get started →
Pronto pra reduzir sua fatura de IA?
Teste grátis por 7 dias. Sem cartão. Sem refactor. Resultado mensurável no primeiro dia.
Começar agora →