Skip to content
Redgold.AI Blog

· 7 min read · LLM gateway, latency, coding agents, measurement

What Sets the Latency of Coding-Agent Model Calls: Output Tokens vs. Prompt Size in 31,000 Calls

We timed one day of model calls from our coding agents, 31,269 calls through one gateway. For the most-used model, each 1,000 output tokens added about 23.4 seconds and each 1,000 prompt tokens about 0.02 seconds. Here is the data, the token-accounting trap we hit on the way, and what it means for agent wait time.

Coding agents spend much of their time waiting on the model. Each step of a task is one model call, and the agent does nothing until the response finishes streaming. Long prompts are the obvious suspect for slow steps: by mid-task a request carries the whole conversation, often well over 100,000 tokens.

Every call from our agents passes through one gateway, which records when the request arrived, when the last streamed byte left and the token counts the provider reported. We took the 24 hours from 29 October, 16:00 UTC: 31,269 calls, of which 30,953 had both a latency and token counts. For the most-used model, 21,602 calls with a median prompt of 137,727 tokens, the median call took 7.3 seconds, the 90th percentile 27.4 and the 99th 82.5.

Median call latency by prompt size and output size, most-used model02550<50k · Output <100: 3.5 s<50k · Output 100–299: 6.1 s<50k · Output 300–999: 10.4 s<50k · Output 1k–3k: 32.1 s<50k50–100k · Output <100: 3.9 s50–100k · Output 100–299: 6.7 s50–100k · Output 300–999: 13.7 s50–100k · Output 1k–3k: 33.2 s50–100k100–150k · Output <100: 4.4 s100–150k · Output 100–299: 7.3 s100–150k · Output 300–999: 16.7 s100–150k · Output 1k–3k: 37.6 s100–150k150–200k · Output <100: 4.6 s150–200k · Output 100–299: 7.8 s150–200k · Output 300–999: 18.1 s150–200k · Output 1k–3k: 42.2 s150–200k200k+ · Output <100: 5.2 s200k+ · Output 100–299: 8.3 s200k+ · Output 300–999: 20.1 s200k+ · Output 1k–3k: 47.3 s200k+Output <100Output 100–299Output 300–999Output 1k–3k
Median call latency by prompt size and output size, most-used model. Source: per-call metadata recorded by our model gateway for the most-used model (21,602 calls), 29 October 2026, 16:00 UTC to 30 October 2026, 16:00 UTC (written time), queried from the data engine’s hot store on 30 October 2026, 16:15–16:20 UTC. Each bar is the median end-to-end latency, from the request reaching the gateway to the last streamed byte, for calls in one prompt-size band (x axis, input tokens including cached tokens) and one output-size band (series, output tokens including reasoning tokens). Every cell has at least 37 calls.
Show the data
Output <100Output 100–299Output 300–999Output 1k–3k
<50k3.56.110.432.1
50–100k3.96.713.733.2
100–150k4.47.316.737.6
150–200k4.67.818.142.2
200k+5.28.320.147.3

Output length sets most of the wait

Read the chart within one color and then across colors. A call that writes fewer than 100 tokens took 3.5 seconds at the median with a prompt under 50,000 tokens and 5.2 seconds with a prompt over 200,000: four times the prompt, 1.7 extra seconds. Holding the prompt band fixed and moving from the shortest to the longest outputs multiplies the latency by about nine.

A least-squares fit over that model’s calls, with the slowest 1% removed, gives:

latency ≈ 1.45 s
        + 0.02 s per 1,000 prompt tokens
        + 23.4 s per 1,000 output tokens      (R² = 0.82)
Fit over 21,602 calls to the most-used model in the window. Output tokens include reasoning tokens, which the provider counts as output.

