Live H100 $0.79/hr · NebiusSpotH200 $1.70/hr · NebiusSpotB200 $2.53/hr · GCPSpot 2,341 offers·20 platforms·updated 2h ago
Tutorial

Deploy an LLM on RunPod: Pod vs Serverless and the Cost Math

From picking a billing model to load testing: decision rules, deploy commands, five failure modes, and cost per million tokens from dated first-party prices.

A blue-lit server room with a monitor among hanging cables, overlaid at the lower left with one continuous line and a row of short segments crossed by a dashed marker.
On this page10

Key takeaways

Deploying on RunPod starts with the billing model. If your daytime GPU utilization sits above the ratio of pod price to equivalent serverless price, a persistent pod is cheaper. If traffic is bursty and drops to zero overnight, serverless wins. Paying more per card does not mean paying more per token: on the RunPod on-demand prices collected 2026-11-15, a 70B model on 2x H100 PCIe costs about $2.01 per million output tokens, while 2x H100 SXM costs $2.71, 35% more for 12% more throughput.

This guide does not repeat the click-by-click steps in the official docs. RunPod already documents those well. What is usually missing is three things: when a persistent pod is the wrong choice, how to turn an hourly price into a cost per token, and what to test before you point real traffic at the endpoint. For a cross-provider comparison, see the three-platform benchmark; for filtering providers by hard constraints, see the five-step framework.

1. Decide the billing model before comparing prices

Divide the two unit prices and the ratio is your break-even utilization; if your real utilization sits above it, go with the persistent pod.

OptionHow you are billedWhen idleScalingCold startBest fit
Pod (persistent)Per second while runningStill billedManual or API start/stopReloads weights on restartSteady traffic, debugging
Serverless (queue-based)Per second while workers are active, including idle timeoutScales to zero, no charge0 to N automaticallyYesBursty traffic, async batches
Serverless (load-balanced)Same as aboveSame as aboveSame as aboveYesExisting HTTP services

The idle timeout is the part people miss. A worker bills from the first job until the last request finishes plus the timeout window, and that tail produces no tokens at all. A 30-second timeout on 10-second requests means you pay four times the compute cost.

The three options are not mutually exclusive. A common setup develops on a pod and serves production traffic on serverless, with both reading the same network volume so switching does not re-download weights.

The order of questions matters too: first the traffic shape, bursty or flat; then the latency budget, whether tens of seconds of cold start is acceptable; only then price. If either of the first two rules out an option, comparing rates is pointless.

2. The pod route: running vLLM in 15 minutes

One GPU, one official image and one launch command are enough to get serving. Where people get stuck is almost always the port or the weights, not the model.

  1. Size the card by VRAM. An FP16 8B model holds about 16GB of weights, so plan for 24GB with KV cache. A 70B model at 4-bit is roughly 40GB.
  2. Create a pod and pick the official vLLM image.
  3. Expose port 8000. Skip this and you will get a 502 every time.
  4. Mount a network volume at the Hugging Face cache directory so restarts skip the download.
  5. Start the server with the command below.

You can estimate VRAM by hand: weight size is roughly parameter count times bytes per parameter, 2 bytes at FP16 and about 0.5 at 4-bit, plus 20% to 30% for KV cache and activations. A 70B model at FP16 needs around 140GB, which no single card holds, so it is quantization or multiple GPUs.

vllm serve meta-llama/Llama-3.1-8B-Instruct \
  --dtype bfloat16 \
  --gpu-memory-utilization 0.90 \
  --max-model-len 8192 \
  --api-key YOUR_SECRET

What comes up is an OpenAI-compatible endpoint. Existing client code only changes base_url and api_key.

curl http://YOUR_POD_ID-8000.proxy.runpod.net/v1/chat/completions \
  -H "Authorization: Bearer YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"model":"meta-llama/Llama-3.1-8B-Instruct","messages":[{"role":"user","content":"hi"}]}'

The official walkthrough is in RunPod's vLLM deployment guide, and the flag semantics are in the vLLM online serving docs. Both links were checked 2026-11-15.

