Every "which relay is fastest" post I read is a snapshot someone took last month. Latency moves. Availability moves. You need your own number, taken now.
One file, standard library only, no pip install, no API key needed for a connectivity check.
Two things that actually decide whether your coding agent is usable:
python3 bench.py https://your-relay.example/v1 --key $RELAY_KEY --rounds 5
Output:
| endpoint | ok | status | median | fastest | slowest |
|-------------------------------|-----|--------|--------|---------|---------|
| https://your-relay.example/v1 | 5/5 | 200 | 412ms | 388ms | 471ms |
It is on PyPI if you would rather not clone:
pip install ttapi-relay-bench
ttapi-relay-bench https://your-relay.example/v1 --rounds 5
This is the part that actually matters.
Symptom What it means
--- ---
All 4xx Key or model permission — not a network problem
5xx on some rounds Upstream channel flapping; check if consecutive
High median, normal fastest Rate limiting or congestion, not a slow endpoint
Only `error` populated DNS / TLS / timeout — look locally first
The mistake I made early: testing once, seeing 5xx, blaming the relay. Five rounds showed 4/5 succeeded — failures were upstream, and the relay was already failing over correctly.
A single request tells you almost nothing. Sampling variance alone is ±100ms on a normal connection. Median of 5–10 rounds is stable enough to compare two endpoints; a single sample is not.
*Code: api-relay-benchmark · PyPI: ttapi-relay-bench · Docs: kuku-momo.github.io/ai-relay*