Cost of Running Open Source LLMs: What Self-Hosting Really Costs

Cost of Running Open Source LLMs: What Self-Hosting Really Costs

Cost of running open source LLMs is the question teams ask when the hosted model bill starts to hurt. The model weights themselves are free to download, which makes self-hosting look cheap, but the weights are only the start: the team still pays for the GPUs to run them, the engineering to keep them running, and the work of keeping them safe and up to date. The central question is whether self-hosting is actually cheaper, and the answer is that it depends on volume and utilisation: at low or bursty volume, paying per token is usually cheaper, while at high, steady volume, self-hosting can win, but only if the GPUs stay busy.

Open source here means open-weight models, whose trained weights are published under a licence that allows commercial use, such as the Llama and Mistral model families. The team downloads the weights, runs them on its own hardware or rented GPUs, and pays no per-token fee to a model provider. That freedom is real, and so are the costs that replace the fee. This guide breaks them down honestly, line by line.

Key takeaways

  • Open-weight model files are free to download, but running them is not free: GPUs, engineering and operations are the real cost.
  • Self-hosting usually wins only at high, steady volume with high GPU utilisation.
  • The hardware you need depends on the model size, the context length and the number of simultaneous users.
  • Serving software, such as vLLM, and quantisation can cut the hardware needed for the same model.
  • Count engineering time, security and updates in the total, or the comparison with hosted APIs will mislead you.

What “open source” means for the cost picture

An open-weight model gives the team the trained weights and a licence to use them, but it does not give a running service. The team must provide the hardware, the serving software, the API, the monitoring and the updates. That is the trade: the per-token fee disappears, and the fixed cost of running a service appears in its place.

The licence matters too. Most open-weight licences allow commercial use, but some restrict it, for example by limiting use by very large companies or by requiring that derivative models carry the same terms. A team should read the licence for the specific model it plans to use before building on it, because changing models later is expensive.

The choice of model is itself a cost decision. A larger model needs more GPU memory and more compute per token, so it costs more to run; a smaller model costs less, and for many tasks it answers just as well. The discipline is to test the smallest model that meets the quality bar, not to default to the largest one available. For the wider choice between open and proprietary models, see our guide to open source versus proprietary LLMs, which covers what the choice actually changes.

The GPU bill: sizing hardware to the model

The GPU bill is the largest line, and it starts with memory. A model must fit in GPU memory together with its working memory, the key-value cache that holds the conversation so far. A model with tens of billions of parameters needs tens of gigabytes just for the weights, and the cache adds more as conversations get longer and more users connect at once. If the model does not fit, the team needs more or larger GPUs, or a smaller model.

Quantisation is the main way to shrink the bill. Storing weights at lower precision, such as 8-bit or 4-bit instead of 16-bit, roughly halves or quarters the memory needed, which can mean the difference between needing two GPUs and needing one. Quantisation can reduce quality slightly, so it should be tested on the team’s own tasks rather than assumed to be free, but for many workloads the quality change is small and the saving is large.

Throughput is the second sizing question. One GPU can serve many simultaneous users if the serving software batches their requests together, and modern serving engines are good at this. The practical test is a load test: send the expected traffic at the expected concurrency, measure latency and throughput, and size the fleet from the result.

Serving software: the engine that decides utilisation

The serving engine is the software that loads the model, batches requests and manages memory, and it has a large effect on cost. vLLM, an open-source serving engine developed at UC Berkeley, uses a technique called PagedAttention to manage the key-value cache in small blocks, so GPU memory is used far more efficiently than in a naive setup. Its own published benchmarks report substantially higher throughput than the standard Hugging Face serving path, and it is now a PyTorch Foundation project. Efficient memory use means more simultaneous users per GPU, which is the same as a lower cost per request.

Other engines exist, including TensorRT-LLM and Text Generation Inference, and the right choice depends on the hardware, the model and the workload. The comparison that matters is not a benchmark number but a load test on the team’s own traffic: the same model, the same hardware, the same request pattern. For a direct comparison of the engines, see our guide to LLM serving frameworks compared, which covers vLLM, TGI and TensorRT-LLM.

Serving software also brings operational features that affect cost indirectly: autoscaling that adds GPUs when traffic rises and removes them when it falls, request routing, rate limiting, and graceful handling of long contexts. A service without autoscaling must be sized for the peak, which means paying for peak capacity all day. Best for: any team choosing a serving engine, or wondering why two teams running the same model report very different costs.

The hidden lines: engineering, security and updates

Engineering time is the hidden line that most comparisons leave out. Someone must deploy the model, keep the serving software updated, debug failures, tune the configuration and answer the pager when the service goes down at night. That work does not disappear because the model is free; it is the price of owning the service instead of renting it. A small team can easily spend more on the engineering than it saves on the token bill.

