On this pageCompare per request, not per token
Most comparisons between hosting a model yourself and calling an API divide a server's price by a peak throughput someone measured once, then hold the result against a price list. The answer flatters self-hosting every time, because a real server is busy only part of the day, serves your prompt lengths instead of a benchmark's, and needs someone to look after it. This guide gives you a method that runs on your own numbers, for per-token APIs and for per-seat AI tools.
Compare per request, not per token
API price sheets charge separately for input and output tokens, while a GPU's throughput depends on both prompt length and answer length. Mixing those units is where many calculations go wrong. Compare the cost of a typical request instead:
- API cost per request = input tokens × input price + output tokens × output price, with prices per million tokens from the provider's current sheet. Count cached-input discounts or batch pricing only if your workload really qualifies.
- Self-hosted cost per request = everything the server costs you in a month ÷ the requests it actually served that month.
The second line hides two traps: "everything it costs" and "actually served".
Utilization decides the self-hosted price
A rented GPU costs the same whether it works or idles. Benchmark the server at full load, and the cost of each request rises in direct proportion to the time it sits idle:
| Share of the month the server is busy | Cost per request compared with full load |
|---|---|
| 100% | 1× |
| 50% | 2× |
| 25% | 4× |
| 10% | 10× |
| 5% | 20× |
An internal assistant used during office hours keeps a server busy for about a quarter of the month at best: 22 working days of 8 hours is 176 of 720 hours, and nobody types continuously. A per-token API bills nothing at 3 a.m. Your server does.
Two habits push utilization up. The first is concurrency: an inference engine such as vLLM batches simultaneous requests, so total throughput grows with the number of users served at once while each user's speed drops a little. The second is scheduling: work that can wait, such as summaries, classification or embedding backfills, can run overnight and fill hours that would otherwise be paid for and wasted.
Measure throughput on your own workload
Published tokens-per-second figures come from someone else's model, card, engine version, prompt length and concurrency. Change any one of them and the number moves. Run the model you plan to use, with request shapes taken from your logs:
# start the model server
vllm serve Qwen/Qwen3-8B --max-model-len 16384
# second shell: 500 requests shaped like yours, 16 in flight at a time
vllm bench serve --model Qwen/Qwen3-8B --dataset-name random \
--random-input-len 1500 --random-output-len 300 \
--num-prompts 500 --max-concurrency 16
Read the request throughput and the latency percentiles in the summary. Repeat at a few concurrency levels and keep the highest throughput whose time to first token and time per output token your users would still accept. For llama.cpp, llama-bench reports prompt and generation speed for one stream at a time, which suits a personal setup but understates what a batched server can do.
Count what the server invoice leaves out
On the self-hosted side:
- Your time. Engine and driver updates, monitoring, incidents and model upgrades. Count those hours at the full cost of whoever does them.
- Evaluation. Every model change needs a run against a set of real prompts, or quality drifts without anyone noticing.
- Redundancy. One server is one point of failure. A second server, or an API kept as a fallback, costs money too.
- Context growth. Agent and retrieval prompts grow long. Longer prompts lower throughput, and a bigger KV cache can force a bigger card.
On the API side:
- Repeated context. Agents resend system prompts, tool definitions and file contents on every step. Caching helps only where the provider offers it and your prompts share a stable prefix.
- Failed work. Tokens spent on errors and retries are billed like successful ones.
- Changes you do not control. Providers adjust prices and retire models on their own schedule, and each retirement can mean migration work.
Seats or a shared server for coding tools
Per-seat AI coding tools are the other common comparison. The vendor side is easy to total: seats times the monthly price. Your side is harder, because the real question is capability more than cost. Coding agents burn tokens fast and gain the most from the strongest models, which are mostly offered only as services. An open-weight model on a shared GPU copes well with the predictable part of the work: completions, test scaffolding, mechanical refactors and documentation.
So many teams end up with a split instead of a switch. Keep seats for the people doing the hardest work, and send bulk jobs to a self-hosted model. A gateway such as LiteLLM turns that routing into configuration, with a budget per key so neither side surprises you at the end of the month.
A break-even script
Fill in your own measurements and today's prices. Nothing in it is a default worth keeping:
# break_even.py: replace every value with your own measurements and prices
SECONDS_PER_MONTH = 30 * 24 * 3600
server_per_month = 0.0 # GPU server invoice for one month
ops_hours, hourly_rate = 0.0, 0.0 # upkeep hours per month, and what an hour costs you
req_per_s = 0.0 # "Request throughput" from your benchmark
in_tokens, out_tokens = 1500, 300 # a typical request, from your logs
in_price, out_price = 0.0, 0.0 # API price per million input and output tokens
requests_per_month = 0 # your real monthly volume
self_monthly = server_per_month + ops_hours * hourly_rate
api_per_request = (in_tokens * in_price + out_tokens * out_price) / 1e6
capacity = req_per_s * SECONDS_PER_MONTH # full load, around the clock
print(f"API per month: {requests_per_month * api_per_request:,.2f}")
print(f"Self-hosted per month: {self_monthly:,.2f}")
if api_per_request and capacity:
break_even = self_monthly / api_per_request
print(f"Break-even volume: {break_even:,.0f} requests per month")
print(f"Utilization needed: {break_even / capacity:.0%} of full-load capacity")
print(f"Your utilization: {requests_per_month / capacity:.0%}")
Read the last two lines together. If break-even needs a utilization your traffic never reaches in a normal week, the API is cheaper, however good the peak benchmark looked. If your own utilization comes out above 100%, one server is not enough and the self-hosted side needs a second one in the formula.
Hourly billing keeps the measuring step cheap: a CloudSat GPU server costs from $405.08 for a full month, so a one-day benchmark costs a thirtieth of that.
When cost is not the deciding line
Price is one input. These settle the question faster when they apply:
- Data that cannot leave. Client files, health records or source code under contract may rule out third-party processing. Then the question becomes which server, not whether.
- A frozen model. Audits, evaluations and regulated workflows need the same model next quarter. A model you host changes only when you change it.
- Your own fine-tune. Adapters trained on private examples stay private, and one base model can serve several of them; the fine-tuning guide compares the methods.
- A flat bill. A fixed server price is easier to budget than token spend that tracks every busy week.
The API usually wins when traffic is light or bursty, when you need the strongest model available, or when nobody on the team has time to run a server.
FAQ
Is self-hosting cheaper per token?
Only at sustained high utilization, with a model that fits your hardware and meets your quality bar. At low or uneven volume, per-token pricing usually costs less, because you pay nothing while idle.
How many users can one GPU serve?
That depends on model size, context length and how long users will wait for the first token. Benchmark at rising concurrency and stop where latency becomes unacceptable. That point is your capacity.
Should I count electricity and hardware wear?
On a rented server they are part of the price. If you buy hardware, add power, cooling, the purchase spread over its useful life, and the cost of downtime when a part fails.
Can I mix self-hosted and API models?
Yes, and it is often the cheapest setup: a self-hosted model for steady bulk work, an API for hard or bursty requests, and a gateway in front that decides where each request goes.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




