From 25ac5a6f65b772a1e380a6359ca4a53c26c8d922 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 13 Nov 2026 14:55:15 +0800 Subject: [PATCH] =?UTF-8?q?catalog:=20a=20relay's=20404=20"=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BD=93=E5=89=8D=E5=85=A5=E5=8F=A3=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE"=20is=20a=20wrong=20endpoint,=20so=20the=20model=20go?= =?UTF-8?q?es=20to=20the=20next=20API=20(equinox0253=20on=20X)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WandAPI answered Claude Code's /v1/messages for gpt-6.1-sol with 404 "模型 gpt-6.1-sol 不支持当前入口协议". f94ece2ff took a 404 only when New API's model_not_found code came with a channel or group named, which this doesn't, so the 404 went to the client and the relay's Chat/Responses URL was never asked. catalog.WrongEndpoint now takes "不支持当前入口协议" (and 该/此): the model is marked off that API and asked on the provider's next one; with no other API the refusal carries wrongAPINote, and a 404 is retryable, so a group or fallback goes to its next member as before. It names the protocol, which a wrong base URL ("404 page not found") or a missing model ("模型 X 不存在", OpenAI's "does not exist") never does; those stay plain 404s. Run (mote, -tags nogui, at origin/main 11ab58c58 + the previous commit): go test catalog; go test gateway -run WrongEndpoint|NoChannel: ok. Broken by hand: without the phrases, TestWrongEndpoint and TestNoChannelAs404FromAFork/entry_protocol (both shapes) are red. Not tried: a real WandAPI account. --- internal/catalog/catalog.go | 7 +++++++ internal/gateway/gateway_test.go | 3 +++ internal/gateway/newapi_no_channel_test.go | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index 5b968ae8c..fdad2610e 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -2284,6 +2284,13 @@ func WrongEndpoint(status int, body []byte) bool { // /v1/responses(OpenAI Responses API)。") "不支持 /v1/chat/completions 接口", "改用 /v1/responses", + // a relay's 404 for a model asked on an API it doesn't serve it + // on (equinox0253 on X: WandAPI's "模型 gpt-6.1-sol 不支持当前入口 + // 协议" to Claude Code's /v1/messages). It names the protocol, which + // a 404 for a wrong base URL or a missing model never does. + "不支持当前入口协议", + "不支持该入口协议", + "不支持此入口协议", } { if strings.Contains(msg, phrase) { return true diff --git a/internal/gateway/gateway_test.go b/internal/gateway/gateway_test.go index 950ca587a..464a0efb1 100644 --- a/internal/gateway/gateway_test.go +++ b/internal/gateway/gateway_test.go @@ -444,6 +444,9 @@ func TestWrongEndpoint(t *testing.T) { {400, agentRouterEscaped, true}, // escaped (#1669) {400, `{"error":{"message":"模型 gpt-5.6-sol 不支持 /v1/chat/completions 接口"}}`, true}, // its first clause alone {400, `{"error":{"message":"请改用 /v1/responses(OpenAI Responses API)。"}}`, true}, // its second alone + // WandAPI's 404 (equinox0253 on X), and a missing model's + {404, `{"error":{"message":"模型 gpt-6.1-sol 不支持当前入口协议","type":"new_api_error"}}`, true}, + {404, `{"error":{"message":"模型 gpt-6.1-sol 不存在","type":"new_api_error"}}`, false}, // new-api's words for a model no channel serves (written from // memory, not from the report): the model, not the API {400, `{"error":{"message":"当前分组 default 下对于模型 gone 无可用渠道"}}`, false}, diff --git a/internal/gateway/newapi_no_channel_test.go b/internal/gateway/newapi_no_channel_test.go index d4f447c17..26595efb8 100644 --- a/internal/gateway/newapi_no_channel_test.go +++ b/internal/gateway/newapi_no_channel_test.go @@ -159,6 +159,11 @@ func TestNoChannelAs404FromAFork(t *testing.T) { falls bool }{ {"fork no channel", `{"error":{"message":"分组 default 下模型 gpt-6.1-sol 暂无渠道","type":"new_api_error","code":"model_not_found"}}`, true}, + // WandAPI's own words (equinox0253 on X, 11-13): the protocol + // named, no channel; a wrong endpoint (wrongEndpoint) as the + // tweet's screenshot reads it + {"entry protocol", `{"error":{"message":"模型 gpt-6.1-sol 不支持当前入口协议","type":"new_api_error","code":"model_not_found"}}`, true}, + {"entry protocol, Anthropic's shape", `{"type":"error","error":{"type":"invalid_request_error","message":"模型 gpt-6.1-sol 不支持当前入口协议"}}`, true}, {"missing model", `{"error":{"message":"The model gpt-6.1-sol does not exist or you do not have access to it.","type":"invalid_request_error","code":"model_not_found"}}`, false}, {"wrong base URL", `404 page not found`, false}, } {