LLM VRAM calculator: how many GPUs does your model need?
Size the GPU memory for a model, quantization and workload, then see where self-hosting beats paying an API.
How to verify this
Open your browser's network tab and change an input: nothing is sent. The page computes with the formulas and the dated price table below. Some entries in that table could not be checked against an official page and are labelled. The same engine answers the API and the MCP tool, so you can reproduce any scenario from code.
A 70B model at FP8 with 50 sessions of 16,384 tokens needs 348.7 GiB: 24 × NVIDIA L4.
- Note:Speed figures are estimates; benchmark with your serving engine.
- Risk:The monthly volume needs about 1,929 tokens/s on average but the estimated capacity is 1,286 tokens/s.
- Heads-up:24 GPUs across 3 nodes are needed; interconnect between nodes now limits speed.
- Note:The KV cache is 72% of total memory; context length and concurrency matter more than weight quantization.
Self-hosting is cheaper for this volume.
Where the GPU memory goes
- Model weights: 65.19 GiB (19%)
- KV cache: 250 GiB (72%)
- Runtime overhead: 33.52 GiB (10%)
| GPU | VRAM | GPUs | Layout | Provider | $ per hour | Loaded $ per month |
|---|---|---|---|---|---|---|
| NVIDIA L4 | 24 GiB | 24 | TP 8 × 3 nodes | runpod | $0.59 | $12,404 |
| NVIDIA A100 80GB | 80 GiB | 8 | TP 8 | runpod | $1.79 | $12,544 |
| NVIDIA L40S | 48 GiB | 16 | TP 8 × 2 nodes | runpod | $1.09 | $15,277 |
| NVIDIA B300 | 288 GiB | 2 | TP 2 | runpod | $8.99 | $15,750 |
| NVIDIA RTX 5090 | 32 GiB | 16 | TP 8 × 2 nodes | runpod | $1.19 | $16,679 |
| NVIDIA RTX PRO 6000 | 96 GiB | 8 | TP 8 | runpod | $2.49 | $17,450 |
| NVIDIA H200 | 141 GiB | 4 | TP 4 | runpod | $5.29 | $18,536 |
| NVIDIA RTX 4090 | 24 GiB | 24 | TP 8 × 3 nodes | runpod | $0.89 | $18,711 |
| NVIDIA B200 | 180 GiB | 4 | TP 4 | lambda | $6.69 | $23,442 |
| NVIDIA A100 40GB | 40 GiB | 16 | TP 8 × 2 nodes | lambda | $1.99 | $27,892 |
| NVIDIA H100 80GB (SXM) | 80 GiB | 8 | TP 8 | lambda | $3.99 | $27,962 |
| Weights | KV cache | Total GiB | GPUs | GPUs saved | Loaded $ per month |
|---|---|---|---|---|---|
| INT4 (AWQ/GPTQ) | FP8 | 178.94 | 16 | 8 | $8,269 |
| Q4_K_M | FP8 | 182.53 | 16 | 8 | $8,269 |
| FP8 / INT8 | FP8 | 211.21 | 16 | 8 | $8,269 |
| FP16 / BF16 | FP8 | 282.92 | 16 | 8 | $8,269 |
| INT4 (AWQ/GPTQ) | FP16 | 316.44 | 16 | 8 | $8,269 |
| Q4_K_M | FP16 | 320.03 | 16 | 8 | $8,269 |
| FP8 / INT8 (current) | FP16 | 348.71 | 24 | 0 | $12,404 |
| FP16 / BF16 | FP16 | 420.42 | 24 | 0 | $12,404 |
Indicative speed: about 51 tokens/s per stream; capacity about 1,286 tokens/s against 1,929 tokens/s needed on average. Memory-bandwidth bound estimate, not a benchmark.
Self-hosted vs API cost as the workload changes
Calculating the range…
How it is calculated
Memory
W = P × 10^9 × b_w ÷ 2^30 κ = 2 × L × H_kv × d_h × b_kv (bytes per token) KV = κ × C × U ÷ 2^30
Total and GPU count
V_total = (W + KV) × (1 + o) + V_fixed n_raw = V_total ÷ (V_gpu × u)
Placement
round n_raw up to a tensor-parallel degree in {1, 2, 4, 8} that divides kv_heads;
above 8, nodes = ceil(n_raw ÷ 8) with 8 GPUs per nodeCost and break-even
cloud = GPUs × hourly rate × 730 on-prem = GPUs × (price ÷ 36 + power + hosting) loaded = GPU cost × (1 + ops overhead) API cost = tokens (millions) × API price per million break-even tokens = loaded cost ÷ API price per million
Speed (indicative)
tokens/s per stream ≈ η × total memory bandwidth ÷ (active params × bytes per param) capacity ≈ streams × per-stream speed × batch efficiency (0.5)
Assumptions
- P is parameters in billions, b_w bytes per weight, L layers, H_kv KV heads, d_h head dimension, b_kv bytes per KV element, C context tokens, U concurrent sessions, o runtime overhead, u usable VRAM share. 1 GiB = 2^30 bytes.
- V_fixed is a fixed runtime allowance from the dataset (2 GiB). The 4-bit bytes per parameter (0.55 and 0.60) are approximate.
- Mixture-of-experts models keep every expert in memory; only speed uses the active parameter count.
- Cloud cost uses the cheapest listed provider for the chosen GPU. No reserved rates are published, so reserved uses on-demand.
- GPU specs and cloud rates were read from NVIDIA and provider pages. NVIDIA publishes no list prices for data-center GPUs, so on-prem purchase prices are third-party or estimated figures; a result that depends on an unverified value carries a DATASET_UNVERIFIED notice naming it.
- Decode speed is memory-bandwidth bound and ignores prefill, interconnect and scheduler effects. The monthly volume is spread evenly over 30 days.
The data behind it
| GPU | VRAM | Bandwidth GB/s | Power W | Purchase | Cheapest cloud $/h | Purchase basis | Checked on official pages |
|---|---|---|---|---|---|---|---|
| NVIDIA B300 | 288 GiB | 8,000 | 1,400 | n/a | $8.99 | No price | specs, cloud rates |
| NVIDIA B200 | 180 GiB | 8,000 | 1,000 | $40,000 | $6.69 | Third-party range (midpoint) | specs, cloud rates |
| NVIDIA H200 | 141 GiB | 4,800 | 700 | $31,500 | $5.29 | Third-party range (midpoint) | specs, cloud rates |
| NVIDIA H100 80GB (SXM) | 80 GiB | 3,350 | 700 | $33,500 | $3.99 | Third-party range (midpoint) | specs, cloud rates |
| NVIDIA RTX PRO 6000 | 96 GiB | 1,792 | 600 | $8,900 | $2.49 | Third-party retail report | specs, cloud rates |
| NVIDIA A100 80GB | 80 GiB | 2,039 | 400 | $16,000 | $1.79 | Third-party range (midpoint) | specs, cloud rates |
| NVIDIA A100 40GB | 40 GiB | 1,555 | 400 | $11,000 | $1.99 | Third-party range (midpoint) | specs, cloud rates |
| NVIDIA L40S | 48 GiB | 864 | 350 | $8,500 | $1.09 | Estimate, no source | specs, cloud rates |
| NVIDIA RTX 5090 | 32 GiB | 1,792 | 575 | $1,999 | $1.19 | NVIDIA launch price | specs, cloud rates |
| NVIDIA RTX 4090 | 24 GiB | 1,008 | 450 | $1,599 | $0.89 | NVIDIA launch price | specs, cloud rates |
| NVIDIA L4 | 24 GiB | 300 | 72 | $2,700 | $0.59 | Estimate, no source | specs, cloud rates |
| Preset | Parameters (B) | Type | Layers | KV heads | Head dim | Config checked |
|---|---|---|---|---|---|---|
| Llama 3.1 8B | 8 | Dense | 32 | 8 | 128 | Yes (2026-11-05) |
| Llama 3.1 70B | 70 | Dense | 80 | 8 | 128 | Yes (2026-11-05) |
| Llama 3.1 405B | 405 | Dense | 126 | 8 | 128 | Yes (2026-11-05) |
| Qwen2.5 72B | 72.7 | Dense | 80 | 8 | 128 | Yes (2026-11-05) |
| Mixtral 8x7B (MoE) | 46.7 | MoE (12.9B active) | 32 | 8 | 128 | Yes (2026-11-05) |
| Topic | What catches people out |
|---|---|
| KV cache | The KV cache grows with sessions × context and often exceeds the weights. |
| Mixture of experts | All experts stay in memory even though few are active per token. |
| Grouped-query attention | Fewer KV heads shrink the KV cache a lot; check the model's config. |
| Quantization | Quantizing weights does not shrink the KV cache unless its dtype changes too. |
| Multi-GPU speed | Tensor parallelism needs fast interconnect (NVLink); PCIe-only boxes scale poorly. |
| Overhead | Real overhead depends on the serving engine, batch size and fragmentation. |
Last updated 2026-11-05 (dataset 2026-11, refreshed monthly). Entries marked unverified or modelled could not be checked against an official page.
- https://lambda.ai/pricing
- https://www.runpod.io/pricing
- https://developer.nvidia.com/blog/inside-nvidia-blackwell-ultra-the-chip-powering-the-ai-factory-era/
- https://docs.nvidia.com/dgx/dgxb300-user-guide/introduction-to-dgxb300.html
- https://docs.nvidia.com/enterprise-reference-architectures/hgx-ai-factory-h100-h200-b200/latest/components.html
- https://www.nvidia.com/en-us/data-center/dgx-b200/
- https://www.nvidia.com/en-us/data-center/h200/
- https://www.nvidia.com/en-us/data-center/h100/
- https://www.nvidia.com/en-us/products/workstations/professional-desktop-gpus/rtx-pro-6000/
- https://www.nvidia.com/en-us/data-center/a100/
- https://images.nvidia.com/aem-dam/en-zz/Solutions/data-center/nvidia-ampere-architecture-whitepaper.pdf
- https://www.nvidia.com/en-us/data-center/l40s/
- https://images.nvidia.com/aem-dam/Solutions/geforce/blackwell/nvidia-rtx-blackwell-gpu-architecture.pdf
- https://images.nvidia.com/aem-dam/Solutions/geforce/ada/nvidia-ada-gpu-architecture.pdf
- https://www.nvidia.com/en-us/data-center/l4/
- https://arxiv.org/pdf/2407.21783
- https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/raw/main/config.json
- https://huggingface.co/Qwen/Qwen2.5-72B-Instruct
- https://huggingface.co/mistralai/Mixtral-8x7B-v0.1/raw/main/config.json
- https://mistral.ai/news/mixtral-of-experts
Three ways to reduce this number
- Store the KV cache in FP8.
- Cap context length or concurrency.
- Quantize weights to FP8 or 4-bit and re-measure quality.
Use it from code
The same engine is available as a REST endpoint and as an MCP tool named calc_self_hosted_llm_gpu_vram_estimator. Your scenario as an API call:
curl -X POST 'https://api.x12i.com/v1/calc/self-hosted-llm-gpu-vram-estimator' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"model_preset": "custom",
"quantization": "fp8_int8",
"kv_cache_dtype": "fp16",
"context_len_tokens": 16384,
"concurrent_users": 50,
"runtime_overhead_pct": 10,
"usable_vram_pct": 90,
"gpu_model": "any",
"deployment": "cloud_on_demand",
"monthly_tokens_millions": 5000,
"api_blended_usd_per_mtok": 5,
"ops_overhead_pct": 20,
"privacy_sensitive": false
},
"options": {
"explain": false
}
}' Schema: GET /v1/calc/self-hosted-llm-gpu-vram-estimator/schema
Frequently asked questions
How much VRAM does a 70B model need?
Weights alone take about 65 GiB at FP8 and 130 GiB at FP16. Add the KV cache for your sessions and context plus runtime overhead; this calculator adds them up and tells you how many GPUs that means.
How is the KV cache calculated?
Per token it is 2 × layers × KV heads × head dimension × bytes per element. Multiply by context length and concurrent sessions. A 70B model with 8 KV heads uses 320 KiB per token at FP16.
When is self-hosting cheaper than an API?
When your monthly token volume is above the break-even shown here: the loaded GPU cost divided by the API price per million tokens. Below it, the API is cheaper unless privacy or latency rules it out.