Files
magpie/docs
yetone ee6f8866f3 gateway: Claude Desktop's connection check goes to its default model
CyberCaius on Discord, v0.1.1838, after restarting Claude Desktop: as it
starts and from Test connection (Configure third-party inference ->
Gateway), Desktop said "Gateway rejected model
magpie-0958175816.anthropic.claude-haiku-5-5[1m] (HTTP 400)", the body
"AnyRouter: bad response status code 400". His default model in Desktop
is his routing group 天翼云; Routing showed leee/claude-haiku-5-5 sent to
AnyRouter gpt-6.1-sol.

Why 02a328d86 (v0.1.1821) didn't cover it: it routed the check as a
title is, to desktopPicked, the model the last session's tool turn ran
on, kept on disk across restarts. At start and in Desktop's settings no
session is running, so that was a days-old AnyRouter session's model,
not the model he chose. Desktop names the check's model itself (YT in
its app.asar 2.7032: the shortest /v1/models id with haiku in it, here
leee's haiku), and its own settings call the first listed model the
default ("the default model (the first listed model)",
resolveDefaultSessionModel). And AnyRouter 400'd the check because a
max_tokens of 1 reaches the GPT model below OpenAI's floor of 16; the
relay passes on no floor, so tokenFloor had nothing to ask again at
(02a328d86's test faked OpenAI's own wording, which a relay hides).

Now desktopProbe (Desktop's exact body: max_tokens 1, one user message
".", no system or tools) goes to desktopDefault, the first model listed
to Desktop (its order on the Agents page), so his 天翼云 group gets it
with zero config. The check is asked for 16 tokens upstream
(desktopProbeTokens); Desktop reads only whether it is answered. Titles
still go to the session's model.

Tests: TestClaudeDesktopProbeToSessionModel becomes
TestClaudeDesktopProbeToDefaultModel, with the literal id
magpie-0958175816.anthropic.claude-haiku-5-5[1m] (leee/claude-haiku-5-5's
alias), a session turn on anyrouter/gpt-6.1-sol first, 天翼云 as a group
listed first, and a relay that answers fewer than 16 tokens with
AnyRouter's opaque 400. The check reaches 天翼云 (leee and the relay get
nothing); with the relay's model listed first it is answered there in
one call. TestDesktopProbe is back.

Run (mote, at this tree):
- go test -tags nogui ./internal/gateway/ -run 'Desktop|Title|CacheKey|
  TooFew|TokenFloor|Alias|Science': ok
- Not run to the end: the whole internal/gateway package (started on
  mote, still running when this was pushed as asked) and the full suite.
- go vet ./internal/gateway/ (darwin, GOOS=linux, GOOS=windows), go
  build ./...: ok; gofmt -l: clean

Broken by hand: the probe branch taken out of desktopTurn -> red "probe
went to leee () or the relay (1 calls), not Desktop's default 天翼云";
the 16-token room turned off -> red with his exact error, 400 "AnyRouter:
bad response status code 400".

No GUI file is reached. Not tried: a real AnyRouter account or a real
Claude Desktop (read from its 2.7032 app.asar). A user whose first
listed model is not the one they mean by default gets the check there:
it is Desktop's own definition.
2026-10-28 15:32:20 +08:00
..