How Much Does It Cost to Deploy an LLM Locally? A Complete Guide to GPU Costs
Deploying a large language model on dedicated GPUs involves more than just the instance hourly rate. This guide breaks down the full cost structure of LLM deployment, shows how to estimate VRAM requirements and minimum GPU counts with a simple formula and code, explains how to convert throughput into per-million-token cost, compares renting versus self-hosting, and covers practical deployment steps and common pitfalls—so you can make capacity decisions based on real numbers rather than sticker prices.
1. Start with the Price Baseline
Data-center-grade GPUs are typically only available for rent on cloud platforms, so cost estimation has to start with cloud pricing. Using one cloud vendor’s published GPU instance prices as an example: a single GPU on a 12-month reservation costs about $4.76 per hour, and a full 8-GPU server costs about $38.08 per hour. At 720 hours per month, running the full server continuously costs roughly $27,400 per month.
Two caveats about these numbers. First, they are public prices at a specific point in time—prices vary widely across platforms, regions, and billing models, so always check current pricing before acting. Second, the hourly cost of the server is only the starting point of the bill. The final unit cost depends on whether your model can fully utilize those GPUs, and on the concurrency and throughput of the service.
2. What Makes Up the Total Cost
The total cost of local deployment usually includes the following components:
- Compute: the hourly fee for GPU instances—the largest single line item.
- Storage: block or object storage for model weights, caches, and logs.
- Network: traffic charges from cross-zone access and serving external requests.
- Operations and engineering labor: deployment, monitoring, incident handling, and version upgrades.
- Idle cost: GPUs that keep billing during low-traffic periods—the most commonly overlooked item.
List all of these when estimating. Looking only at GPU unit prices typically underestimates total cost by 10% to 30%, depending on storage volume, traffic, and team size.
3. Step 1: Estimate VRAM and Determine the Minimum GPU Count
During LLM inference, VRAM is consumed by three things: model weights, the KV cache (which stores intermediate context states), and runtime overhead. The weight footprint can be roughly estimated as:
Weight VRAM (GB) ≈ Parameter count (billions) × Bytes per parameter
Bytes per parameter under different precisions:
| Precision | Bytes per parameter | Weight footprint of 1T parameters |
|---|---|---|
| BF16 | 2 | ~2 TB |
| FP8 | 1 | ~1 TB |
| INT4 | 0.5 | ~0.5 TB |
Beyond the weights, reserve space for the KV cache and runtime—typically 20% to 30% of the weight size. The following code shows this estimation. The 192 GB per-GPU memory is an assumption made for ease of calculation; in practice, use the specs of your chosen instance type.
import mathdef min_gpus(params_b, bytes_per_param, gpu_mem_gb, overhead=0.25):# params_b: parameter count in billions# bytes_per_param: bytes used per parameter# overhead: fraction reserved for KV cache and runtimeweights_gb = params_b * bytes_per_paramtotal_gb = weights_gb * (1 + overhead)return math.ceil(total_gb / gpu_mem_gb)for name, b in [("BF16", 2), ("FP8", 1), ("INT4", 0.5)]:print(name, min_gpus(1000, b, 192))
The result: BF16 needs 14 GPUs, FP8 needs 7, and INT4 needs 4. Since tensor parallelism usually requires a power-of-two GPU count, 16 GPUs is reasonable for BF16 and 8 GPUs for INT4. An 8-GPU server can hold INT4 weights while leaving ample room for the KV cache.
One important caveat: quantization affects output quality. Before choosing a lower precision, evaluate it on your own business data—compare accuracy before and after quantization, and confirm the quality loss is acceptable.
4. Step 2: Convert Throughput into Cost per Token
The value of compute ultimately shows up in the cost per token:
Unit cost = Hourly fee ÷ Effective output tokens per hour
Assume the 8-GPU service sustains an aggregate output throughput of 2,000 tokens per second at steady state. This is an illustrative assumption—the actual number must come from load testing. At this rate, the service outputs about 7.2 million tokens per hour.
38.08 ÷ 7.2 ≈ $5.29 per million output tokens (at full load)
Utilization has a major impact on cost:
| Average utilization | Cost per million output tokens |
|---|---|
| 100% | ~$5.29 |
| 50% | ~$10.58 |
| 30% | ~$17.63 |
Unit cost is inversely proportional to utilization. If GPUs sit idle half the time, the cost of each effective token doubles. Improving utilization is therefore usually more effective than negotiating a lower unit price.
5. Step 3: Rent or Build Your Own
Renting and self-hosting each have their use cases. Compare them along these dimensions:
- Upfront investment: renting requires almost no one-time spending; self-hosting requires purchasing hardware and building out facilities.
- Flexibility: rented capacity can scale on demand; self-hosted capacity is essentially fixed after procurement.
- Utilization sensitivity: both are affected by utilization, but self-hosting carries higher fixed costs, so low utilization hurts more.
- Data control: when there is a hard requirement that data stay within a boundary, self-hosting or a dedicated environment is more appropriate.
The payback period for self-hosting can be estimated as follows:
Monthly savings = Monthly rental cost of equivalent compute − Monthly self-hosting costs (power, facilities, operations)
Payback months = One-time hardware and deployment investment ÷ Monthly savings
From this, a few practical rules of thumb:
- With stable workloads and consistently high utilization, long-term commitments are more cost-effective—consider reserved instances. Reserved capacity is cheaper per unit, but you pay for it even when idle during the contract term.
- With highly variable workloads and large peak-to-valley gaps, on-demand resources or auto-scaling are a better fit.
- In the early stages when demand is uncertain, rent first and evaluate self-hosting once traffic stabilizes.
6. Step 4: Deployment Essentials
A complete deployment process can be broken down into the following stages.
- Define service objectives. This includes peak concurrency, time-to-first-token, the distribution of output lengths, and availability requirements. These metrics determine GPU count and batching configuration later.
- Choose precision and model version. Decide on precision only after completing quality evaluation on your business data.
- Serve the model. Use an inference engine that supports continuous batching, and expose a standardized chat API so existing systems can integrate easily.
- Load test. Increase pressure gradually, and record throughput, P95 latency, and peak VRAM usage. Test with the length distribution of real requests—don’t rely only on fixed-length samples.
- Monitoring and alerting. Focus on GPU utilization, VRAM usage, queue length, error rate, and latency.
- Elasticity and cost control. Adjust instance counts by time of day and scale in during off-peak periods. Reserved resources cannot be released during the contract term, so size reservations to the baseline load and let on-demand resources absorb the peaks.
Below is an illustrative configuration showing the kinds of parameters you need to manage. Adjust the actual parameter names according to the documentation of your chosen inference service.
service:precision: int4tensor_parallel_size: 8max_concurrency: 64max_batched_tokens: 16384request_timeout_s: 120monitoring:metrics: [gpu_util, gpu_mem, queue_len, p95_latency, tokens_per_s]alert_rules:- gpu_util < 0.3 for 60m # Sustained low utilization; consider scaling in- p95_latency > 3s # Slow responses; check batching and queuing
7. Common Pitfalls
- Comparing unit prices instead of cost per million tokens. A cheaper unit price with low utilization is not necessarily cheaper.
- Procuring for peak capacity, which leaves resources idle most of the time.
- Ignoring storage, traffic, and labor costs, and underestimating the total investment.
- Assuming quantization is lossless and skipping business evaluation before going live.
- Treating benchmark throughput as production throughput, while ignoring the length distribution of real requests and burst traffic.
The key to avoiding these pitfalls is to estimate first and deploy second. Before you start, do three things: define your target concurrency and latency, measure throughput with load testing on realistic samples, and then calculate the cost per million tokens using the formula above. With those three numbers, decisions about renting versus building and how many GPUs to provision become straightforward.
