LLM cost calculator: API vs self-hosted

What your token volume costs on an API, on a rented GPU server and on hardware you own, and the volume where self-hosting breaks even. Runs in your browser; prices are editable examples.

Your usage
API price
Rented GPU server
Owned server
Running a self-hosted model

Monthly volume: 110,000 requests, 220.0M in / 44.0M out tokens

OptionPer monthRelative cost
API$1,320
Rented GPU server$5,150
Owned server$4,036

Servers needed for this load1 (4% of one server)
Break-even vs API, owned server15,290 requests a day
Break-even vs API, rented server19,508 requests a day

How the comparison works

API cost = requests × (input tokens × input price + output tokens × output price).

Rented server = GPUs × hourly price × 730 hours, because a production model stays up all month, plus the engineering time to run it.

Owned server = purchase price spread over the write-off period + power (kW × 730 hours × price per kWh) + rack space, plus the same engineering time.

Capacity. One server generates its throughput in output tokens per second during the hours your load is spread over. When the load needs more than one server, the calculator adds servers. Measure throughput with your model, your prompts and a serving engine such as vLLM; it varies several times between setups.

Break-even is the daily volume at which one self-hosted server costs the same as the API. Below it the API is cheaper; above it each extra request on your own server is close to free until the server is full.

What usually decides it

  • Volume and steadiness. Self-hosting pays off for heavy, predictable daily load; spiky or small workloads stay cheaper on an API.
  • Which API you compare with. Against frontier-model prices the break-even comes much earlier than against small, cheap models.
  • Data rules. When contracts, GDPR, HIPAA or client confidentiality forbid sending data to an outside provider, the comparison is between a private deployment and not using AI on that data at all.
  • Quality. Test whether an open-weight model is good enough on your own examples before you compare prices.

Questions

When is a self-hosted LLM cheaper than an API?

When your volume is high and steady. A GPU server costs the same whether it is busy or idle, while an API charges per token. With frontier-model API prices, a team sending a few thousand short requests a day usually pays less on the API; tens of thousands of long requests a day, every working day, often pay less on owned hardware.

Is a smaller self-hosted model as good as a frontier API?

Not on open-ended reasoning. On a narrow task with your own data, a tuned open-weight model often comes close, which is why the comparison only makes sense once you have tested quality on your examples.

What does this calculator leave out?

Discounts and committed-use pricing, prompt caching on the API side, the cost of the pilot and setup work, redundancy (a second server for failover), and the value of keeping data in house. Add those to your own numbers.

Where do the default numbers come from?

They are round example values, not quotes: an API tier of $3 per million input and $15 per million output tokens, a two-GPU server at $2.50 per GPU hour rented or $70,000 bought, and 1,500 output tokens per second of throughput. Replace them with your provider prices and a measured throughput.

Check whether your model fits the GPUs first with the LLM VRAM calculator.