gateway: to the key magpie-claude-desktop, /v1/models lists every model by an id Claude Desktop takes — anthropic/<id> for one that doesn't say claude, sonnet, opus, haiku or anthropic — so its Test connection passes and its models can be picked from the list

This commit is contained in:
yetone
2026-09-28 10:24:56 +08:00
parent c887c041f9
commit b1fa0c5dfa
2 changed files with 32 additions and 2 deletions
+10
View File
@@ -38,6 +38,16 @@ func TestAnthropicPrefixedModel(t *testing.T) {
if rec.Code != 200 {
t.Fatalf("HEAD /api/hello: %d", rec.Code)
}
req := httptest.NewRequest("GET", "/v1/models", nil)
req.Header.Set("x-api-key", Token+"-claude-desktop")
rec = httptest.NewRecorder()
New().Handler().ServeHTTP(rec, req)
if !strings.Contains(rec.Body.String(), `"id":"anthropic/fake/m1"`) {
t.Fatalf("Claude Desktop's list: %s", rec.Body)
}
if claudeLooking("devin/claude-opus-5-5") != "devin/claude-opus-5-5" {
t.Fatal("a Claude id was prefixed")
}
if got := unprefixed("claude-sonnet-4-5"); got != "claude-sonnet-4-5" {
t.Fatalf("unprefixed changed %q", got)
}