Token math and cost estimation
The single most important spreadsheet of your AI career is the cost-per-feature estimator. This lesson gives you the formula.
Calculating LLM cost is like calculating a phone bill. Per-minute price times minutes used, plus optional extras. Easy. People skip it and get shocked anyway.
Cost per request = (input_tokens / 1,000,000 * input_price) + (output_tokens / 1,000,000 * output_price).
Cost per feature per month = cost per request * requests per user per month * users.
Examples (illustrative 2026 prices):
| Model | Input ($/M tok) | Output ($/M tok) |
|---|---|---|
| GPT-4o mini | 0.15 | 0.60 |
| GPT-4o | 2.50 | 10.00 |
| Claude Haiku-class | 0.25 | 1.25 |
| Claude Sonnet-class | 3.00 | 15.00 |
| Gemini Flash | 0.075 | 0.30 |
(Check live prices before committing. These change quarterly.)
Build the estimator in a spreadsheet with columns: model, input price, output price, avg input tokens, avg output tokens, requests/user/month, users, cost/user/month, total/month. Add a "buffer 30%" column for spikes. This is your monthly burn projection.
Quick recall
3 prompts · think before you flip
Prompt 1 of 3
How do you compute cost per request?
Quiz time
1 question · tap an answer to check it
1. To halve API spend with least quality loss, your first move is usually
Finished lesson 3.5?
Mark complete to update your module progress and unlock the streak.