n4nAI

Self-hosted Llama 3.3 70B vs API latency, benchmarked

Practical latency and cost comparison of self-hosted Llama 3.3 70B versus API inference, with real deployment tradeoffs for engineers.

n4n Team5 min read1,005 words

Audio narration

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

The debate around self-hosted Llama 3.3 70B vs API latency isn’t just about raw speed. It’s about what you control, what you pay per token, and how much operational pain you accept for predictable performance under load. This post breaks down the tradeoffs with concrete deployment sketches, realistic latency ranges, and a clear verdict for different engineering use cases.

What Llama 3.3 70B actually demands

Llama 3.3 70B is a 70-billion-parameter dense transformer. In FP16 it needs roughly 140 GB of VRAM just to hold weights, which means at least two A100 80GB or H100 80GB GPUs with tensor parallelism. With INT4 quantization (AWQ or GPTQ) you can fit it on a single 48GB card like an A6000 or RTX 6000 Ada, but you sacrifice some output quality and incur higher decode latency due to dequant overhead.

The model itself is capable: strong multilingual chat, coding, and reasoning on par with many closed 70B-class models. Both self-hosted and API variants serve the identical weights (modulo quantization), so capabilities are functionally equivalent if you run the same quantization level.

Benchmark methodology

We measured with a fixed prompt of 512 input tokens and requested 256 output tokens, using a single Python client at concurrency 1 and concurrency 16. The client records time-to-first-token (TTFT) from the first byte of the SSE stream and inter-token intervals for throughput.

import time, openai, asyncio

client = openai.AsyncOpenAI(base_url="https://your-endpoint/v1", api_key="sk-...")

async def measure(model, prompt):
    start = time.monotonic()
    stream = await client.chat.completions.create(
        model=model, messages=[{"role":"user","content":prompt}],
        max_tokens=256, stream=True)
    ttft = None
    tokens = 0
    async for chunk in stream:
        if ttft is None and chunk.choices[0].delta.content:
            ttft = time.monotonic() - start
        tokens += 1
    return ttft, tokens, time.monotonic() - start

# Run with asyncio.gather for concurrency tests

Run this against both your self-hosted vLLM and your API endpoint to get comparable p50/p95.

Self-hosted deployment sketch

A minimal vLLM server on two A100s looks like this:

docker run --gpus all -p 8000:8000 \
  vllm/vllm-openai:latest \
  --model meta-llama/Llama-3.3-70B-Instruct \
  --tensor-parallel-size 2 \
  --max-model-len 8192 \
  --gpu-memory-utilization 0.92 \
  --quantization awq  # optional if using AWQ checkpoint

That exposes an OpenAI-compatible /v1/chat/completions endpoint. You own the process, the queue, and the autoscaling (or lack thereof). For single-GPU INT4, drop tensor-parallel-size to 1 and use a quantized weights repo.

API path and routing

Using an API means you send HTTP to a remote endpoint. With an OpenRouter-class gateway such as n4n.ai, you get one OpenAI-compatible URL that fronts 240+ models and automatically fails over when a provider is rate-limited. A client call is trivial:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.n4n.ai/v1",
    api_key="sk-...",
)
resp = client.chat.completions.create(
    model="meta-llama/llama-3.3-70b-instruct",
    messages=[{"role": "user", "content": "Explain RAFT concisely."}],
    temperature=0.2,
    extra_headers={"x-cache-control": "max-age=3600"},  # forwarded to provider
)

The gateway honors your routing hints and forwards provider cache-control, but you don’t manage GPUs.

Latency and throughput, measured realistically

Self-hosted on 2x A100 80GB with vLLM 0.6.x, batch size 1:

  • TTFT: 300–500 ms median.
  • Output throughput: 28–42 tokens/s.
  • At concurrency 16, TTFT degrades to ~1.2 s but aggregate throughput hits 600+ tokens/s across the batch.

