AI API Cost Calculator
Estimate token-based API cost using input and output rates you supply.
Enter your details
Example values are prefilled. Change them to explore your scenario.
Calculations run locally in your browser. Estimates depend on the inputs and assumptions below.
How to use this calculator
- Enter the values in the units printed beside each field.
- Check the model assumptions, then press Calculate.
- Review the result, compare the worked example, and change one input at a time.
Formula and assumptions
Cost = input tokens / 1,000,000 × input price + output tokens / 1,000,000 × output price.
Worked example
100,000 input tokens at an example $1/million plus 20,000 output tokens at an example $4/million costs $0.18.
The prefilled scenario below uses these inputs:
- Input tokens: 100000
- Output tokens: 20000
- Your input price ($ per million tokens): 1
- Your output price ($ per million tokens): 4
| Example output | Result |
|---|---|
| Estimated token cost | $0.18 |
| Input cost | $0.1 |
| Output cost | $0.08 |
Read the result carefully
Input and output can have different rates. Check the exact provider, model, billing unit and current pricing before budgeting.
Limits and rounding
Default prices are invented examples, not a provider’s current pricing. No API calls are made; cached, audio, image and tool charges are excluded.
Displayed values are rounded for readability; the calculation uses unrounded intermediate values where practical. Change one input at a time to understand how the model responds.
Common questions
What do the default inputs represent?
They are illustrative examples, not current offers, personal recommendations, or a prediction. Replace them with your own relevant values.
How should I check the answer?
Use the formula and worked example on this page. Keep time periods and units consistent and read the stated model limits.
Method and references
Prices and model limits are user inputs. Check the selected provider’s current official documentation before budgeting. This page does not maintain a live price feed or call an AI service.
Understand the numbers
Estimate AI API Spend With Separate Input and Output Tokens →


