Home / Insights / Software Costs and Budgets
Software Costs and Budgets
Self-Hosted LLM Costs: How to Size GPUs and Compare Private Deployment with API Pricing
Private AI deployment is often justified on data control, but the cost question always follows: will running our own model be cheaper or more expensive than an API? This guide explains the drivers that decide the answer and a method for modelling it with your own workload.
TopicsSoftware Costs and BudgetsGenerative AI and LLMsArchitecture and Modernization
Key takeaways
- Self-hosting trades a per-token bill for fixed infrastructure and operations costs; utilisation decides which is cheaper.
- Model size, quantisation, context length and concurrency determine GPU memory and therefore hardware choice.
- Serving software such as vLLM uses continuous batching to serve many requests per GPU, which changes the economics markedly.
- Include engineering and operations time in the comparison, not only GPU hours.
- Model costs from a measured workload profile and a benchmark on your own tasks, not from list prices alone.
On this page
When organisations consider private AI deployment, the motivation is usually data control: contracts, regulation or internal policy prevent sending documents to a third-party model provider. Cost then becomes the deciding question for the finance team. Some assume self-hosting is always cheaper because there is no per-token bill; others assume it is always more expensive because GPUs are costly. Both can be true, depending on the workload.
This article sets out how we approach the cost model with clients. It does not give prices, because GPU rates, API prices and model capabilities change frequently and vary by region and provider. Instead it explains the structure of the calculation so you can run it with current numbers. For general LLM cost levers that apply regardless of hosting, see reducing LLM token and cloud costs.
How the cost structures differ
| Cost element | Hosted API | Self-hosted model |
|---|---|---|
| Usage | Per input and output token | None directly; cost is capacity |
| Infrastructure | None | GPU instances or servers, storage, networking, whether used or idle |
| Setup | Low: integrate the API | Model selection, benchmarking, serving stack, security, deployment pipelines |
| Operations | Monitor usage and quality | Monitoring, scaling, patching, model updates, incident response |
| Scaling | Handled by provider within rate limits | Your responsibility; must plan for peaks |
| Model quality | Access to the provider’s largest models | Limited to open models you can run on your hardware |
The essential insight is that self-hosting converts a variable cost into a largely fixed one. If your GPUs are busy, the effective cost per request can be low. If they sit idle overnight and at weekends, you pay for capacity you do not use.
What determines GPU requirements
Model size and quantisation
The model’s weights must fit in GPU memory. Larger models need more memory and often multiple GPUs. Quantisation stores weights at lower precision, such as 8-bit or 4-bit, reducing memory needs and often allowing a smaller or cheaper GPU, sometimes with a modest quality trade-off that must be tested on your tasks. Serving frameworks such as vLLM support a range of quantisation formats, including FP8, INT8, INT4, GPTQ/AWQ and GGUF.
Context length
Beyond the weights, each active request needs memory for its attention cache, which grows with the length of the prompt and response. Long-document RAG and summarisation workloads with large contexts need noticeably more memory per concurrent request than short classification tasks.
Concurrency and latency targets
How many requests must be handled at the same time, and how fast must the first token and full response arrive? A small internal assistant with a few concurrent users has very different needs from a customer-facing feature with traffic peaks.
Serving efficiency
Modern inference servers batch requests together. vLLM, for example, documents continuous batching, where new requests join the batch as they arrive, and PagedAttention for efficient management of attention memory. These techniques allow a single GPU to serve many more requests than naïve one-at-a-time serving, so the choice of serving stack has a direct effect on hardware cost.
Build a workload profile first
Before comparing costs, describe the workload with numbers you can measure or estimate with reasonable confidence.
- Number of users and active hours per day.
- Requests per user per day, and the peak-to-average ratio.
- Average input tokens (including retrieved context) and output tokens per request.
- Latency targets for first token and complete response.
- Required availability: business hours only, or around the clock with redundancy?
- Expected growth over the next year.
If an existing pilot runs on an API, its usage logs are the best source for these figures. If not, a short pilot with real users is usually worth more than any estimate. For a structured approach to measuring AI costs per outcome, see AI FinOps for product teams.
A method for a fair comparison
- Benchmark quality first. Test candidate open models and the hosted model on your own evaluation set. If no open model meets the quality bar for your tasks, the cost comparison is moot.
- Calculate API cost. Multiply monthly input and output tokens by current provider prices, including any premium for data residency or dedicated capacity.
- Size self-hosted capacity. Using the chosen model, quantisation and serving stack, load test to find the throughput one GPU instance can sustain at your latency target. Divide peak demand by that throughput and add headroom and redundancy.
- Cost the infrastructure. GPU instances or servers for the required hours, plus storage, networking, monitoring and non-production environments.
- Add people. Engineering time for setup, and ongoing operations time for patching, model updates, monitoring and incidents.
- Compare over a realistic period, such as one to three years, with growth scenarios.
Illustrative example
For example, a team might find that an internal document assistant used during office hours by a modest number of staff costs less on a hosted API with strict data settings, because a dedicated GPU would sit idle much of the time. The same team might find that a high-volume overnight document classification job, running continuously, is cheaper on a self-hosted quantised model. The workload, not the technology, decided each case.
Ways to reduce self-hosting cost
- Right-size the model. A smaller model fine-tuned or well prompted for a narrow task may match a larger general model.
- Quantise and test. Lower precision can reduce hardware needs; confirm quality on your evaluation set.
- Schedule capacity. Scale down outside working hours for internal tools, and run batch jobs when interactive demand is low.
- Share infrastructure. Serve several internal applications from one model endpoint with authentication and quotas.
- Route by difficulty. Send simple tasks to a small model and only hard ones to a larger model.
- Cache. Prefix caching and response caching help when prompts share long common sections.
Some of these optimisations, such as scheduling and right-sizing, also apply to development environments; see keeping AI development environments affordable.
Frequently asked questions
Is self-hosting an LLM cheaper than using an API?
It depends on utilisation. Self-hosting has largely fixed costs, so it tends to be more economical for steady, high-volume workloads and less economical for low or bursty usage. Model both with your own workload profile.
What hardware do we need to run an open model privately?
It depends on model size, quantisation, context length and concurrency. Smaller quantised models can run on modest GPUs, while larger models and high concurrency need more memory or multiple GPUs. Load testing on your workload is the reliable way to size it.
Does quantisation reduce quality?
It can, by varying amounts depending on the model, the method and the task. Test quantised versions on your own evaluation set before committing.
Should we include staff costs in the comparison?
Yes. Setup, monitoring, patching, model updates and incident response all take engineering time, which can be a significant part of total cost of ownership for self-hosted models.
Sources and methodology
Guidance reflects PoliteTech delivery experience. The external references below informed specific points in this article.
- vLLM documentation: Welcome to vLLM — PagedAttention, continuous batching and supported quantisation formats for self-hosted model serving.
Related reading
Continue your research
Would a private model be cheaper than your current API bill?
We can profile your workload, benchmark open models on your tasks and model the total cost of both options with stated assumptions.
