LLM Output Speed in Tokens per Second: Per-Stream vs Throughput

Blog / Performance

LLM Output Speed in Tokens per Second: Per-Stream vs Throughput

When you look at LLM output speed, first work out which kind of tokens/s the number describes. It could be how many tokens per second a single request produces after the first token (per-stream speed), or how many tokens per second a server produces in total while handling many requests at once (throughput). When you wait for a block of code to finish generating in your terminal, you experience the former. The big numbers in vendor and load-test documents are usually the latter. You can roughly estimate the total time of a request as: time to first token + output tokens ÷ per-stream speed.

This article covers only the generation phase after the first token. For how to break down connection setup, gateway round trips, and time to first token (TTFT), see AI API latency breakdown: connection setup, gateway round trip, and time to first token.

What does tokens/s actually measure?

Per-stream speed: the number you feel

Per-stream speed (also called decode speed or per-request output speed) looks at one request only: the average number of tokens per second from the moment the first token arrives to the moment the last one arrives. The calculation:

per-stream speed ≈ (output tokens − 1) ÷ (time of last token − time of first token)

We subtract 1 because the first token's time is already counted in TTFT. This number determines how long you wait for a long output, and it has little to do with your network. Once tokens start flowing back, the network mostly affects the jitter in when each chunk arrives, not the average rate.

Throughput: the server's total capacity

Throughput is the sum of output tokens across all requests on the server over a period of time. Inference services combine multiple requests into a batch and compute them together. The larger the batch, the higher the GPU utilization and the higher the total throughput, but the speed each individual request gets usually drops.

So the same deployment can be both "fast" and "slow" at once: at a concurrency of 64 the total throughput is high, while your own request's per-stream speed is lower than it would be at a concurrency of 1. When you see a tokens/s number, ask three things first. Is it per-stream or aggregate? What was the concurrency? How long were the input and output? A number that doesn't answer those three questions can't be used for comparison.

A table to tell the common metrics apart

MetricWhat it measuresMainly affected byWho cares most
TTFT (time to first token)One request, before generationNetwork, queueing, input length (prefill)Interactive use such as chat and completion
Per-stream speed (tok/s)One request, during generationModel size, hardware, batch size, quantizationLong outputs: code generation, translation, long-form writing
Throughput (tok/s)The whole service or clusterConcurrency, batching strategy, hardware countInference providers, batch jobs
Total timeOne request, end to endAll of the above plus output lengthUsers and your timeout settings

How long will a request take? Work it out with the formula

total time ≈ TTFT + output tokens ÷ per-stream speed

All the numbers below are assumptions, used only to show orders of magnitude. They do not represent any specific model or provider. Assume a TTFT of 1.5 seconds and a per-stream speed of 50 tok/s:

Scenario (assumed)Output tokensGeneration phaseTotal time
One-sentence answer1002 sabout 3.5 s
Code for one function60012 sabout 13.5 s
Rewriting a whole file4,00080 sabout 81.5 s
Long-document translation (assume 8,000 tokens of translated text)8,000160 sabout 161.5 s

Two things stand out:

  1. For short answers, TTFT dominates how fast it feels, so optimizing the network and reusing connections makes a clear difference.
  2. For long outputs, the wait is almost entirely determined by per-stream speed and output length. Cutting TTFT from 1.5 s to 0.5 s barely matters for an 80-second file rewrite, while raising per-stream speed from 50 to 100 tok/s saves 40 seconds outright.

This also explains why "on the same network, asking a question is fast but asking it to edit code is slow." If you use a tool like Claude Code, keep in mind that the agent sends several requests in a row, and each round pays one TTFT plus one generation time. For how to troubleshoot that, see Claude Code is slow to respond: where the latency comes from.

Also, models with a reasoning (thinking) phase first generate reasoning tokens that you either cannot see or see only as a summary. Those tokens take generation time too and are billed as output (for how billing works, see How token billing works), so "not much visible text, but a long wait" is common.

What changes per-stream speed?

Concurrency and batch size

The heavier the load on the provider side, the larger the batch and the less compute each request gets. You can't control this part. It shows up as the same request running at different speeds at different times of day. When you benchmark yourself, run several tests at different times and take the median.

Output length and context length

Generating each new token requires reading the cache of all previous tokens. The longer the context, the heavier each step, and per-stream speed tends to fall with it. A request with 100K input tokens and one with 1K input tokens can run at noticeably different speeds even if the outputs are the same length. When comparing speeds, keep the input length the same.

Quantization precision

For the same open-weight model, different inference providers may deploy it at different numerical precisions, such as fp8 or fp4. Lower precision uses less memory and bandwidth and is usually faster and cheaper, but output quality may differ.

In cdnping's OpenRouter model snapshot from 2026-10-17, you can see this difference directly. One open-weight model had 36 provider endpoints: 17 labeled fp8, 3 fp4, 1 mxfp4, and 15 with no published precision (unknown). Another open-weight model had 26 endpoints: 9 fp4, 7 mxfp4, 2 fp8, and 8 unknown. For the closed-source models in the snapshot, every endpoint's precision was labeled unknown. In other words, when you call "the same model name" on an aggregator, the backend may be deployments at different precisions, and both speed and quality may differ. For the effect of precision on quality, see Did the model get dumber, or did the provider change? Inference providers and fp8/fp4 quantization.

