Repository navigation
Conversation
The Playground could already name a key, but not the relay (proxy) a
request leaves through. When a relay is suspected of throttling or
breaking, the only way to tell was to read the request log and hope the
routing landed on the relay in question.
Add an optional `relay` to POST /api/debug/inference:
{"relay": {"index": 3, "name": "socks5h://127.0.0.1:10804"}}
Index is the position in the configured proxy list, name is the proxy
URL; either alone is enough and supplying both requires them to agree.
An unknown relay is a 400 rather than a silent fallback, because a typo
would otherwise read as a relay verdict.
The pin is resolved against Gateway.transports, the shared proxy list, so
it applies on every tier: the anonymous lane walks exactly that exit and
a key request is sent through that proxy. Both lanes are capped at a
single attempt, since rotating keys or exits would no longer describe the
relay that was asked for.
The request stays marked diagnostic, so a pinned attempt writes no
cooldown, proxy health or IP-block state and cannot poison the relays it
is meant to measure. Session minting, system prompt, tool shaping and the
transport remain the production path, so the answer is comparable to real
traffic.
GET /api/debug/models now returns `relays` in configuration order, and
the result carries `relay_test` with the relay that actually served the
request. The Playground renders a relay selector from that list and shows
the tested relay in the result facts. Per-attempt legs on the anonymous
lane now append the redacted relay, so the request log shows which exit
each attempt used.
jasonxu114514
pushed a commit
that referenced
this pull request
Nov 5, 2026
Resolved against #170 so a relay pin clears the per-attempt WARP choice (attemptUseWARP). The relay list is now credential-redacted, and a pin may name a relay by its redacted URL.
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Playground can already name the key a diagnostic request uses, but not the relay (proxy) it leaves through. When one relay is suspected of throttling or breaking, the only way to tell was to read the request log and hope routing landed on the relay in question.
This adds an explicit relay pin, so one relay can be exercised in isolation.
Design
gateway.RelaySelectionnames a relay by index, by name, or both:{"relay": {"index": 3, "name": "socks5h://127.0.0.1:10804"}}indexis the position in the configured proxy list,nameis the proxy URL. Either alone is enough; supplying both requires them to agree.Gateway.transports, the shared proxy list, so the pin applies on every tier — not just the anonymous lane.400 unknown_relay, never a silent fallback: a typo would otherwise read as a relay verdict.The pin is applied as a context value (
gateway.WithRelayOverride), so the request stays on the production path — session minting, system prompt, tool shaping and the transport are unchanged. Only the exit is forced.Both lanes are capped at one attempt while pinned:
limit = 1attemptLimit = 1, and the key's proxy binding is replaced by the pinned relayRotating keys or exits would no longer describe the relay that was asked for.
The request is still marked diagnostic, so a pinned attempt writes no cooldown, proxy health or IP-block state — it cannot poison the relays it is meant to measure.
API
POST /api/debug/inferencegains an optionalrelayfield:{ "protocol": "openai", "key": {"mode": "auto"}, "relay": {"index": 3}, "request": {"model": "...", "messages": [...]} }GET /api/debug/modelsnow returnsrelays, the configured proxy names in configuration order.DebugInferenceResultgainsrelay_test, the relay that actually served the request.UI
The Playground (Diagnostics → request test) renders a Relay selector under Upstream Key, populated from
relays, defaulting to Any relay (normal routing). The result panel gains a Relay tested row. Strings added for en/vi/it.Per-attempt legs on the anonymous lane now append the redacted relay (
anon:200:412ms@socks5h://…), so the request log shows which exit each attempt used.Testing
go build ./cmd/opencode2api && go vet ./internal/gateway ./internal/adminThen, with the gateway running:
Verified live: index
0/3/5/7resolved to the expected relays, name-only resolution worked, a mismatched index+name pair and an out-of-range index both returned400.