How AI API Pricing Works
AI pricing guide · updated 2026-08-07
Almost every AI API bills the same way: you pay per token, separately for what you send and what the model generates. Everything else (caching discounts, batch tiers, long-context surcharges) is a modifier on those two rates. Understanding the shape of it is what separates an estimate that holds from one that is out by an order of magnitude.
You are billed per token, in two directions
A token is roughly four characters of English text, so about 0.75 words. Providers quote rates per million tokens, and they quote two of them: one for input (your system prompt, retrieved context, conversation history and the user's message) and one for output (whatever the model generates back).
Your cost for a single request is therefore input tokens × input rate, plus output tokens × output rate. That is the whole model. Everything below is a discount, a surcharge, or a way of estimating those two token counts before you commit.
The one thing that surprises people is that input is not free just because you did not write it. Retrieved documents, few-shot examples and a long conversation transcript are all input tokens, billed on every request that includes them.
Output costs more than input, usually about double
Across the 271 text models we track, the median model charges 2× more per output token than per input token, and 117 of them charge at least 3× more. The widest gap in the catalogue is 8.3×.
The reason is mechanical. Input tokens are processed in parallel in a single forward pass, whereas output is produced one token at a time, each requiring its own pass over the entire context. Generation is simply more compute per token, and the price sheet reflects it.
The practical consequence is that two models with the same input rate can differ enormously in real cost, and a "cheap" model can be the expensive choice for anything that writes at length.
The price range is wider than almost anyone expects
On a blended basis (weighting input at 70% and output at 30%) the models we track run from $0.02 to $33.00 per million tokens. That is a spread of roughly 1,600×, with the median at $0.80.
No other input to a software budget varies by three orders of magnitude for a broadly similar function. It means model selection, not prompt micro-optimisation, is where the money is: moving a workload from the median to the cheap end of models that still meet your quality bar dwarfs any saving from trimming tokens.
Modifiers that change the effective rate
Prompt caching is the largest. Providers that support it typically charge about 10% of the standard input rate for cached reads, every cached-input rate in our catalogue is a 90% discount on the model's input price. If your requests share a long stable prefix, this is the single biggest lever available.
Batch processing usually halves both rates in exchange for asynchronous delivery, typically within 24 hours. Free of quality cost, so it is close to a pure win for anything that is not user-facing.
Long-context tiers work the other way. Several providers charge a higher rate above a threshold (commonly around 200K tokens) so a request that spills past it can cost double per token. Worth checking before designing a system that routinely sends very large prompts.
What actually drives your bill
In roughly descending order: which model you chose, how many requests you make, how much output you generate per request, how much context you resend on each request, and only then the finer details of caching and batching.
That ordering matters because effort tends to flow the other way. Teams often tune prompts for weeks while running everything through a frontier model, when routing the routine 80% of traffic to a model twenty times cheaper would save far more with less work.
It is also why per-request cost is a misleading metric on its own. A request costing a fraction of a cent is irrelevant until you multiply it by volume, and volume is the number most estimates get wrong.
Frequently asked questions
How much does an AI API cost?
It depends enormously on the model. Across the models we track, blended cost ranges from about $0.02 to $33.00 per million tokens (a spread of roughly 1,600×) with a median near $0.80. A million tokens is around 750,000 words, so for many applications the monthly bill is driven far more by which model you picked than by how much text you send.
Why is output more expensive than input?
Input is processed in one parallel pass, while output is generated one token at a time, each requiring a full pass over the whole context. That is more compute per token, and pricing reflects it. The median model in our catalogue charges 2× more for output, and 117 of 271 charge at least 3× more.
What is the cheapest way to run an AI API?
Pick the cheapest model that still passes your quality bar, that decision dominates everything else. Then use prompt caching if your requests share a long stable prefix (typically a 90% discount on cached input), and batch processing for anything not user-facing (usually 50% off both rates). Trimming prompt tokens matters least of the four.
Do I pay for the conversation history every time?
Yes. Each API call is stateless, so the full transcript you resend counts as input tokens on every request. A long conversation therefore gets progressively more expensive per turn, which is why caching and periodic summarisation matter for chat applications.
See it in the data
Related guides
Terms used in this guide
Published by Tokenando. Last updated 2026-08-07. Figures in this guide are computed from our own pricing index and dated where they can move; see the methodology and corrections policy.