TOOL · LLM INFERENCE COST

LLM inference cost

LLM inference cost is what you spend to turn a prompt into tokens, whether you pay an API or keep a GPU on. This page gives the short arithmetic, says what a token and a “cost” leave out, and works an example with inputs that are labelled as examples. The planner under the guide multiplies numbers you type. It does not look up a vendor list, and neither does the prose.

What is the short answer?

There are two sums, and they do not describe the same purchase. An API bill is a count of tokens times a price per million tokens that you were quoted. A self-hosted bill is a count of GPU-hours times a price per GPU-hour that you were quoted, for as long as those GPUs stay on, plus the people and the traffic the quote forgot. You can convert the second sum into a cost per million tokens only after you know how many tokens those hours actually produced. Utilisation is that missing fact. A smaller model does not fill it in.

The planner on this page does the first multiplication and the GPU-hour multiplication. It stops there. The worked arithmetic further down shows the extra division, using example inputs printed as examples, so you can see the shape of the sum before you replace every number with yours. If you do not have a throughput you measured on your prompts, stop at the GPU-hour total. A cost per million tokens you invented from someone else’s speed is not a plan.

Nothing in either sum is a quality result. A cheaper configuration that fails the written bar creates review work, and that work can exceed the token saving. The SLM versus LLM comparison is the size version of that rule. This page will not estimate the review.

What counts as a token?

A token is the unit the model and the bill share. It is not a word, not a character, and not stable across families. A tokenizer splits text into pieces the model was trained on. The same English sentence can be more tokens on one model than on another, and a document full of codes, names or a second language often splits into more pieces than a paragraph of ordinary prose. If you are comparing two checkpoints, count tokens with each checkpoint’s tokenizer. Do not reuse one count for both prices.

For an API, the tokens that matter are the ones the tariff meters. That usually includes the system prompt, the user text, any passages you pasted in for retrieval, and the tokens the model writes back. Retries count again. A refusal still spends the prompt. A streamed reply is not free because you stopped reading it. If the vendor bills cached prompt tokens at a different rate, that is a third price, and this page does not store it.

For a GPU you operate, the tokenizer still defines the work, but the bill does not arrive per token. The GPU is busy while it reads the prompt and while it writes the reply. Those two phases are not the same kind of work. Reading a long prompt can be done across many tokens at once. Writing the reply is usually one new token at a time for each sequence, because each token depends on the ones already written. A cost model that treats “a token” as one number will mis-state a workload that is mostly a long document in and a short label out, and it will mis-state the opposite workload too.

The planner asks for prompt tokens per request, completion tokens per request, and how many requests fall in the period. It adds the two token fields. Put retrieval passages into the prompt field. The formula will not add them for you, and it will not notice if your tokenizer disagrees with the number you typed.

What does the cost include?

Say which bill you mean. The GPU price, if you have one, is the charge for the device-hour: a cloud rate, an internal charge, or a slice of a machine you bought. It is not the whole cost of answering. Idle time is a cost when you keep the model loaded so the next request does not wait for weights to move. A GPU that answers for six hours and sits ready for eighteen has still been yours for twenty-four, if the contract says the machine stays on. Turning that into a “cost per token” by counting only the six hours hides the eighteen.

Operations are the rest of the system that makes the GPU usable. Someone patches the engine, watches the queue, rotates credentials, and answers when the box fills its memory. Evaluation is real traffic: the unused set has to be run somewhere, even when no customer sees it. Human review, when the model abstains or a person must sign the output, is a cost that never appears on a token screenshot. This page will not invent an hourly rate for that person.

Egress and storage sit beside the GPU. Weights have to arrive, logs have to leave, and a previous release has to remain so you can roll back. A cloud account that meters bytes out of the region will bill that traffic whether or not you remembered it in the token price. A log store in another product is a second vendor. The inference page is where those copies are named. The deployment essay is where the shapes of hosting are separated. Neither page contains a tariff, and this one does not either.

Training is not inference. A fine-tune is a separate bill, paid when you change behaviour, and then the adapted model still has an inference bill every month. The VRAM planner estimates a lower bound on training memory. It does not convert gigabytes into money. Add the training invoice beside the inference sum if you are comparing a year of serving with a one-off adaptation. Leaving it out is allowed only if you label the omission.

How do you turn a GPU-hour into a cost per million tokens?