Do not hand-build the image. The official one already pins vLLM, the CUDA runtime and dependencies to versions that work together, and hand-rolled images fail on driver mismatch with errors that are hard to read.

When something breaks, start with the table below. Five symptoms cover most first-week failures.

SymptomCauseFix
502 or connection refusedPort 8000 is not exposed in the pod configAdd 8000 to exposed ports and restart
401 during downloadGated model without a Hugging Face tokenSet HF_TOKEN in the environment
CUDA out of memory at startupNot enough VRAM, or max-model-len too largeDrop memory utilization to 0.85, switch to a quantized checkpoint or a larger card
Log reports a length limitmax-model-len exceeds what the model supportsSet it within the model card value
Requests queue until timeoutConcurrency above max-num-seqs, or a proxy timeoutRaise max-num-seqs or lower max_tokens per request

3. The serverless route: three variables you must set

The worker runs out of the box, but leave these three unset and it either fails or costs twice as much.

  • MAX_MODEL_LEN: context length. Too high eats VRAM, too low rejects long prompts.
  • GPU_MEMORY_UTILIZATION: defaults near 0.9; drop to 0.85 when you hit OOM.
  • TENSOR_PARALLEL_SIZE: multi-GPU sharding. Set it to 2 for a 70B model on two cards.

Queue-based or load-balanced? If your caller is an async batch job, use queue-based and poll for results. If you already run an HTTP service, use load-balanced and expose your container port. Billing is identical; only the way requests arrive differs. RunPod documents the trade-off in Pods or Serverless, and the steps live in the serverless vLLM quickstart.

You set those three values under the endpoint's public environment variables. Saving rebuilds the workers, which takes minutes, so decide what you want before editing rather than iterating in one session.

4. Turn dollars per hour into dollars per million tokens

One formula, three inputs. Know two and you can estimate the third.

Cost per million output tokens = GPU-hour price / (tokens per second x 3600) x 1,000,000 / utilization.

The GPU-hour price comes from your invoice, tokens per second comes from a load test, and utilization comes from monitoring. Throughput is the input people guess at, so every row below states its assumption.

ScenarioConfigGPU-hourAssumed throughputPer million tokens
8B FP16RTX 4090$0.89350 tok/s$0.71
8B FP16L40S$1.09600 tok/s$0.50
8B FP16H100 PCIe$2.891,400 tok/s$0.57
70B 4-bit2x A100 SXM$4.38450 tok/s$2.70
70B 4-bit2x H100 PCIe$5.78800 tok/s$2.01
70B 4-bit2x H100 SXM$8.78900 tok/s$2.71

Prices are a RunPod on-demand snapshot from the TransAtlas price database taken 2026-11-15 03:27 UTC. Throughput figures are assumptions for 8 to 16 concurrent requests, not measurements. Halve the throughput and the cost doubles, which is why a small load test should come before any commitment.

The formula only covers output. Input tokens burn compute too, and prefill on long documents is not a rounding error: an 8,000-token document with a 300-token answer can spend two to three times more compute on the input side than the output side. Hosted APIs priced per output token usually fold this into the rate. If you self-host and budget on output volume alone, the estimate comes out low.

Higher concurrency is not free either. Batching raises throughput and stretches time to first token, so pushing max sequences to the ceiling can double p95. The balance usually sits at moderate concurrency, and only a load test finds it.

Break-even works the same way: divide the pod hourly rate by the equivalent serverless hourly rate and the ratio is your threshold. If serverless costs 1.5x the pod rate, a pod wins above 67% utilization; at 2x the threshold falls to 50%. Those multipliers are examples only, since the two numbers in your console settle it. To plug in your own bill, use the cost calculator; to compare cards, filter the live price database by model.

A worked example makes it concrete. For 8B on H100 PCIe, $2.89 / (1,400 x 3,600) x 1,000,000 is about $0.57 at full utilization. If traffic only exists six hours a day, utilization is 25% and the real cost becomes $2.29, four times the headline number. That gap is where serverless earns its keep.