By that fit, one output token costs about as much time as 1,200 prompt tokens. Going from a 50,000-token prompt to a 200,000-token prompt adds about 3 seconds. Writing 1,000 more tokens adds about 23.

  • Why prompts are cheap here, inferred. Agent requests resend the same history with a few new messages at the end, so most of each prompt can be served from the provider’s prompt cache, and reading a cached prefix is much faster than generating. The gateway metadata we used does not carry cached-token counts per call, so we have not split the prompt effect into cached and uncached tokens.
  • Long contexts slow generation down. The prompt effect grows with output length in the chart: for outputs of 1,000 to 3,000 tokens, the median rose from 32.1 to 47.3 seconds across the prompt bands. Among calls that wrote at least 500 tokens, median output speed fell from 38.4 tokens per second with prompts under 50,000 tokens to 29.8 with prompts over 200,000. Outputs were also somewhat longer in the larger-prompt bands, which the bands only partly control for.

A few long outputs take a large share of agent time

Share of calls and of summed call latency, by output tokens02550<100 · Calls: 32.1%<100 · Call time: 12%<100100–299 · Calls: 32.4%100–299 · Call time: 15.7%100–299300–999 · Calls: 26.5%300–999 · Call time: 30.8%300–9991k–2.9k · Calls: 6.9%1k–2.9k · Call time: 21.2%1k–2.9k3k+ · Calls: 2%3k+ · Call time: 20.3%3k+CallsCall time
Share of calls and of summed call latency, by output tokens. Source: the same gateway metadata and window, all models (30,953 calls with a recorded latency and token counts). For each band of output tokens, the share of calls and the share of summed call latency. Summed latency totals 105 call-hours; calls overlap, so it measures time agents spent waiting, not wall-clock time.
Show the data
CallsCall time
<10032.112
100–29932.415.7
300–99926.530.8
1k–2.9k6.921.2
3k+220.3

Across all models, calls that wrote 3,000 tokens or more were 2.0% of the day’s calls and 20.3% of the summed waiting time. Calls under 300 output tokens were almost two thirds of the calls and 27.7% of the time. Summed over the day, agents waited 105 call-hours on model responses.

The prompt-token field differs between providers

We first tried the same analysis on the Anthropic model our agents use, and its prompt sizes made no sense: 7,060 of its 7,767 calls reported 10 or fewer prompt tokens. Anthropic’s Messages API reports input_tokens as the uncached part of the prompt only, with cache reads and cache writes in separate fields. OpenAI’s APIs report the full prompt and list the cached portion inside it. Our extract stage copies each provider’s field into one prompt-token column, so the column means different things for the two providers.

For the Anthropic model we fitted output tokens only. The fit was 1.73 seconds plus 8.87 seconds per 1,000 output tokens (R² = 0.98), about 110 tokens per second. A small OpenAI model, 1,252 calls with short prompts, took 7.85 seconds per 1,000 output tokens and 1.8 seconds at the median. These speeds come from different providers, prompt shapes and agent harnesses, so they are not a benchmark of the models against each other.

What we would do with this

Our inference from this data, rather than measured results:

  • Look at output length first when agent steps feel slow. Instructions that cut restated plans, long summaries or unnecessary reasoning effort shorten the wait more than trimming context of the same token count.
  • Keep the prompt cache warm. The low cost per prompt token here depends on resent history being served as a cached prefix.
  • Normalize token fields at ingestion. Store total prompt, cached read, cache write and output tokens in separate columns for every provider, so per-call analysis does not depend on knowing each API’s convention.
  • Track latency percentiles per output band. A rise in the median that comes from longer outputs needs a different fix from one at fixed output size, which points at the provider or the network.

Limits of this account: one day of traffic from one fleet, dominated by one model. Latency is end to end at our gateway and includes provider queueing and network time; we did not record time to first token for this analysis. The fits are linear and ignore interactions between prompt and output size, which the chart shows exist. Failed calls are almost absent from the metadata, so this describes successful calls only. The explanation of cheap prompt tokens is inference; we did not measure cache hit rates per call.