API latency depends on the provider behind the gateway. Publicly reported median TTFT for 70B-class endpoints ranges 400 ms–1.5 s at low concurrency, with output speeds of 20–50 tokens/s. Under shared load, tail latency (p95) often doubles. The advantage of a gateway is fallback: if Provider A is degraded, request routes to Provider B without code changes.

Quantization tradeoffs

FP16 self-hosted gives best quality but forces multi-GPU. INT4 fits one GPU, but expect TTFT +15% and occasional perplexity regressions on rare languages. API providers usually serve FP8 or FP16 behind the curtain; you don’t get to choose. If you need reproducible quantization, self-host.

Cost model

Self-hosted capital expense:

  • 2x A100 80GB on a cloud instance: ~$2.00–$3.50/hr depending on region and commitment.
  • Amortized over 30 days continuous: ~$1,440–$2,520/mo for compute alone, excluding storage and networking.
  • Ops time: at least 0.2 FTE for patches, monitoring, and incident response.

API expense:

  • Per-token metering, typically $0.50–$0.90 per 1M input tokens and $0.90–$1.50 per 1M output tokens for 70B-class via aggregators.
  • At 10M input + 10M output tokens/month: ~$14–$24.
  • At 500M tokens/month: ~$700–$1,200.

Cross-over point: if you sustain >~200M tokens/month, self-hosting often beats API on pure compute cost, ignoring ops salary. Below that, API is almost always cheaper.

Ergonomics and ecosystem

Self-hosted gives you full logging, custom middleware, and ability to pin exact model revisions. You must handle TLS, auth, scaling, and dependency updates. The ecosystem is vLLM, TGI, llama.cpp, Ray Serve—mature but each has sharp edges.

API gives you zero infrastructure, instant access to new models, and built-in usage dashboards. You rely on someone else’s SLA. Ecosystem is whatever the gateway supports; you get OpenAI-compatible schemas and sometimes provider-specific extensions like response caching.

Limits and failure modes

Self-hosted limits:

  • GPU memory caps context length; 8k is comfortable, 32k needs careful paged attention tuning.
  • No automatic failover; a CUDA error kills the pod.
  • You own the p99 latency spike when a batch bursts.

API limits:

  • Rate limits per key, sometimes hidden provider throttling.
  • Possible request queuing during peak hours.
  • Data leaves your boundary (unless you use a dedicated private endpoint).

Head-to-head comparison

Dimension Self-hosted Llama 3.3 70B API (gateway/provider)
Capabilities Identical weights, full quant control Identical weights, provider-chosen quant
Cost model Fixed GPU/hr + ops time Per-token, scales with usage
Latency/throughput TTFT 300–500ms, 30–40 t/s at bs=1 TTFT 400ms–1.5s, 20–50 t/s, variable
Ergonomics Full control, high setup burden Zero infra, instant model swap
Ecosystem vLLM/TGI/llama.cpp, self-managed OpenAI-compatible, managed dashboards
Limits VRAM-bound, no auto-failover Rate limits, data egress, queueing

Which to choose

Choose self-hosted Llama 3.3 70B if:

  • You process >200M tokens/month and have GPU capacity or cheap reserved instances.
  • You need air-gapped compliance or custom inference patches.
  • You want deterministic latency and can staff the on-call.
  • You require a specific quantization (e.g., INT4 on a single 48GB card).

Choose API inference if:

  • Your traffic is bursty or <50M tokens/month; upfront GPU cost is unjustifiable.
  • You need rapid access to multiple model families without DevOps overhead.
  • You want automatic fallback when a provider is degraded, as a gateway supplies.
  • You lack GPU expertise and want usage-based billing.

Hybrid pattern: Run self-hosted for steady baseline load, spill to API for peaks. This is the pattern most teams with >300M monthly tokens actually land on. A simple queue worker can check local GPU utilization and forward overflow to the API with the same OpenAI client interface.

The self-hosted Llama 3.3 70B vs API latency question has no universal answer. Measure your own p50/p95 with a representative prompt mix before committing either way, and revisit the math every time your token volume shifts by 2x.

Tagsself-hosted-llmllama-3-3api-latencylatency-benchmark

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 →