5. Where cold start time actually goes

"30 seconds" and "200 milliseconds" look like a contradiction; they time different stages.

  1. Pull the container image, hundreds of megabytes to several gigabytes depending on the image.
  2. Download the weights. A 4-bit 70B checkpoint is around 40GB, and this stage dominates.
  3. Load weights into VRAM and initialize CUDA, seconds to tens of seconds.
  4. Warm up: graph capture and memory allocation, after which requests are fast.

The 200ms figure describes stage four already done, starting from a reusable container snapshot. On a first deploy or right after swapping models, none of the first three stages can be skipped.

Warm-up also repeats. Changing the model, the max-model-len value, the driver or the CUDA version sends the container through the first three stages again. During heavy iteration, keeping weights on a volume beats buying a faster card.

Three ways to shorten it: keep weights on a network volume, bake the model into the image and trade image size for boot speed, or keep one minimum worker alive so the endpoint never scales to zero, at the cost of one always-on instance.

6. Three things to test before launch

Pricing without a throughput test means budgeting on someone else's assumptions.

  • Time to first token (TTFT): what users feel, especially on long prompts.
  • Output throughput: tokens per second at a fixed concurrency, the numerator of the cost formula.
  • KV cache usage: sustained values above 90% lead to OOM and are your earliest scaling signal.

The method is simple. Fix a prompt-length distribution, ramp concurrency from 1 to 16, and record p50 and p95 at each step. Put the throughput at your target concurrency back into the formula before you trust any cost number. vLLM exposes the metrics endpoint, so you do not need to instrument anything yourself.

Do not benchmark with a fixed short prompt. Real traffic's prompt-length distribution drives prefill cost and KV cache pressure, and numbers measured on "hello" look far better than production. Prepare short, medium and long buckets and send them in realistic proportions.

7. When not to use RunPod

Three cases where you should walk away instead of optimizing pennies.

  • Compliance or data residency requires specific regions or certifications; confirm coverage before assuming it exists.
  • You need contractual SLAs and reserved capacity; on-demand instances cannot promise either.
  • Monthly volume is low enough that a GPU idles most of the day; a hosted API is cheaper and skips operations entirely.

None of that is a knock on the platform. If you need control over weight versions, a private fine-tuned model, or prompts that stay inside your own network, self-hosting remains the right call.

One softer test: if nobody on the team wants to own containers, drivers and CUDA versions, the hidden ops cost outweighs the savings. With a platform engineer on staff, the marginal cost of self-hosting is low.

Sources

These documents were used to verify deployment steps, billing basis and compatibility notes. Links checked 2026-11-15.

FAQ

Do I have to re-download the model after stopping a pod?

It depends on the network volume. Keep weights on a volume mounted at the Hugging Face cache directory and a restart reads from disk in tens of seconds. Without a volume, every restart re-downloads, and a 70B model is tens of gigabytes.

Does the serverless idle timeout burn the budget?

Yes, but it is bounded. Workers bill from start until the idle timeout expires, so a 30-second timeout with 10-second requests makes the real cost 4x the compute cost. Shorten the timeout or batch requests closer together and the multiplier drops.

Which GPU should an 8B model use?

Check VRAM first, price second. An FP16 8B model needs about 16GB of weights, so plan for 24GB with KV cache; an RTX 4090 or L4 will run it. Under the throughput assumptions here, the L40S has the lowest cost per million tokens because its throughput-to-price ratio is better.

RunPod claims 200ms cold starts; I measured 40 seconds. Who is wrong?

Neither, they measure different stages. The 200ms figure is a start from a pre-warmed container snapshot. The 40 seconds includes image pull and weight download, which the first deployment always pays.

When is a hosted API cheaper than self-hosting?

When traffic is so low that a GPU sits idle. Below roughly 10% utilization, per-token API pricing usually wins on the formula above, and you skip operations and load testing.

实时比较 GPU 云算力价格

在 TransAtlas 查看所有平台的实时 GPU 租赁价格,找到最优方案。

All articles