diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index 388ca5cfd..ffd0fdef5 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -1280,10 +1280,12 @@ func draws(m mdModel) bool { } // DrawsID is whether a model's id names one that makes images, for a model -// the catalog doesn't know (one typed in, or a vendor's own list's). +// the catalog doesn't know (one typed in, or a vendor's own list's). Banana +// is the Nano Banana the Gemini image models are called on a relay, whatever +// its spelling there (#2071). func DrawsID(id string) bool { id = strings.ToLower(id) - for _, w := range []string{"image", "imagen", "imagine", "dall-e", "flux", "seedream", "cogview", "stable-diffusion", "sdxl", "wanx", "kolors", "hidream"} { + for _, w := range []string{"image", "imagen", "imagine", "dall-e", "flux", "seedream", "cogview", "stable-diffusion", "sdxl", "wanx", "kolors", "hidream", "banana"} { if strings.Contains(id, w) { return true } diff --git a/internal/catalog/live_test.go b/internal/catalog/live_test.go index b831ed39b..f8198be15 100644 --- a/internal/catalog/live_test.go +++ b/internal/catalog/live_test.go @@ -269,3 +269,43 @@ func TestFetchOpenRouterNames(t *testing.T) { } } } + +// A relay names Gemini's image models for what they are called, not for +// what Google ships: "Nano Banana 2.1" and its spellings draw, though no +// word of Google's own ids is in them (#2071). A model the list says +// nothing of stays in the chat list, where the user marks what it makes +// (#1399). +func TestFetchRelayDrawerNames(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, `{"data":[ + {"id":"Nano Banana 2.1"}, + {"id":"nano-banana-pro"}, + {"id":"NanoBanana2"}, + {"id":"gemini-3-pro-image-preview"}, + {"id":"omni_flash-10s"}, + {"id":"claude-sonnet-4-5"}]}`) + })) + defer srv.Close() + ms, err := FetchURL(context.Background(), srv.URL+"/v1/models", "", false, nil) + if err != nil { + t.Fatal(err) + } + draws, chat := map[string]bool{}, map[string]bool{} + for _, m := range ms { + if m.Films { + t.Errorf("%s: films, which nothing here said", m.ID) + } else if m.Draws { + draws[m.ID] = true + } else { + chat[m.ID] = true + } + } + for _, id := range []string{"gemini-3-pro-image-preview", "Nano Banana 2.1", "nano-banana-pro", "NanoBanana2"} { + if !draws[id] { + t.Errorf("%s: not a drawer", id) + } + } + if !chat["omni_flash-10s"] || !chat["claude-sonnet-4-5"] { + t.Errorf("the chat list lost a model: omni_flash-10s %v, claude-sonnet-4-5 %v", chat["omni_flash-10s"], chat["claude-sonnet-4-5"]) + } +}