pacod-gw speaks one dialect to its clients and every provider's to the providers. An OpenAI-style request to an OpenAI model is patched in place and sent on. The same request to a Claude or a Gemini model is translated through the gateway's neutral model into Anthropic's or Google's format, and the answer, streamed or whole, is translated back. This run with pacod-benchmark measures what that translation costs.

The run

The suite is the example "Translation cost". Every cell sends the same OpenAI-style request in managed mode: 60 words of prompt, at most 64 tokens of answer. Two axes vary:

axes:
  mock.family: [openai, anthropic, gemini]
  request.stream: [true, false]

Every mock answers its head after 200 ms and produces 20 chunks, 20 ms apart. The example's load is 20 callers. This run raised it to 200 callers in a closed loop, held for a minute, so that a translation cost hidden at a low load would show. Each of the six cells has its own baseline, the same calls made straight to the same mock, which makes twelve cells.

The run was made on 11 November on a pacod-gw test installation: gateway commit 7054b67, one instance, Valkey as its cache store. All 174,781 calls succeeded.

The gateway's own time

pacod-gw reports on every response how long it held the request before the response head. Over the steady minute:

Mock Stream Gateway p50 p95 p99
OpenAI (patched) whole 0.092 ms 0.125 ms 0.153 ms
Anthropic (translated) whole 0.123 ms 0.163 ms 0.195 ms
Gemini (translated) whole 0.129 ms 0.169 ms 0.203 ms
OpenAI (patched) streamed 0.059 ms 0.103 ms 0.131 ms
Anthropic (translated) streamed 0.069 ms 0.121 ms 0.145 ms
Gemini (translated) streamed 0.063 ms 0.118 ms 0.147 ms

For a whole answer, translation added about 0.03 to 0.04 ms at the median and 0.05 ms at the 99th percentile. For a streamed one, it added about 0.01 ms. Even the slowest single call of the run, at 0.838 ms, stayed under a millisecond.

These figures stop at the response head. For a whole answer, the head comes after the answer has been translated, so the translation is inside them. For a stream it is not: each of the 20 chunks is translated after the head, as it arrives, and the gateway's own figure does not see that. The whole call does.

The whole call

The latencies are the whole call, from request to last chunk, over the steady minute:

Mock Stream Cell calls/s Cell p50 Baseline p50 Cell p99 Baseline p99
OpenAI whole 266.4 750 ms 750 ms 987 ms 987 ms
Anthropic whole 268.8 741 ms 741 ms 971 ms 2.24 s
Gemini whole 262.4 741 ms 741 ms 2.11 s 987 ms
OpenAI streamed 210.6 913 ms 922 ms 1.55 s 1.34 s
Anthropic streamed 211.3 905 ms 897 ms 1.58 s 1.30 s
Gemini streamed 227.1 864 ms 872 ms 1.19 s 1.56 s

Every median is its baseline's within one histogram step, 8 ms at this latency. The streamed Gemini cell was about 40 ms quicker than the other two, and so was its baseline, so that difference is the mock's, not the translation's. Twenty translated chunks per call, 200 calls at a time, made no difference that this run can measure.

Reading the tails

Two p99 figures stand out:

  • the Anthropic baseline's, at 2.24 s;
  • the Gemini cell's, at 2.11 s.

The per-second series explain both. In each of the two minutes, completions all but stopped for a second (0 and 37, against about 270 in the seconds around them), and the next second's median was above 2.2 s. The stall struck once in a baseline, which never touches the gateway, and once in a cell. It came from the machine, which ran the load agent, the mocks and the gateway together.

The table shows one more effect of that machine. At 200 callers, streamed calls took 120 to 165 ms longer than whole ones, in the baselines as much as in the cells. The agent, with its two CPUs, was reading 200 streams of 20 chunks each, on the gateway's own machine.

What it means

Calling a Claude or a Gemini model through an OpenAI client costs a few hundredths of a millisecond in the gateway, which is far below what a provider takes to answer. The run's page states its own limit, though:

agent local ran on the gateway's machine; the mock is shared with other load (the tester's load tests)

That makes this run a measure of behaviour, not capacity (see the first benchmark post). It shows the translation is cheap. It does not show how many translated calls a gateway can carry, because the agent and the gateway competed for the same machine.

Try it

cargo run -p pacod-bench -- run --suite examples/suites/translation.yaml --target target.toml \
  --agents local=http://127.0.0.1:18096 --out report.json

Raise the load in the suite's load.stages to repeat this run's 200 callers. The suite and the rest of pacod-benchmark are in the repository. The gateway's dialects are on the pacod-gw page.