Why is LLM inference expensive? What drives the cost
Why is AI inference expensive? Each token needs the whole model read from memory, one at a time. Here is what drives the cost and why it outgrows training.
Updated
Inference is expensive because every token an AI model writes needs the whole model read from memory, and the tokens come out one at a time. Training is a large cost paid in bursts. Inference is paid on every call, so for a product that runs all day, it can become the bigger bill.
What drives LLM inference cost?
Three things set the price of a call: the size of the model, the number of tokens you send in, and the number of tokens you get back. Each one maps to real work for the hardware. A bigger model has more weights to move through memory for every token it produces. A longer prompt means more tokens to process before the first word of the answer appears. A longer answer means more sequential steps, and each step waits for the one before it.
Utilization decides the rest. A machine that serves one request at a time sits idle between steps, so the cost per call depends heavily on how many requests share the same hardware at once.
Why does each answer cost so much to produce?
A language model writes one token, then feeds that token back in to write the next. Each step passes the full context through the network, which means reading the model’s weights from memory. Reading memory is slow compared with the arithmetic itself, so the hardware spends much of its time waiting for data to arrive. Bigger models make this worse because there is more to read on every step.
The context also has to stay in memory while the answer is written. That cache grows with the prompt, which is why long prompts take space that could otherwise serve other requests. For the mechanics, read the KV cache explained.
This is also why output costs more than input. The model can read a long prompt in one parallel pass. It has to write output one step after another. Input vs output token cost covers the price split in detail.
Inference cost vs training cost: which one adds up?
Training is a project. You pay for a training run, usually once per version of the model, plus the evaluation work to check it. Inference is a meter. Every call pays again, and the bill grows with traffic. Training is a fixed cost that does not grow when your traffic doubles. Inference is a running cost.
Over time, that difference decides the math. A fine-tune that costs a fixed amount can be small next to a year of calls, so for a high-volume task, inference can be the larger line. The crossover depends on how many calls you make, how big the prompts are and how often you retrain.
Training is not free, though. It needs labeled data from your own records, a test set you trust, and someone to own the result. For a low-volume task, the training cost can outweigh what you save per call. In that case, keep the frontier API.
How much does a ChatGPT query cost to run?
We cannot tell you what it costs OpenAI to serve a ChatGPT query, and we do not guess at it. For what you pay per call, check OpenAI’s current pricing page, since prices change. You can still work out a cost for any model that has a published price.
Here is a hypothetical with round numbers. Say a call sends 2,000 input tokens and gets back 500 output tokens. At Claude Opus list price, $4 per million input tokens and $20 per million output tokens, the input costs $0.008 and the output costs $0.01, about $0.018 for the call. At Claude Haiku list price, $0.10 input and $0.50 output, the same call costs about $0.00045. Anthropic’s Batch API is half price for work that can wait.
What a trained smaller model changes, and when it is the wrong call
Price is only half the picture. The other half is whether the model does the job. Own Weights tests each trained model against the current one on your own data before it goes live. To check it yourself, divide each model’s cost on the same set of real requests by the answers it got right, because a model that costs a tenth as much per call but needs twice the human fixes may not be cheaper at all. The full method is in how to build a test set.
Self-hosting is the wrong choice in several cases. If your volume is low, the fixed work of training, testing and serving will not pay back. If the task changes every few weeks, you will retrain often. A trained model also gives up breadth, so it will not do the other things a general model does. If you have no one to run and test the model, a hosted API is the safer buy. And if a frontier model already costs little for your task, a smaller model may not be worth the effort.
The free AI cost audit reads your repository as text on your machine, uploads nothing, and lists each AI call, its model and its estimated cost, so you can see which calls are worth moving. If you would rather talk it through, ask us for a call.
Questions
Why are LLMs expensive to run?
Each generated token needs the full model read from memory, and tokens come out one after another. Cost rises with model size, prompt length and answer length, and it falls when many requests share the same hardware.
What is the difference between inference cost and training cost?
Training is a project cost paid to build a model version, usually once or now and then. Inference is charged on every call, so it keeps growing with traffic and often becomes the larger total over time.
How much does a ChatGPT query cost to run?
The provider's cost to serve a query is not public, and the price you pay is on OpenAI's current pricing page. Any per-call figure depends on the tokens in, the tokens out and the model, so work it out from published rates for your own prompts.
What drives LLM inference cost?
Model size, input tokens, output tokens, and how many requests share the hardware at once. Output tokens usually cost the most per token because the model writes them one step at a time.
Why does AI cost so much at scale?
Most of the spend is reading and writing tokens, and it is paid on every call instead of once. Long prompts, long answers, retries and agents that call a model many times all add up quickly.