29 Oct 2026 · ia, custo, llm · 5 min
How much does one million tokens cost
The cost of one million tokens depends more on the model than on the volume. In October 2026, the gap between the cheapest and the most expensive option is two orders of magnitude for the same million output tokens. One measurement of my own on a common CPU: the qwen2.5:0.5b model running in Ollama generated 23.8 tokens per second, or 11.7 hours for one million tokens. The local cost is hardware and electricity, not the token.
What the table measures
The prices below are per one million output tokens, which is where the bill weighs. Input tokens cost three to ten times less at most providers, and prompt caching cuts even more. The table does not include request fees, cache storage or embedding cost.
| Option | Output per 1M tokens | Note |
|---|---|---|
| Local, qwen2.5:0.5b on CPU | US$ 0 | hardware already paid; 23.8 tok/s measured |
| DeepSeek V4 Flash | US$ 0.28 | cache hit at US$ 0.0028 |
| Gemini 2.5 Flash-Lite | US$ 0.40 | free tier with daily limit |
| Claude Haiku 5.5 | US$ 0.50 | below 100k tokens per request |
| GPT-6 Luna | US$ 0.50 | input at US$ 0.10 |
For comparison, a top model such as GPT-6 Astra charges US$ 50.00 per million output tokens. The gap between the cheapest and the most expensive is a hundredfold. Most applications do not need the most expensive model for most of their calls.
The local measurement
I ran the qwen2.5:0.5b model in Ollama inside a container, through the local API, asking for 300 output tokens. Three runs landed between 22.7 and 23.8 tokens per second. I used 23.8 as the reference. The math is direct: one million divided by 23.8 gives 42,016 seconds, or 11.7 hours. On a four-core CPU with no GPU.
That number is the ceiling of what fits on a small machine. Larger models drop to 2 to 5 tokens per second on the same CPU, and then one million tokens takes days. The trade is quality: qwen2.5:0.5b answers short and fails on long tasks. It works for classification, field extraction and short summaries. It does not work for long code or reasoning.
What nobody puts in the bill
- Energy and cooling of the host, if the model runs 24 hours a day.
- The RAM taken by the model, which stops serving something else. qwen2.5:0.5b takes about 400 MB of memory.
- The engineering time to keep the service up, update the model and handle downtime.
- Latency: 23.8 tokens per second is slow for interactive chat, but fine for batch work.
So the fair comparison is not just price per token. It is price per token plus the cost of operating. For low volume, the provider wins. For high volume and a simple task, local wins, provided the team accepts operating the service.
How to decide
Start with the task, not the price. If the task accepts a small model, test locally first and measure tokens per second on your machine, as I did here. If the task needs a large model, calculate the monthly volume and multiply by the provider’s output price. The turning point usually shows up between 10 and 50 million tokens per month for a Haiku-class model.
To control cost at a provider, use prompt caching, short output and a weaker model on the first attempt. Cost per AI consumer shows how to attribute the bill to whoever consumes. To measure what the model consumes in RAM on the host, see measure the memory of a process.
How to verify
curl -s -X POST http://127.0.0.1:11434/api/generate \
-d '{"model":"qwen2.5:0.5b","prompt":"Explique o que e um container Linux.","stream":false,"options":{"num_predict":300}}' \
| jq '{tokens: .eval_count, segundos: (.eval_duration/1000000000), tok_s: (.eval_count/(.eval_duration/1000000000))}'
Expected output: about 300 tokens, 12.6 seconds and 23.8 tokens per second. Your machine may vary, but not by much.
If it breaks
connection refusedon port 11434: Ollama is not running. Start it withollama serveor use the container.model not found: download it withollama pull qwen2.5:0.5b.- A number far below 20 tok/s: the CPU is busy with another process or memory is at the limit. Close loads and try again.
- JSON without
eval_count: the response was streamed. Make sure"stream":falseis set.
FAQ
Is one million tokens a lot? It depends. A support chat with 500 interactions per day and 2,000 tokens per interaction passes 30 million per month. A script that runs once a day may use 10 thousand.
Do input and output tokens cost the same? No. Output costs three to ten times more. A long prompt with a short answer is cheap; the opposite is not.
Is it worth running a local model in production? For a simple task and high volume, yes. For a complex task and low volume, the provider is cheaper once you count operating time. Measure both before deciding.
What about prompt cache cost? DeepSeek charges US$ 0.0028 per million tokens on a cache hit. Anthropic and OpenAI have a similar discount. If the same prefix repeats, the cache changes the bill.
How do I compare models of different sizes? Do not compare price only. A US$ 0.50 model may need two calls to get right what a US$ 5 model gets in one. Measure accuracy and total task cost, not cost per token.
Sources
- OpenAI API pricing, consulted on 29 October 2026.
- DeepSeek platform, consulted on 29 October 2026.
- Gemini Developer API pricing, consulted on 29 October 2026.
- Claude pricing, consulted on 29 October 2026.