LLM API Pricing in 2026: The Complete Guide
A practical LLM API pricing reference for 2026: input/output rates, cache tiers, and real cost examples for GPT-4o, Claude, DeepSeek, Gemini, and more.
TL;DR — LLM API pricing in 2026 has three tiers: frontier models ($2.50-$15/M input tokens), mid-tier ($0.50-$2.50/M), and budget ($0-$0.50/M). Cache hits can cut costs 50-90%. The real cost of an agent is not the model price — it is price × tokens × calls/day × days. This guide gives you the math for every major model.
The pricing page tells you $2.50 per million input tokens. What it doesn’t tell you is: your agent will use 4,000 tokens per turn, run 50 turns per day, and your monthly bill will be $15 — or $150 — depending on which model you pick and whether you hit cache.
This guide translates published pricing into real monthly costs for common agent patterns.
2026 pricing landscape
Frontier tier ($2.50-$15/M input tokens)
| Model | Input ($/M tokens) | Output ($/M tokens) | Context | Best for |
|---|---|---|---|---|
| GPT-4o | $2.50 | $10.00 | 128K | General-purpose, vision, tool use |
| Claude Opus 4.7 | $15.00 | $75.00 | 200K | Complex reasoning, long documents |
| Claude Sonnet 4 | $3.00 | $15.00 | 200K | Coding, agents, balanced cost/quality |
| Gemini 1.5 Pro | $3.50 | $10.50 | 2M | Very long context, multimodal |
Mid-tier ($0.50-$2.50/M input tokens)
| Model | Input ($/M tokens) | Output ($/M tokens) | Context | Best for |
|---|---|---|---|---|
| GPT-4o-mini | $0.15 | $0.60 | 128K | High-volume, cost-sensitive agents |
| Claude Haiku 3.5 | $0.80 | $4.00 | 200K | Fast classification, routing |
| Gemini 1.5 Flash | $0.075 | $0.30 | 1M | Bulk processing, long context cheap |
| DeepSeek V4 | $0.27 | $1.10 | 128K | Coding, open-weight alternative |
Budget tier ($0-$0.50/M input tokens)
| Model | Input ($/M tokens) | Output ($/M tokens) | Context | Best for |
|---|---|---|---|---|
| Qwen3-32B (free tier) | $0.00 | $0.00 | 131K | Prototyping, low-stakes tasks |
| DeepSeek V4 Flash | $0.07 | $0.28 | 1M | Budget long-context |
| Gemini Flash 8B | $0.0375 | $0.15 | 1M | Extreme volume, simple tasks |
Prices as of July 2026 from official provider pricing pages. SandBase passes through provider pricing; check the model catalog for current rates.
Real cost calculations
Abstract $/M tokens is useless without context. Here is what agents actually spend:
Pattern 1: Daily briefing agent (30 turns/day)
The agent reads 10 data sources, synthesizes, and produces a summary.
| Model | Tokens/turn | Turns/day | Daily cost | Monthly |
|---|---|---|---|---|
| Claude Sonnet 4 | 3,000 in + 800 out | 30 | $0.63 | $18.90 |
| GPT-4o | 3,000 in + 800 out | 30 | $0.47 | $14.10 |
| GPT-4o-mini | 3,000 in + 800 out | 30 | $0.03 | $0.90 |
| DeepSeek V4 | 3,000 in + 800 out | 30 | $0.05 | $1.50 |
The 20× cost difference between Claude Sonnet 4 and GPT-4o-mini is the difference between “budget item” and “line item that needs approval.”
Pattern 2: Classification agent (500 calls/day)
The agent classifies incoming items (support tickets, content moderation, lead scoring).
| Model | Tokens/call | Calls/day | Daily cost | Monthly |
|---|---|---|---|---|
| Claude Haiku 3.5 | 500 in + 50 out | 500 | $0.30 | $9.00 |
| GPT-4o-mini | 500 in + 50 out | 500 | $0.05 | $1.50 |
| Gemini Flash 8B | 500 in + 50 out | 500 | $0.01 | $0.30 |
For classification, the cheapest model that meets accuracy requirements wins. Test accuracy first, then optimize cost.
Pattern 3: Long-context analysis (10K+ token inputs)
The agent reads full documents (contracts, reports, codebases).
| Model | Input tokens | Output | Per-call cost | 100 docs/month |
|---|---|---|---|---|
| Claude Opus 4.7 | 50,000 | 2,000 | $0.90 | $90 |
| Claude Sonnet 4 | 50,000 | 2,000 | $0.18 | $18 |
| Gemini 1.5 Pro | 50,000 | 2,000 | $0.20 | $20 |
| Gemini 1.5 Flash | 50,000 | 2,000 | $0.004 | $0.40 |
Gemini Flash at 50K tokens per doc is 225× cheaper than Opus. The quality gap matters — but for extraction tasks (pull specific fields from a contract), Flash often suffices.
Cache pricing: the hidden multiplier
Most providers now offer prompt caching that dramatically reduces cost for repeated prefixes (system prompts, few-shot examples, tool definitions).
| Provider | Cache write | Cache hit (read) | Savings vs full price |
|---|---|---|---|
| Anthropic | 1.25× base input | 0.1× base input | 90% on cached tokens |
| OpenAI | 1× base input (auto) | 0.5× base input | 50% on cached tokens |
| 1× base input | 0.25× base input | 75% on cached tokens |
Cache impact on agent costs
A typical agent has:
- System prompt: 2,000 tokens (cached after first call)
- Tool definitions: 1,500 tokens (cached)
- Conversation history: 500-5,000 tokens (varies)
- New user input: 200 tokens (never cached)
With a 3,500-token cacheable prefix on Claude Sonnet 4:
| Scenario | Input cost/call | Monthly (30 calls/day) |
|---|---|---|
| No cache | $0.0105 | $9.45 |
| With cache (90% hit) | $0.0015 | $1.35 |
| Savings | $8.10/month (86%) |
Cache is not optional for production agents. It is the single largest cost reduction lever available.
Anthropic’s split cache tiers (new in 2026)
Anthropic now offers two cache TTLs with different pricing:
| Tier | TTL | Write cost | Read cost | Best for |
|---|---|---|---|---|
| 5-minute cache | 5 min | 1.25× input | 0.1× input | Conversational agents (rapid turns) |
| 1-hour cache | 60 min | 1.5× input | 0.1× input | Batch processing, scheduled agents |
For a conversational agent making turns every 30 seconds, 5-minute cache catches everything. For a daily briefing agent, 1-hour cache covers the entire session but costs 20% more to write.
The real cost formula
Monthly cost = (input_tokens × input_price + output_tokens × output_price)
× calls_per_day × 30
× (1 - cache_hit_rate × cache_savings)
Worked example: competitor monitoring agent
From our Douyin competitor monitor tutorial:
- 1 LLM call/day with ~8,000 input tokens (all competitor data) + 1,000 output tokens
- Model: Claude Sonnet 4
- System prompt: 500 tokens (cacheable, but only 1 call/day so cache rarely hits)
Monthly = (8,000 × $3.00/M + 1,000 × $15.00/M) × 30
= ($0.024 + $0.015) × 30
= $1.17/month
With cache (if running more frequently): $0.15/month.
Cost optimization strategies
Strategy 1: Model cascading
Use a cheap model for initial classification, expensive model only when needed:
Input → GPT-4o-mini (classify) → 80% resolved → done ($0.0003/call)
→ 20% complex → Claude Sonnet 4 ($0.012/call)
Blended cost: 0.8 × $0.0003 + 0.2 × $0.012 = $0.0027/call
vs. all Sonnet: $0.012/call (4.4× more expensive)
Strategy 2: Token budget management
Set max_tokens explicitly. Don’t let the model ramble:
| Setting | Typical output | Cost impact |
|---|---|---|
| No limit (model decides) | 500-2,000 tokens | Unpredictable |
max_tokens: 500 | ≤500 tokens | Capped, predictable |
max_tokens: 100 | ≤100 tokens (classification) | Minimal output cost |
Strategy 3: Prompt compression
A 2,000-token system prompt costs $0.006/call on Sonnet 4. Compress to 800 tokens: $0.0024/call. Over 1,000 calls/day: saves $108/month.
Techniques: remove examples the model doesn’t need, use shorter phrasing, leverage fine-tuned models that need less instruction.
Per-call APIs vs token-based: when to mix
Social media data APIs cost $0.001/call regardless of data size. LLMs cost per-token. In a monitoring agent:
| Component | Pricing model | Cost driver |
|---|---|---|
| Fetch 10 profiles | Per-call ($0.001) | Number of accounts |
| Fetch 30 videos | Per-call ($0.001) | Number of videos |
| LLM analysis | Per-token | Length of input data |
If you feed all 30 video descriptions (600 tokens each = 18,000 tokens) to Claude Sonnet 4: $0.054 for the LLM call. If you first filter to only new/changed videos (usually 3-5): $0.009. Pre-filtering with cheap data APIs before expensive LLM calls is the most effective cost optimization.
More on this in our per-call vs token pricing guide.
FAQ
Which model is cheapest per million tokens?
Gemini Flash 8B at $0.0375/M input. But “cheapest” is the wrong question — “cheapest that meets my accuracy requirement” is right. Test with your actual prompts before optimizing for cost.
Does 1M context really cost 1M tokens per call?
No. Context window is the maximum. You only pay for tokens you actually send. A 1M-context model processing a 5,000-token prompt costs the same as a 128K-context model processing the same prompt.
Is caching worth it for agents that run once per day?
Usually not. Cache TTLs are 5-60 minutes. A daily agent’s cache expires between runs. Cache helps agents that make multiple calls within minutes (conversational, batch processing, rapid-fire tool use).
How do I predict my monthly LLM bill?
Run your agent for 1 day, count total input/output tokens (most SDKs expose usage in responses). Multiply: daily_tokens × price × 30. Add 20% buffer for retries and edge cases.
What about fine-tuned models?
Fine-tuned models cost 2-6× more per token but often need shorter prompts (fewer examples, less instruction). Net effect depends on your prompt-to-response ratio. Test both.
For more on how per-call and token pricing interact in agent architectures, see our upcoming per-call vs token pricing analysis.
Key takeaways
- The real cost is
price × tokens × frequency × days— not just $/M tokens - Cache reduces agent costs 50-90% for repeated system prompts; it is not optional in production
- Model cascading (cheap classifier → expensive reasoner) cuts blended cost 3-5×
- Pre-filter data before feeding to LLMs: 10 cheap API calls to narrow input saves more than switching models
- Test accuracy first, optimize cost second. A cheap model that gives wrong answers costs more in bad decisions than an expensive model that is right

