How to calculate AI API costs (2026 guide)

Working out what an AI API will cost is mostly simple maths. The tricky part is getting honest numbers to put into it. This guide follows one real request through to the bill and shows you where the surprises usually hide.

Updated 2026-06-29

The basic idea

An AI API charges you for two things: the text you send in, and the text it sends back. Both are priced per million "tokens" - and a token is just under a word. So the rough monthly cost is the price of one request multiplied by how many requests you make. That's the easy bit. The real work is getting the numbers right and remembering the extra costs that pile up once real people start using it.

Step 1: count words, not guesses

Write down how long a typical message in is and how long a typical answer back is. Don't forget the standing instructions you send every time (the "system prompt") - they ride along on every request, so they add up fast. Not sure how long your text is? Paste it into the token counter and it'll tell you.

Step 2: pick the right price

Prices vary wildly - the top models can cost fifty times more than a small one that would do the job just as well. Check the current prices before you commit, because they change often.

Step 3: add the things that creep in

  • Retries. When a call fails, it runs again. If one in ten fails, that's 10% on top.
  • Tool use. Every time the AI looks something up, that's an extra round-trip you pay for.
  • Search. Apps that search your own documents pay a little to do it.
  • Human checking. Anything risky usually needs a person to look it over.

Step 4: take off the discounts

Two things work in your favour. If you send the same text every time, caching lets you stop paying full price for it. And work that doesn't need an instant answer can run as overnight "batch" jobs for about half price. The API cost calculator lets you switch both on and see the difference.

A worked example

Say you make 200,000 requests a month, sending about 1,100 words in and getting 375 back, on a cheap model. That works out to roughly $105 a month before any retries, caching or cushion. Add a 15% safety margin and you'd budget about $120. That's a number you can defend in a planning meeting - which is the whole point.

Start from a real request, not your imagination

The fastest way to get this wrong is to open a spreadsheet and invent an "average prompt." Pull twenty or thirty real requests from a prototype instead. That's enough to show the true shape of things: the short questions, the long documents, the unusually chatty answers and the awkward cases that fail and retry.

For each one, note how much went in, how much came back, which model, and whether the answer was actually good enough to use. Use a typical case for your normal estimate and a heavier one for a cautious estimate - averages hide the handful of giant prompts that quietly drive the bill.

Keep two questions apart

First: what does one finished piece of work cost? Second: how many will you do a month? If one summary costs a fifth of a cent and a customer makes 40 a month, that customer costs you about eight cents. That per-task number is far easier to reason about than one big monthly total.

Give the volume its own range too. A new product rarely knows whether 5% or 30% of people will use an AI feature, so run a cautious case and a busier one. You end up with a sensible band, not a falsely precise forecast.

The API bill isn't the whole bill

The model is just one line. A real feature might also need storage, search, monitoring, content checks, support and human review. These behave differently: the model cost grows with use, but hosting and monitoring are there even in a quiet month, and review time grows with the number of risky cases. Keep them as separate lines at first - when the real invoice lands, you'll know exactly which guess was off.

A simple routine

  1. Measure a handful of real requests on the model you'll actually use.
  2. Work out the cost of one finished task, including retries.
  3. Multiply by a low, expected, busy and worst-case monthly volume.
  4. Add the non-AI costs and any human time.
  5. Add a cushion for launch, then swap your guesses for real numbers each month.

The AI API cost calculator runs these in seconds. The habit that matters isn't producing one number - it's keeping that number tied to real evidence.

Related reading and tools