AI API cost calculator

Enter the price per million tokens, how many tokens a request uses and how many requests you make. See the cost per request, per day, per month and per year, and compare two models.

  • Free
  • No sign-up
  • Runs in your browser
ai-api-cost-calculator

The prices shown are only examples. Enter the current prices from your provider's pricing page, because they change and differ between models.

Per 1 million tokens
Per 1 million tokens
Batch or cache discount, if any

Compare with another model (optional)

Per 1 million tokens
Per 1 million tokens

Fill in the values above to see the result.

100% private — the calculation is done in your browser and nothing is sent to any server.

How it works

Enter the prices

Input and output price per million tokens, from your provider.

Describe your usage

Tokens per request and requests per day.

Compare and decide

See the monthly bill, and compare a second model.

Know the bill before you build

Large language model APIs charge by the token, a small piece of text of roughly three to four characters in English. The cost of one request is tiny, a fraction of a cent, which makes it easy to ignore until a product goes live and thousands of requests turn into a real monthly bill. Working out the cost early helps you choose a model, decide how long your prompts can be and set a price for your own product that leaves a margin.

How the cost is calculated

Providers publish two prices per model, usually per million tokens: one for input, the text you send, and a higher one for output, the text the model writes. The cost of a request is the input tokens times the input price plus the output tokens times the output price, divided by a million. Multiply by requests per day and the days in a month and you have the monthly figure. A discount field covers batch processing or cached input, when your provider offers them.

The prices are yours to enter

This calculator does not ship with a price list, on purpose. Prices change often, differ between models and tiers, and may include extras such as cached input, long-context surcharges or regional pricing. The numbers pre-filled in the form are only examples so that you can see how it works. Copy the current rates from your provider's pricing page for a real estimate.

Reading the result

  • Cost per request, day, month and year for your usage.
  • Tokens per month, split into input and output, useful for checking quotas and rate limits.
  • Input and output share, which shows what drives the cost. Long answers cost more than long questions because output tokens are pricier.
  • Comparison. Fill in a second model to see the monthly difference and which one is cheaper for your usage.

Tips to lower the cost

Shorter prompts and instructions, trimming the context you resend, limiting the length of answers, caching repeated input and using a smaller model for simple tasks are the usual levers. If you do not know how many tokens your text uses, the token counter gives an estimate.

Limits

It is an estimate. Real bills depend on the exact tokenizer, on tokens you do not see, such as system messages and tool definitions, on retries, and on features billed separately such as images, audio or tool calls. Nothing you enter leaves your browser.

Frequently asked questions

How do I calculate the cost of an AI API?
Multiply input tokens by the input price and output tokens by the output price, divide by one million, and multiply by the number of requests. This tool does it for you.
Why are the prices not filled in for me?
Prices change often and differ between models, so a built-in list would go out of date. Enter the current prices from your provider's pricing page.
Why is output more expensive than input?
Most providers charge more per token for the text the model generates than for the text you send. The tool shows how the cost splits between the two.
Can I compare two models?
Yes. Fill in the second model's prices and you get its monthly cost and the difference with the first.
What is the discount field for?
For a percentage off, such as a discount for batch processing or cached input, if your provider offers one. It applies to both models.
Is this an exact bill?
No. It is an estimate based on the numbers you enter. Hidden tokens, retries and separately billed features can change the real total.