The honest order is: price the hour, count the tokens that hour produced, then scale. Cost per million tokens equals the amount you paid for the GPUs in the period, times one million, divided by the tokens generated in that period. In symbols, using names rather than a borrowed rate: cost per million = (GPU count × price per GPU-hour × hours paid) × 1,000,000 / tokens generated. Hours paid include idle hours when the contract charges for them. Tokens generated do not include the idle time, because nothing was generated.

Here is the arithmetic with example inputs. None of these numbers is a market price, a benchmark, or a recommendation. Replace each one. Example GPU count: 1. Example price per GPU-hour: 2 currency units. Example throughput while the GPU is generating: 1,000 tokens per second. Example generating time: the full hour, 3,600 seconds.

Tokens in that busy hour = 1,000 × 3,600 = 3,600,000. Cost of the hour = 1 × 2 × 1 = 2 currency units. Cost per million tokens = 2 × 1,000,000 / 3,600,000 = 2 / 3.6 = 5/9 of a currency unit, which is 0.56 to the nearest hundredth of that unit. The division is exact at 5/9. The hundredth is rounding, not a new measurement. If your throughput is different, the 3,600,000 moves. If your price is different, the 2 moves. The shape of the sum does not.

A second example, still not a quote: the same GPU, the same 2 currency units for the hour, the same 1,000 tokens per second when it is generating, but it generates for 900 seconds and sits loaded for the other 2,700. You still pay 2. Tokens generated = 1,000 × 900 = 900,000. Cost per million = 2 × 1,000,000 / 900,000 = 2 / 0.9 = 20/9, which is 2.22 to the nearest hundredth. That is four times the busy-hour figure, because a quarter of the hour did the work and the price of the hour did not shrink. Multiplying the busy-hour cost by utilisation, instead of dividing by it, is the mistake that makes an idle box look cheap.

If several GPUs share the work, multiply the price by the GPU count before you divide. Two GPUs at the same example price cost 4 currency units an hour. They reduce the cost per million only if, together, they generate more than twice the tokens. A second GPU that only exists so the first can fail over does not generate those tokens. Count it in the price. Do not count it in the throughput unless it serves.

The same identity is what you type, in pieces, into a spreadsheet you trust: paid GPU cost on top, tokens you actually produced underneath, then times one million. The planner computes the top. It does not know the bottom. If you paste the planner’s GPU-hour total into this formula, keep the example label off it and put your date and your quote next to the price.

Example inputs only. Not a GPU price, not a tokens-per-second benchmark, not a tariff. Replace every figure before you use the result.
Example inputBusy hourQuarter of the hour busy
GPUs you pay for11
Price per GPU-hour (currency units)22
Tokens per second while generating1,0001,000
Seconds actually generating3,600900
Tokens generated3,600,000900,000
Cost of the hour22
Cost per million tokens5/9 (0.56 rounded)20/9 (2.22 rounded)

Why do utilisation and batching change the figure?

Utilisation, in this sum, is the share of the paid hour in which tokens are produced. In the second example it is 900 / 3,600 = 0.25. You can write the busy-hour cost per million divided by utilisation, and you get the same 2.22. That shortcut is safe only when the price is for the whole hour and the throughput during the busy slice is the throughput you used. It is not safe when the cloud charges only for seconds a job ran and then releases the GPU. In that metered shape, idle time is not on the bill, and utilisation is how you turn a token volume into hours: busy hours track tokens divided by throughput. You have not escaped the need for a throughput. You have made the bill proportional to it, and you have accepted a cold start while the weights load. This page will not invent the number of seconds that start takes.

Batching is why one GPU’s tokens per second is not a property of the model card. Serving several requests together can fill the device more fully, so the tokens per second in the example might be higher than a single lonely request. It can also break a latency budget, because a request waits for the batch, and it can fail when the key-value cache for those concurrent sequences does not fit. The vLLM paper describes PagedAttention as a way to pack that cache in pages. This site cites the mechanism. It does not carry a speed. If a batched measurement on your prompts showed twice the example’s 1,000 tokens per second, the busy-hour token count would be 7,200,000 and the example cost per million would be 2 / 7.2 = 5/18, or 0.28 to the nearest hundredth. That “twice” is a hypothetical replacement for the example input. It is not a claim that batching doubles throughput on your hardware.

Peaks matter more than a monthly average. A box sized for the average hour and then offered to the busy hour will queue or spill onto an API. Spill is a second contract, with a second price. Write it down. A failover replica that stays hot is another GPU in the paid count. A canary is another copy. Price the design you will run, not the single process that loaded the model once in a notebook.

