Self-Hosting LLMs: Running a Model as a ServiceMixed sources3 sources, drawn from a mix of official docs, project repositories and research.This rates where the sources come from. It doesn't prove every claim.
Break-even maths, GPU sizing from weights and KV cache, choosing between vLLM, SGLang and llama.cpp, and what to scale and alert on once open-weight models carry production traffic.
By Amit UpadhyayPublished 9 minArticle 7 of 13 in LLM Model Landscape
AI assistant · answers from this article
1 of 6
Spiky traffic, no data constraint
Nothing to add yet
An API costs nothing while it is idle. For spiky traffic that is hard to beat.
On this page
Self-hosted models, in one sentence
Self-hosting means running an open model on GPUs you pay for by the hour, so you are operating a service and the model is only one part of it.
You reach for it when a team wonders whether to stop paying per token and run its own model. Not before: it costs GPUs, an on-call rotation, upgrades, and quality that usually trails the best hosted models.
The cheat sheet
What to use when
You do not need all of this on day one. Each row is one signal and the piece that answers it. Stop at the row your system has reached, or pick one to see it in the picture above.
Where you areThe signalWhat to useWhat it costs
None. Usage peaks in office hours, and the data may go to a provider.Nothing. Keep paying per tokenNothing
Legal says customer documents cannot leave the region, or traffic keeps GPUs busy most of the day.Self-hosting, after a break-even sum that includes utilisation and peopleThe break-even maths ↓GPUs billed by the hour, busy or not, and an owner for the service
The server allows 128k tokens per request, and real prompts are 4k.A context limit set from your real prompt distributionSizing ↓A hard cap on the occasional long request
A benchmark with fifty-token prompts promised a throughput that production never reaches.A benchmark with real prompt and output lengths, at peak concurrencyA production launch ↓A realistic load test before any promise
A new replica takes minutes to load, and autoscaling on CPU never triggers.Weights cached on local disk, and scaling on queue depthOn Kubernetes ↓A custom metric and a persistent volume
Latency jumps, and nobody can say whether the queue or the cache is full.Watch waiting requests, KV cache use and p95 time to first tokenWhat to watch ↓Dashboards and alerts to own
Start by Keeping the API
If your traffic is spiky and nothing stops the data going to a provider, keep paying per token. An API costs nothing while it's idle. Self-hosting earns its place for data control, steady volume, a model you can't get otherwise, or latency a shared endpoint can't give.
The conversation usually starts with an invoice or a compliance review. The API bill crossed some line, or legal said customer documents cannot leave the region, and someone suggests running an open-weight model on our own GPUs. Two weeks later the model answers prompts on a test box, and everyone agrees the hard part is done.
It is not. Getting a model to respond is an afternoon. Running it as a service that stays up under load, scales, gets patched and costs less than the API it replaced is the actual project. This article covers the decisions that determine whether that project succeeds: whether to self-host at all, how to size the hardware, which inference server to run, and what to watch once it is live.
Self-hosting is worth it when
Data cannot leave your network or region, and no provider deployment satisfies that
Traffic is high and steady enough to keep GPUs busy most of the day
You need a fine-tuned or specialised open model the APIs do not offer
You need latency or locality guarantees a shared endpoint cannot give
“It will be cheaper” on its own is not on this list. It is cheaper only at sustained utilisation, and spiky traffic rarely gets there.
Pro deep dive9 min full read
Keep reading with Pro
This is one of our advanced production deep dives. Pro unlocks the rest of it, every other deep dive, and the See, Animate, Test and Build modes on every topic.
What it covers
Break-even maths, GPU sizing from weights and KV cache, choosing between vLLM, SGLang and llama.cpp, and what to scale and alert on once open-weight models carry production traffic.