catalog: a relay's 404 "不支持当前入口协议" is a wrong endpoint, so the model goes to the next API (equinox0253 on X)

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.
This commit is contained in:
yetone
2026-11-13 14:55:15 +08:00
parent 4af0f05cff
commit 25ac5a6f65
3 changed files with 15 additions and 0 deletions
+7
View File
@@ -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
+3
View File
@@ -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},
@@ -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},
} {