How to Estimate AI API Costs: A Worked Example
By Adam, AI Engineer · 31 October 2026 · 4 min read
You can estimate an AI feature's monthly cost with three numbers: requests per month, input tokens per request, and output tokens per request. Here is how to get them, with a worked example using current list prices.
The formula
Monthly cost = requests x (input tokens x input price + output tokens x output price) / 1,000,000
Prices are quoted per million tokens, which is why you divide by 1,000,000. A token is a small piece of text. In English, 1,000 tokens is roughly 750 words.
Step 1: Count what really goes in
Input is more than the user's question. It also includes your instructions, chat history and any documents you attach to the request. This is why a short question can still use thousands of tokens.
Step 2: Measure, do not guess
Run about 20 real examples through the API and average the token usage it reports. Use real data, because a neat test prompt is usually much shorter than real use.
Step 3: Work it out
Example: 100,000 requests a month, 3,000 input tokens and 400 output tokens each. That makes 300 million input tokens and 40 million output tokens. Prices are per million tokens, checked on 31 October 2026 on the OpenAI, Anthropic and Google pricing pages.
| Model | Input + output price | Monthly cost |
|---|---|---|
| GPT-6 Luna | $0.10 + $0.50 | $50 |
| Claude Haiku 5.5 | $0.10 + $0.50 | $50 |
| Gemini 3.8 Flash | $0.75 + $3.75 | $375 |
| GPT-6.1 Terra | $1 + $5 | $500 |
| Claude Sonnet 5.5 | $2 + $10 | $1,000 |
| Claude Fable 5.1 | $10 + $50 | $5,000 |
The same workload costs 100 times more on the most expensive model here than on the cheapest. Price says nothing about quality for your task, so test before you decide.
Step 4: Apply the discounts
- Caching: if much of each prompt repeats, providers charge far less for that part. On GPT-6.1 Terra, serving 70% of the input from cache takes the example from $500 to about $300. Some providers also charge to write or store the cache, so check their terms.
- Batch processing: OpenAI, Anthropic and Google all publish 50% discounts for delayed jobs. This suits reports and bulk tagging, not live chat. The example on GPT-6.1 Terra would fall to $250.
Step 5: Add a safety margin
Your token bill is not the full cost. Budget for retries, testing and growth in prompt size, and for the staff time spent checking results. Prices also change, as our recent price update shows. Check that your product still works financially if the model price doubles.
To try your own numbers across 11 models, use the free AI cost calculator.