Finance · 109 calculators
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.
Last updated
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.
Common Questions
How does the AI API Costs Calculator work?
800 prompt tokens and 400 completion tokens at $0.15 and $0.60 per million is $0.00036 a request. At 10,000 requests a month that is $3.60, and $100 buys about 277,778 requests.
What do I need to enter in the AI API Costs Calculator?
It takes 5 inputs: Input price per million tokens, Output price multiple, Prompt tokens per request, Completion tokens per request, Requests per month. Fields that expect a unit say so next to the label.
Where does Monthly cost come from?
It comes from cost = (t_in / 1,000,000) x p_in + (t_out / 1,000,000) x p_out — each token count is divided by a million to convert it into units of the quoted price, then multiplied by that price. The two sides are added because both are billed.
What is the most common mistake with the AI API Costs Calculator?
Counting only the completion tokens. The prompt is billed as well, and on retrieval-heavy designs it is the larger half. A design that returns few tokens can still be expensive because of what it reads.
For worked examples, common mistakes and the limits of this formula, read the full How To Calculate AI API Costs page.
