AI API Costs Calculator
A language model bill is two multiplications and a scale factor. The token counts drive the input side and the output side separately, because they are priced differently.
Monthly cost
$3.60
- Cost per request
- 0.00036
- Cost per 1,000 requests
- $0.36
- Input cost per request
- 0.00012
- Output cost per request
- 0.00024
- Annual cost
- $43.20
- Requests per $100 of budget
- 277,777.7778
- Output price per million
- 0.6
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
The formula this calculator uses
cost = (prompt tokens / 1M x input price) + (completion tokens / 1M x output price)
- t_in
- Prompt tokens sent, including any system prompt
- t_out
- Completion tokens the model returns
- p_in
- Price per million prompt tokens
- p_out
- Price per million completion tokens
How to check the result by hand
- 1
Convert both token counts into millions
Divide the prompt and completion token counts by a million. This converts them into the units the price is quoted in, which is per million tokens rather than per token.
- 2
Multiply by the two prices
Prompt millionths times the input price and completion millionths times the output price. The output multiple converts the input price into the output price first.
- 3
Add the two sides
Both are billed on the same request, so the per-request cost is their sum. On an 800 and 400 token split at $0.15 and $0.60 it is $0.00036.
- 4
Scale by the request volume
Multiply the per-request figure by the monthly request count to get the monthly bill, and by twelve to get the annual figure.
- 5
Divide a budget by the per-request cost
A fixed budget converts into a request count by division. That figure is the one to compare against a product plan when deciding what a feature can afford.
For worked examples, common mistakes and the limits of this formula, read the full How To Calculate AI API Costs page.