Skip to content

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.

Runs in your browser. Your inputs are not uploaded.Open formulaPrices updated November 2026
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.

Jump to results

Your inputs

Model
A preset fills parameters, architecture, layers, KV heads and head dimension. Values you set yourself win.
Total parameters. For mixture-of-experts, all experts count.
Mixture-of-experts only; used for speed, not memory.
Grouped-query models have fewer KV heads than attention heads.
Workload
Average live context per session.
Sessions held in memory at once.
Activations and fragmentation.
Hardware
API comparison
Total tokens processed per month, for the API comparison.
Blended price, entered by you.

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.
Total memory
348.71 GiB
KV cache is 72% of weights + KV
GPUs needed
24
NVIDIA L4, tensor-parallel 8, 3 nodes
Self-hosted per month
$12,404
via runpod
API per month
$25,000
break-even at 2,481M tokens/month

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 options for this memory budget
GPUVRAMGPUsLayoutProvider$ per hourLoaded $ per month
NVIDIA L424 GiB24TP 8 × 3 nodesrunpod$0.59$12,404
NVIDIA A100 80GB80 GiB8TP 8runpod$1.79$12,544
NVIDIA L40S48 GiB16TP 8 × 2 nodesrunpod$1.09$15,277
NVIDIA B300288 GiB2TP 2runpod$8.99$15,750
NVIDIA RTX 509032 GiB16TP 8 × 2 nodesrunpod$1.19$16,679
NVIDIA RTX PRO 600096 GiB8TP 8runpod$2.49$17,450
NVIDIA H200141 GiB4TP 4runpod$5.29$18,536
NVIDIA RTX 409024 GiB24TP 8 × 3 nodesrunpod$0.89$18,711
NVIDIA B200180 GiB4TP 4lambda$6.69$23,442
NVIDIA A100 40GB40 GiB16TP 8 × 2 nodeslambda$1.99$27,892
NVIDIA H100 80GB (SXM)80 GiB8TP 8lambda$3.99$27,962
Levers: what each change saves
WeightsKV cacheTotal GiBGPUsGPUs savedLoaded $ per month
INT4 (AWQ/GPTQ)FP8178.94168$8,269
Q4_K_MFP8182.53168$8,269
FP8 / INT8FP8211.21168$8,269
FP16 / BF16FP8282.92168$8,269
INT4 (AWQ/GPTQ)FP16316.44168$8,269
Q4_K_MFP16320.03168$8,269
FP8 / INT8 (current)FP16348.71240$12,404
FP16 / BF16FP16420.42240$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 node

Cost 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 specifications and cheapest listed cloud rate
GPUVRAMBandwidth GB/sPower WPurchaseCheapest cloud $/hPurchase basisChecked on official pages
NVIDIA B300288 GiB8,0001,400n/a$8.99No pricespecs, cloud rates
NVIDIA B200180 GiB8,0001,000$40,000$6.69Third-party range (midpoint)specs, cloud rates
NVIDIA H200141 GiB4,800700$31,500$5.29Third-party range (midpoint)specs, cloud rates
NVIDIA H100 80GB (SXM)80 GiB3,350700$33,500$3.99Third-party range (midpoint)specs, cloud rates
NVIDIA RTX PRO 600096 GiB1,792600$8,900$2.49Third-party retail reportspecs, cloud rates
NVIDIA A100 80GB80 GiB2,039400$16,000$1.79Third-party range (midpoint)specs, cloud rates
NVIDIA A100 40GB40 GiB1,555400$11,000$1.99Third-party range (midpoint)specs, cloud rates
NVIDIA L40S48 GiB864350$8,500$1.09Estimate, no sourcespecs, cloud rates
NVIDIA RTX 509032 GiB1,792575$1,999$1.19NVIDIA launch pricespecs, cloud rates
NVIDIA RTX 409024 GiB1,008450$1,599$0.89NVIDIA launch pricespecs, cloud rates
NVIDIA L424 GiB30072$2,700$0.59Estimate, no sourcespecs, cloud rates
Model presets (architecture values used for the KV cache)
PresetParameters (B)TypeLayersKV headsHead dimConfig checked
Llama 3.1 8B8Dense328128Yes (2026-11-05)
Llama 3.1 70B70Dense808128Yes (2026-11-05)
Llama 3.1 405B405Dense1268128Yes (2026-11-05)
Qwen2.5 72B72.7Dense808128Yes (2026-11-05)
Mixtral 8x7B (MoE)46.7MoE (12.9B active)328128Yes (2026-11-05)
Hidden gotchas
TopicWhat catches people out
KV cacheThe KV cache grows with sessions × context and often exceeds the weights.
Mixture of expertsAll experts stay in memory even though few are active per token.
Grouped-query attentionFewer KV heads shrink the KV cache a lot; check the model's config.
QuantizationQuantizing weights does not shrink the KV cache unless its dtype changes too.
Multi-GPU speedTensor parallelism needs fast interconnect (NVLink); PCIe-only boxes scale poorly.
OverheadReal overhead depends on the serving engine, batch size and fragmentation.

Three ways to reduce this number

  1. Store the KV cache in FP8.
  2. Cap context length or concurrency.
  3. 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.