Provider and hardware

The same model runs on different hardware and inference frameworks at different providers, so per-stream speed can differ noticeably. Availability differs too; see How much can uptime differ when you switch OpenRouter providers for the same model.

Where can you see each provider's speed?

cdnping's model monitoring page (/en/models) is built on OpenRouter's public API. For each model, it lists every inference provider's uptime, latency, throughput, and quantization precision, and automatically records listings, delistings, price changes, and quantization changes. Throughput and latency there are live data. In the snapshot taken when this article was written those two fields were empty, so the article quotes no specific values; please go by the current values on the page.

Here is a suggested way to use the page:

  1. Pick one model first and compare throughput and latency across its providers. Don't compare across models.
  2. Look at the quantization column at the same time. If an endpoint is conspicuously fast, check whether it uses lower precision.
  3. Read it together with uptime. An endpoint that is fast but fails often can end up with a longer total time.

If you suspect the network rather than generation is the slow part, use the online speed test on the homepage to measure each API's first-connection and round-trip times. If you suspect a service-wide problem, check the API status page (/en/status) for recent probe results. How the data is collected is described in Methodology.

How do you measure per-stream speed yourself?

Third-party pages give you averages. Your own network, account, and requests are the final answer. Both methods below only need an OpenAI-compatible endpoint.

Method 1: watch the streaming cadence with curl

curl -sN https://api.example.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model",
    "stream": true,
    "max_tokens": 800,
    "messages": [{"role": "user", "content": "用 Python 写一个带注释的 LRU 缓存实现"}]
  }' | while IFS= read -r line; do
    printf '%s %s\n' "$(date +%s.%N | cut -c1-14)" "${line:0:60}"
  done

Each line is prefixed with its arrival time. The time of the first data: line with content, minus the time you sent the request, is roughly the TTFT. The time of the final data: [DONE] line minus the time of the first content line is the generation phase. Note that -N turns off buffering; without it everything comes out at once and the timestamps are meaningless. (The prompt asks the model to write an LRU cache implementation in Python with comments.)

Method 2: compute tok/s directly with a script

curl can't count tokens. The Python below uses only the standard library and reads usage.completion_tokens as returned by the server after the request ends:

import json, os, time, urllib.request

URL = "https://api.example.com/v1/chat/completions"
body = {
    "model": "your-model",
    "stream": True,
    "stream_options": {"include_usage": True},
    "max_tokens": 800,
    "messages": [{"role": "user", "content": "用 Python 写一个带注释的 LRU 缓存实现"}],
}
req = urllib.request.Request(URL, data=json.dumps(body).encode(), headers={
    "Authorization": "Bearer " + os.environ["API_KEY"],
    "Content-Type": "application/json",
})

t0 = time.perf_counter()
t_first = t_last = None
out_tokens = None
with urllib.request.urlopen(req, timeout=300) as resp:
    for raw in resp:
        line = raw.decode().strip()
        if not line.startswith("data:") or line == "data: [DONE]":
            continue
        chunk = json.loads(line[5:])
        if chunk.get("usage"):
            out_tokens = chunk["usage"].get("completion_tokens")
        for c in chunk.get("choices", []):
            if c.get("delta", {}).get("content"):
                t_last = time.perf_counter()
                t_first = t_first or t_last

if t_first is None:
    raise SystemExit("没有收到可见内容,检查模型名或改为统计推理内容的到达时间")
ttft = t_first - t0
gen = t_last - t_first
print(f"TTFT {ttft:.2f}s  生成 {gen:.2f}s  输出 {out_tokens} token")
if out_tokens and gen > 0:
    print(f"单流速度约 {(out_tokens - 1) / gen:.1f} tok/s")

(The strings are in Chinese: the error message reads "No visible content received; check the model name or time the arrival of reasoning content instead." The output lines print TTFT, generation time, and output tokens, then "per-stream speed about N tok/s".)

A few notes:

  • Some endpoints don't support stream_options, in which case usage may be empty. You can make a separate non-streaming request to get the token count, or estimate it with the vendor's tokenizer.
  • For reasoning models, completion_tokens includes reasoning tokens, but the script above only starts timing when visible content arrives, so the result will come out too high. When testing such models, count reasoning-content deltas as "arrivals" too.
  • Run each configuration at least 5 times, drop the highest and lowest, and take the median.

Benchmark checklist

  • Fix the input prompt and max_tokens so output lengths are close
  • Compare providers within the same time window, so load levels match
  • Record TTFT and per-stream speed separately, not just total time
  • Note the quantization precision of the provider endpoint (look it up on /en/models)
  • When testing concurrency, record both aggregate throughput and per-request speed

What can you do when it's slow?

  • Output less: have the model return only a diff or the changed snippet instead of the whole file. By the formula above, halving the output tokens roughly halves the generation time.
  • Hand simple tasks to a lightweight model: completion, classification, and formatting don't need the biggest model. For routing by task, see How to do multi-model routing.
  • Switch provider endpoints: compare throughput for the same model on /en/models, and watch precision and uptime too.
  • Split long jobs: translate a long document by chapter in parallel. Each stream's speed stays about the same, and total wall-clock time shrinks, provided you don't trigger rate limits (for how to check your limits, see What to do when the API returns 429 Too Many Requests).

Related articles

Keep reading