Cost Per Million Tokens: The AI Economics Guide
How LLM API pricing works, why output tokens cost more than input, how to calculate actual task costs, and how prices have changed over time.
How LLM Pricing Works
LLM APIs charge per million tokens, with separate rates for input (your prompt) and output (the model's response). Output tokens cost more, typically 3-5× input prices, because each output token requires a full forward pass through the model. Input tokens can be processed more efficiently in batches. This asymmetry means minimizing output length is the most effective way to reduce costs.
Example: Claude Sonnet 4.6 costs $3/M input and $15/M output. A 1,000-token system prompt + 200-token user message = 1,200 input tokens ($0.0036). A 500-token response = 500 output tokens ($0.0075). Total: $0.0111 per interaction. At 100 interactions per day: $1.11/day or $33/month.
The Current Pricing Landscape
The cheapest capable models: Gemini 2.5 Flash Lite ($0.075/$0.30), Llama 4 Scout via API ($0.05/$0.17), GPT-4o Mini ($0.15/$0.60). Mid-tier: Gemini 2.5 Flash ($0.10/$0.40), Claude Haiku 4.6 ($0.80/$4.00), Mistral Small ($0.10/$0.30). Premium: Claude Sonnet 4.6 ($3/$15), GPT-4o ($2.50/$10). Frontier: Claude Opus 4 ($15/$75), GPT-5 Pro ($25/$100).
These prices have fallen dramatically: GPT-4 launched in 2023 at $30/$60 per million tokens. Claude 3 Sonnet launched at $3/$15. GPT-4o brought comparable capability for $2.50/$10. Prices continue falling as efficiency improves and competition intensifies.
Calculating Real Application Costs
Cost per API call = (input tokens × input price + output tokens × output price) / 1,000,000. For a customer support bot with 500-token system prompt, 150-token user messages, and 300-token responses using Claude Haiku: (650 × $0.80 + 300 × $4.00) / 1,000,000 = $0.00172/conversation. At 10,000 conversations/day: $17.20/day.
Common cost traps: long system prompts repeated on every call (use prompt caching), unnecessarily verbose outputs (set max_tokens and output format constraints), retries without backoff (redundant spending on errors), and using frontier models where mid-tier models suffice. Regular cost audits comparing model quality per dollar often find significant savings.
Cost Trends and What's Coming
AI inference costs have fallen approximately 10× per year since 2020, driven by algorithmic efficiency improvements, hardware improvements (H100 → B100), and competitive pressure. This trend is expected to continue, though the pace may slow as the easiest efficiency gains are captured.
Emerging pricing models include: reasoning tokens priced separately (OpenAI charges for thinking tokens at the same rate as output), tiered pricing for long-context requests, and subscription models for high-volume users. The shift toward smaller, efficient models means cost-quality tradeoffs are improving faster at the lower end of the market.
Read next
Tokens and Tokenization: The Building Blocks of LLMs
Everything you need to know about tokens, how LLMs split text into pieces, why tokenization matters for cost and performance, and how different languages tokenize.
Cheapest LLMs That Actually Deliver in 2025
Cost-effective AI models that don't compromise on quality. The best picks for budget-conscious developers and high-volume production applications.
LLM Cost Optimization: Reducing AI Spend Without Sacrificing Quality
Practical strategies to dramatically reduce LLM API costs, from prompt caching and model routing to batching, caching, and smart context management.