The self-hosted versus API comparison walks the same utilisation point as a decision: do not multiply a GPU-hour cost by utilisation and also shorten the hours. This page’s job is the arithmetic you can check with a pencil. If you have no tokens-per-second figure from your own prompts, leave the cost per million blank. The GPU-hour total is still a number you can defend.

Why are input tokens and output tokens priced differently?

On many APIs the price per million input tokens and the price per million output tokens are different numbers on the same tariff card. The reasons are commercial as much as technical, and this page will not guess a ratio. What you should do is mechanical. Cost = input tokens × your input price / 1,000,000 + output tokens × your output price / 1,000,000. Add cached-prompt tokens on their own line if the tariff has one. If you truly pay one blended rate, you may add the tokens first and multiply once. If you blend two rates yourself to make the cell shorter, write the blend down. A hidden blend is how two people in the same meeting quote two bills.

The planner has one field, “your price per million tokens”, and it multiplies prompt tokens plus completion tokens by that single price. That matches a blended rate you have already decided. It does not match a split tariff unless you run the planner twice, once with the output field at zero and the input price, once with the prompt field at zero and the output price, and add the sums yourself. The page will not grow a second price box that looks like we know the split.

On hardware you operate, input and output still do not cost the same second. Prefill, the pass over the prompt, and decode, the loop that writes the reply, stress the GPU differently. A workload of long documents and one-word labels can be a different GPU plan from a workload of short questions and long drafts, even when the total token count matches. Do not convert both into one tokens-per-second number taken from a chat demo and then use it for a batch extraction job. Measure the shape you will serve, or refuse the cost-per-million figure.

Retrieval adds input tokens and sometimes a separate index cost. Put the passages in the prompt count. The index build, the refresh and the vector store are not in the planner. A system that looks cheap per completion and expensive per retrieved page has not been costed until both lines exist.

How does quantisation change the cost?

Quantisation stores each weight in fewer bits. GPTQ is one published post-training method for generative transformers. The parameter count stays. The bytes move. The VRAM planner’s storage widths are fp32 = 4 bytes, fp16 or bf16 = 2, int8 = 1, and 4-bit storage = 0.5, before scales and block metadata. A 4-bit file is larger than the 0.5-byte line. The width is a lower bound on the weight term, not a fit claim for a named GPU.

The cost effect is indirect, and it can go in two directions. Fewer bytes can let the same GPU hold the model, hold a longer cache, or hold a larger batch, which can raise the tokens per second in the formula above and so lower the cost per million, if you measured that rise. Fewer bytes can also let you drop a GPU, which lowers the GPU-hour price directly. Neither happens because a blog said 4-bit is “about as good”. A quantised checkpoint is a new hash. Run the unused set again. A cheaper miss is still a miss, and the review time belongs on the bill.

Quantisation does not change an API tariff unless the vendor sells the quantised endpoint at a different price, in which case you type that price. It does not shrink a licence. It does not move logs. Use it in the self-hosted column as a hypothesis about memory and throughput, then replace the hypothesis with a measurement before you treat the example’s 1,000 tokens per second as if quantisation had edited it.

When does self-hosting cost less than an API?

Break-even is the volume, or the price, at which two sums you computed are equal. It is not a token count this site publishes. The API sum uses your tariff. The self-hosted sum uses your machines, your hours and the ops you remembered to add. The comparison page is the decision between paying someone to run the weights and running them. This section is only the equality.

Work it in the currency of the example, and then throw the currency away. Example self-hosted bill: 1 GPU × 2 currency units per hour × 24 hours × 30 days = 1 × 2 × 720 = 1,440 currency units for a month kept on. Example API price: 1 currency unit per million tokens, one blended rate. The API bill equals 1,440 when tokens × 1 / 1,000,000 = 1,440, so tokens = 1,440 × 1,000,000 = 1.44 billion. That volume is the break-even for those example inputs only. Change the 2, the 720, or the 1, and the volume changes by the same arithmetic. If input and output prices differ, do not use this rearranged single price. Compute both sums at the volume you care about and compare them.

Two assumptions sit under that rearrangement, and they fail quietly. Adding tokens must not force another GPU. One price must really cover the mix of input and output. When either fails, recompute. A dedicated endpoint often fails them on purpose: a monthly commit plus a token rate is neither a pure API nor a pure GPU-hour. Map it as commit, plus expected overage, plus any traffic you still send elsewhere. Averaging it with a self-hosted GPU into a “hybrid rate” is not a method.

Ops sit outside both example sums. If the API price already contains the vendor’s operators and your self-hosted 1,440 does not contain yours, the equality is tilted. Add the on-call, the patching, the gateway and the log store beside the 1,440, or write zero and label it. Zero is a common way to make self-hosting look cheaper. Egress, evaluation compute and human review belong on the same side of the page as the design that causes them.

