n4nAI

Self-hosted Qwen2.5 72B throughput vs API-based inference

A head-to-head comparison of Qwen2.5 72B self-hosted throughput vs API inference across cost, latency, ergonomics, and limits, plus a verdict by use case.

n4n Team5 min read1,003 words

Audio narration

Coming soon — every post will get a voice note here.

The decision between running Qwen2.5 72B on your own hardware and calling it through an API is a trade-off between capital control and operational simplicity. The phrase Qwen2.5 72B self-hosted throughput vs API describes the core tension: do you own the GPUs or rent throughput per token? This post puts both paths side by side across the dimensions that affect production systems.

Capabilities

Model weights and behavior

Self-hosting gives you the exact weights from Hugging Face. You can apply your own LoRA adapters, swap the tokenizer, or freeze layers for distillation. API providers serve the same base model (Qwen2.5-72B-Instruct) but you consume it as a black box over HTTP. If you need deterministic weight control or on-prem compliance, self-host wins by definition.

Feature surface

Qwen2.5 ships with native function calling and a 128K context window. Both self-hosted and API paths expose these via the OpenAI chat schema. The difference is that API gateways often normalize quirks across providers. For example, an OpenRouter-class gateway like n4n.ai forwards provider cache-control hints and honors client routing directives, so you get consistent tool-call parsing even if the backend switches mid-request.

Quantization trade-offs

Self-host lets you choose FP16, AWQ, or GPTQ. Lower precision cuts VRAM and lifts throughput at a small accuracy cost you can measure on your own eval set. API providers pick the quantization for you; you only see the resulting latency and quality.

Price and cost model

Self-hosted capex and opex

A 72B model in FP16 needs ~144 GB VRAM. In practice you run 4-bit AWQ or GPTQ, fitting two A100 80GB or four RTX 4090s. Hardware alone represents a five-figure capital outlay; add power, cooling, and engineer time. Throughput per dollar only makes sense at high utilization. The economic crossover in Qwen2.5 72B self-hosted throughput vs API sits around continuous 30–40% GPU utilization for most teams, assuming you already have ML infra skills.

API per-token metering

APIs charge per input and output token. No upfront cost, but at scale the bill climbs linearly. You also pay for failed requests and retries unless the gateway handles fallback. Per-token metering means latency spikes don’t cost extra, but a chatty agent can surprise you at month end. Budget by estimating tokens per user action, not by request count.

Latency and throughput

What drives self-hosted numbers

Throughput is a function of tensor parallelism degree, quantization, and batching. With vLLM or SGLang, continuous batching hides per-request latency across concurrent streams. A 2-GPU node serves tens of simultaneous requests before KV cache limits hit. Single-stream generation lands in the tens of tokens per second; aggregate output scales with added GPUs.

When evaluating Qwen2.5 72B self-hosted throughput vs API, measure batch size first. A single user script is not representative of a served fleet.

python -m vllm.entrypoints.openai.api_server \
  --model Qwen/Qwen2.5-72B-Instruct \
  --tensor-parallel-size 2 \
  --quantization awq \
  --max-model-len 32768

API-based inference characteristics

API providers run optimized stacks on equivalent hardware. You get autoscaling, but per-request latency includes network round-trip. Rate limits cap concurrency unless you negotiate. The provider absorbs degradation; a good gateway retries against healthy backends. Observed latency varies with provider load but is generally competitive with self-hosted on similar hardware because the serving code is the same open-source core.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.example-gateway.com/v1",
    api_key="sk-...",
)
resp = client.chat.completions.create(
    model="qwen2.5-72b-instruct",
    messages=[{"role": "user", "content": "Explain throughput trade-offs."}],
)

Ergonomics and ops

Standing up self-host

You manage the image, the CUDA drivers, the model download, and the load balancer. Upgrades mean re-launching containers. Observability is on you: Prometheus scrape of GPU metrics, log aggregation, alerting on VRAM leaks. A single node is easy; a redundant cluster is a real ops job.

Calling an API

One credential, one endpoint, SDKs in every language. You still need retry logic, but fallback can be delegated. For teams without ML infra experience, the API path ships in an afternoon. The trade is that you depend on someone else’s uptime and pricing.

Ecosystem and tooling

Self-hosted leans on vLLM, TensorRT-LLM, Hugging Face TGI, and llama.cpp. You can attach Ray for distributed inference or Triton for multi-model serving. API ecosystems lean on provider SDKs, LangChain integrations, and OpenTelemetry from the gateway. The self-host community publishes quant recipes and CUDA graphs; the API community publishes prompt tricks and routing configs.

Limits and ceilings

Self-hosted limit is your wallet and rack space. Hit VRAM wall? Buy more GPUs or shard with tensor parallelism. API limit is the provider’s quota and max context per request. Some gateways pass through 128K context; others truncate. Check before you pipe long documents. Self-host has no arbitrary requests-per-minute cap; API does unless you pay for enterprise tiers.

Head-to-head summary

Dimension Self-hosted Qwen2.5 72B API-based inference
Capabilities Full weight control, custom adapters Black-box, normalized tool calls
Cost model Capex + opex, flat at utilization Per-token, linear with usage
Throughput Scales with your GPUs, batch-friendly Provider-scaled, rate-limited
Latency LAN-speed, no network tax Network round-trip + queue
Ergonomics High ops burden Low setup, credential only
Ecosystem vLLM, TGI, llama.cpp Gateway SDKs, fallback built-in
Limits Hardware ceiling Provider quota & context caps

Which to choose

High-volume internal workloads

If you saturate GPUs for 8+ hours a day, self-host. The Qwen2.5 72B self-hosted throughput vs API math favors ownership once utilization clears the crossover. Buy two A100s, run vLLM, and skip per-token fees.

Prototyping and sporadic traffic

API wins. You avoid the hardware sink and iterate on product logic. A gateway with fallback keeps you online when one provider throttles. Start here even if you plan to migrate later.

Regulated or air-gapped data

Self-host or a dedicated tenant. API sends prompts off-prem; even with encryption, policy may forbid it. Run quantized weights inside the VPC and keep request logs local.

Latency-sensitive edge

Self-host near the user. A local 4-bit Qwen2.5 on a single 80GB card beats cross-region API calls for sub-100ms first token. If you can’t place GPUs at the edge, API with a nearby region is the compromise.

The verdict is utilization, data policy, and team shape. Most startups should start API and migrate hot paths to self-host when the token bill rivals a GPU node. That sequence limits risk and keeps the Qwen2.5 72B self-hosted throughput vs API question grounded in real numbers from your own traffic.

Tagsqwen2-5self-hosted-llmthroughput-benchmarkapi-latency

Written by

n4n Team

The team building n4n — a single OpenAI-compatible API in front of 240+ models, with automatic fallback, load balancing and pay-per-token metering.

More from n4n Team →

All self-hosted vs api performance posts →