Security is a real cost too, and it is one that self-hosting makes the team’s own responsibility. The service must be protected from abuse, such as a user sending huge prompts to exhaust the GPUs, and sensitive data in prompts must be handled under the team’s own policies. Guardrails, rate limits, logging and access control all need to be built and maintained.

Updates are the third hidden line. Open-weight models are released frequently, and each new version brings a decision: stay on the old version, or test and deploy the new one. Staying put avoids work but falls behind on quality; updating brings the improvement but costs a test cycle and a deployment. Neither choice is free, and the cost of staying current should be in the budget from the start.

Self-hosted versus hosted: how to compare honestly

An honest comparison needs the same unit on both sides: cost per request, or cost per thousand tokens, measured on the team’s own traffic. The hosted side is the provider’s price for the tokens the traffic actually generates. The self-hosted side is the total monthly cost, GPUs plus storage plus networking plus the share of engineering time, divided by the same number of requests or tokens.

Volume and steadiness decide the outcome. At low volume, the hosted API wins, because the fixed cost of a GPU fleet is spread over too few requests. At high, steady volume, self-hosting can win, because the fleet is busy and the per-token fee is gone. At bursty volume, the answer depends on autoscaling: a fleet that scales down between bursts can compete, while a fleet sized for the peak cannot.

Control is the non-price factor that often decides the choice. Self-hosting keeps data inside the team’s own infrastructure, allows the model to be fine-tuned or modified, and removes dependence on a provider’s pricing and availability. Those benefits are real, and for regulated industries or sensitive data they can outweigh a higher bill.

Comparing the cost of running open source LLMs

Cost line Self-hosted Hosted API Who pays it
Model weights Free to download Bundled in price Nobody, or the provider
GPU compute Hourly, rented or owned Bundled in price The team, or the provider
Per-token fee None Per input and output token The team
Serving software Team maintains it Provider maintains it The team, or the provider
Engineering and on-call Team’s own staff Minimal The team
Security and compliance Team’s own controls Provider’s controls The team, or the provider
Scaling with volume Step changes in fleet size Smooth, per token Both, differently

The table makes the trade visible. Self-hosting replaces a smooth per-token fee with a set of fixed costs, and the comparison turns on whether the volume is high and steady enough for those fixed costs to beat the fee. Any comparison that leaves out engineering time or security is incomplete, and will flatter self-hosting.

A rack of graphics processing units in a small server room with cooling fans and cables
Self-hosting an open-weight model means owning the hardware it runs on, whether that hardware sits in your own rack or is rented by the hour.

Cost of running open source LLMs checklist

  • The licence for the chosen model allows the planned commercial use.
  • The smallest model that meets the quality bar has been tested, not the largest.
  • GPU memory covers the weights plus the key-value cache at expected concurrency.
  • Quantisation has been tested for quality on the team’s own tasks.
  • A load test at expected traffic sizes the fleet, not a guess.
  • The serving engine is chosen from a load test, with autoscaling in place.
  • Cost per request is measured, and compared with the hosted API on the same traffic.
  • Engineering time, security and updates are counted in the total.
  • Rate limits and guardrails protect the GPUs from abuse.
  • A plan exists for updating to new model versions, with a test cycle.

Frequently asked questions

Is running an open source LLM free?

No. The weights are free to download, but the GPUs, storage, networking, engineering and operations are not. The per-token fee disappears, and the cost of running a service takes its place.

When is self-hosting cheaper than a hosted API?

Usually at high, steady volume with high GPU utilisation, where the fixed cost of the fleet is spread over many requests. At low or bursty volume, the hosted API is usually cheaper, because there is no idle capacity to pay for.

How much GPU memory does an open source LLM need?

It depends on the model size, the precision of the weights and the length of the conversations being served. A model with tens of billions of parameters needs tens of gigabytes for the weights alone, plus memory for the key-value cache. Quantisation can reduce the requirement substantially.

What is vLLM?

vLLM is an open-source serving engine, developed at UC Berkeley and now a PyTorch Foundation project, that runs large language models efficiently using a memory technique called PagedAttention. It serves models through an OpenAI-compatible API and is widely used for self-hosted inference.

Can I fine-tune an open source LLM?

Yes, if the licence allows it. Fine-tuning is one of the main reasons teams choose open-weight models, because it lets them adapt a model to their own data and tasks. Fine-tuning adds its own GPU cost, which should be budgeted separately from serving.

What are the biggest hidden costs of self-hosting?

Engineering time, on-call cover, security controls and keeping up with new model versions. Teams that compare only the GPU bill with the hosted token bill usually underestimate the true cost of owning the service.

Latest articles

Scroll to Top