Residency can force the self-hosted column even when the API sum is lower, and it can permit the API even when you would rather own the box. That constraint is not a cell in the table. The inference operating plan names who runs the machine. The sovereign AI definition says what control has to be true before you use the word. A lower bill is not sovereignty. A higher bill is not prudence. Write the rule, then the sum.

Decision prompts, not scores.
WhenThen
You pay for the GPU whether or not requests arriveHours paid include the quiet hours. Divide by tokens generated, not by the seconds in the month.
You pay only for GPU time a job consumed, and callers can waitEstimate busy hours from tokens and a throughput you measured. State the cold start.
The tariff splits input and output pricesAdd two products. Do not ask the planner’s single price field to invent the split.
You have no throughput on your own promptsStop at the GPU-hour total and the API total. Leave cost per million tokens blank.

What can the planner not show?

The planner is the form under this guide. It has two fieldsets and no hidden constants. Hosted API cost = (prompt tokens + completion tokens) × requests × your price per million / 1,000,000. Self-hosted cost = GPUs × your price per GPU-hour × hours. Both results print two decimal places. The currency is whatever unit you typed. A blank price stays blank, so a missing quote cannot become a default.

It cannot show a split input and output price, a cached-prompt price, utilisation, tokens per second, batching, quantisation, egress, storage, evaluation, human review, or on-call. It cannot show idle time separately from the hours you type: if you want idle included, type those hours. It cannot show training. It cannot show quality, licence limits, or whether the prompt is allowed to leave the building. It cannot tell you that a smaller model is cheaper. It will multiply a foolish price as willingly as a careful one.

Use it to check the two products, then do the division on this page with a throughput you are prepared to defend. Bring the quote, the date of the quote, and the tokenizer you counted with. If a later document repeats one of the example figures — 2 currency units, 1,000 tokens per second, 5/9, 1,440, 1.44 billion — without saying “example”, it has left this page and become fiction.

Planner

Hosted API

API sum: —

Self-hosted

Self-hosted sum: —

Sources

  1. Frantar et al., GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers (Accessed November 2026). GPTQ is a post-training quantisation method for generative transformers. Quantisation stores weights in fewer bits. It does not reduce the parameter count, and this site does not treat the paper as a quality score on your task.
  2. Kwon et al., Efficient Memory Management for Large Language Model Serving with PagedAttention (SOSP 2023). The vLLM paper introduces PagedAttention, which stores the key-value cache in pages so a serving engine can pack and share cache blocks. This site cites the mechanism. It does not carry a speed figure.

Questions we hear first

What is LLM inference cost, in one line?

It is tokens times your API price, or GPU-hours times your GPU price, depending on who runs the model. A cost per million tokens for a GPU also needs the tokens that hour produced. This site does not publish the price or the speed.

Does the planner include idle GPUs?

Only if you type those hours. The self-hosted formula is GPUs times your hourly price times hours. It has no utilisation box. If the machine stays on overnight, the overnight hours belong in the hours field.

Should retrieval tokens be included?

Yes, if you send them to the model. Put passage tokens in the prompt-token field. The index itself, and any fee for the retrieval service, are extra lines the formula does not add.

Why is there only one API price field?

Because a single field cannot pretend to know your input price, your output price and your cached-prompt price. If those differ, compute each product and add them. Use the single field only for a rate that really is blended.

Will quantisation halve the bill?

Not as a rule. Fewer bits can change how many GPUs you need or how many tokens a GPU finishes, and they can also change quality. Re-measure throughput and re-test the task. Do not halve the example’s 2 currency units and call it a result.

Does a fine-tune reduce inference cost?

Only if it lets you use a cheaper serving setup that still passes your test. The reduction is not automatic, the training bill is separate, and the planner does not estimate either effect.

Is self-hosting cheaper once volume is high?

Sometimes the arithmetic says so, at a volume you computed from your prices and your throughput. High volume can also force more GPUs, more ops and a busy-hour spill back to an API. Recompute at that volume. Do not reuse the example’s 1.44 billion tokens.

Are the currency units pounds or dollars?

Neither. They are placeholders so the division can be checked. Type your own unit in the planner. The page formats two decimal places and does not convert currencies.

Start with one task and a written scope.

Bring the workflow, the constraints and where inference should run. We use that brief to decide whether sovereign LLM & SLM fine-tuning, retrieval or a readiness review is the right first step.

Explore your AI options