Is it cheaper to self-host?
The published answers to this range from two million tokens a day to five hundred million, a spread of more than a hundred times, and none of them are wrong so much as underspecified. Four things decide it, and most write-ups state one of them. Set all four below and the question becomes answerable, though often not in the direction the person asking was hoping.
Self-hosting wins here, at 5.8x cheaper, and the fleet still sits idle 81% of the time. You are not buying cheaper tokens so much as buying a lot of tokens you have already paid for. The saving survives only while the volume does.
| Same fleet, compared against | API / month | Self-host is | Verdict |
|---|---|---|---|
| Claude Fable 5.1 | $112K | 29.2x cheaper | self-host |
| Claude Opus 5 | $56K | 14.6x cheaper | self-host |
| Claude Sonnet 5 | $22K | 5.8x cheaper | self-host |
| GPT-6 Astra | $112K | 29.2x cheaper | self-host |
| GPT-5.6 Terra | $23K | 6.0x cheaper | self-host |
| GPT-5.6 Luna | $2.3K | 1.7x dearer | api |
| Gemini 3.8 Flash | $7.0K | 1.8x cheaper | self-host |
| GLM-5.3 | $12K | 3.2x cheaper | self-host |
| GLM-5.3 Flash | $783 | 4.9x dearer | api |
| DeepSeek V4.1 Flash | $1.3K | 2.9x dearer | api |
| DeepSeek V4 Pro | $5.0K | 1.3x cheaper | self-host |
Self-hosting is a utilisation bet, not a price bet. A rented GPU costs the same idle as busy, so what you actually buy is capacity, and what you actually use is a fraction of it. On the workloads above that fraction lands between 2% and 24%: you pay for twenty-four hours and the work takes under an hour. Every calculation that quotes a cost per million tokens for self-hosting has quietly assumed a utilisation, and that assumption is doing more work than the GPU price. This is also why the answer is unstable in a way an API bill is not, since a quiet week costs you exactly the same as a busy one.
Which API you are escaping matters more than anything about your hardware. Hold the fleet fixed and walk down the comparison table: the same self-hosted setup can be six times cheaper than a frontier model and thirty times dearer than an open-weights one on somebody else’s hardware, and nothing about your deployment changed between those two rows. Most people arrive at this question comparing against the most expensive thing they are running. If the task would survive a cheaper hosted model, that experiment is faster and considerably less expensive than buying anything.
That is where the hundredfold disagreement comes from. A guide comparing a self-hosted 8B against a flagship API at a generous utilisation gets a breakeven in the low millions of tokens a day. One comparing the same deployment against a budget model at realistic utilisation gets a figure a hundred times higher, or none at all. Both did the arithmetic correctly. Neither told you which four assumptions they were holding, so neither number transfers to your situation, including the ones on this page unless you have set the controls to look like you.
The person maintaining it is a real line, and it is the one that gets left out. Set the operator slider to zero and watch several verdicts flip. A serving stack needs upgrades, monitoring, capacity planning and somebody awake when it falls over at 3am, and that cost does not scale down when your traffic does. It is also the line most likely to be underestimated by whoever is proposing the migration, because it is the one that lands on a different budget than the GPUs.
Reasons to self-host that are not cost
Data that cannot leave. If the blocker is regulatory rather than financial, the arithmetic above is beside the point and you should read it the other way round: as the price of the constraint rather than a case against it. What a hosted provider can and cannot promise you is the subject of the zero-retention page.
A model nobody hosts. A fine-tune, a merged model, or an open model too obscure for the serving market. No API comparison exists, so no breakeven does either.
Latency you control. On your own hardware the tail is yours to fix. On somebody else’s it is theirs, and the measured spread across routes to one model was 6.8x in cost and several times in first-token latency.
Not being repriced. A fleet costs what it costs. An API can change its rate card, deprecate the model you built on, or quietly change the quantisation it serves. That is a real form of risk and it does not appear in either column.
What this model leaves out
Quality, entirely. It prices two ways of serving tokens and says nothing about whether the model you would host does your task as well as the one you are comparing it to. If it needs two attempts where the other needed one, every number here is wrong by a factor of two, and that comparison is an evaluation on your own data rather than anything a calculator can tell you.
The rooflines are ceilings. Prefill at 40% of peak FLOPs and decode at 80% of peak bandwidth are good production figures, not guarantees, and a real engine on a real workload with uneven sequence lengths will fall short of both. Treat a verdict inside about 1.5x as too close to call.
Everything around the GPU: storage, egress, the load balancer, a staging environment, the second region you will want, and the weeks before any of it serves traffic. Also the opposite direction, the discounts that appear at commitment, which can halve the hourly rate the slider starts at.
Bursting between the two. The arrangement most teams actually land on is a fleet sized for the steady load with the API absorbing the peaks, which beats either column here and is harder to draw.
Read next
- api-bill/
- What actually drives my LLM API bill?
Re-reading history. Output is expensive per token; history is expensive because you pay for it every turn.
- What does zero data retention actually cover?
The stateless call. Anything that remembers for you is outside it.
- Should I route everything through OpenRouter?
A router is the right way to start and the wrong way to stay, and the difference is measurable.
- explainers/
- A batch is only as fast as its slowest member
Where the batch in the decode ceiling comes from, and why a server is efficient in a way a laptop is not.
- Two phases, two bottlenecks
Why prefill is priced in FLOPs and decode in bandwidth, which is why they are counted separately above.
- Cut every matrix, or cut the stack
What happens once a model needs more than one card, which is the replica size in the fleet above.
- at-home/