axelburks on Discord asked that /v1/models return the image and video
models too, so a client can find them. It listed chat models alone, with
no way to ask for the others.
Decided: they are listed only when asked for, with ?kind=image,video
(or ?kind=chat,image,video, or ?kind=all), each row marked "kind":
"image" or "kind": "video". Without ?kind= the list is the same chat
list as before. Why not add them by default:
- Agents and clients offer every id this list gives as a model to chat
with: OpenCode's and Cherry Studio's model lists, ZCode's and others'
pasted ?format=text. An image or video id there would sit in their chat
pickers and fail on the first message (an image model on
/v1/chat/completions).
- OpenAI's own list mixes gpt-image and sora in with nothing to tell them
apart, so a client has no field it would already read to skip them.
- magpie's own callers that want them already ask (another magpie's
drawers header, kind=image/video/decision on the MCP list); ?kind=
gives any other client the same.
An unknown kind is a 400 that names the kinds, not read as none. A
gateway key held to models or accounts sees only its own image and video
models, as on the chat list (drawerObjects/videomakerObjects already
check modelAllowed and accountServes). Unticked image and video models
(HiddenDrawers, HiddenVideomakers) are left out.
TestModelsListMediaOnlyWhenAsked: the default list and ?kind=chat have no
image or video row (so no agent's chat picker that reads it can offer
one), ?format=text likewise; ?kind=image / video / image,video / all give
them, marked; a bad kind is 400.
Docs: docs/integrating.md, providers-accounts.md, site docs (en, zh).
Run on mote, this change rebased on f4c664a09:
- go test -count=1 -timeout 45m ./internal/catalog ./internal/provider
./internal/gateway ./internal/gui: catalog, provider and gateway ok;
gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: clean. gofmt -l: nothing.
- GUI: the 51 provider-*, drawers, image-models, i18n and
video-models-hide files, both engines, every language, wide and narrow:
1161 of 1188 ok. The 27 reds are 5 files that are red the same 27 at
origin/main d1cdce130 run alone: provider-fetch-again (#3292/#5057),
provider-models-rest (#4396), provider-picks-stay (#4397),
provider-levels-scroll (#4395), provider-typed (#4673).
video-models-hide: 22 of 22 ok.
- The whole GUI suite (all files) ran earlier at this change on 8af751987,
347 of 19153 red at load 100 to 200; the 66 files with a red, run again
alone, are red in the same tests at origin/main 17f2387e1 (all filed:
#4388, #4391, #4398, #4320, #4541/#5013, #2564, #4244, #4304 and the
above).
Rebased again onto d1cdce130 (sessions, Cursor mover, library and routing
plugins, group-unlists; nothing this change touches but gateway.go,
which merged clean) and run there: TestCoreScriptBudget and internal/gui's
new tests, the gateway's ?kind= and video tests, internal/provider and
internal/catalog, video-models-hide 22 of 22: ok.
Broken by hand, each red, then put back:
- listKinds' default returning all three kinds:
TestModelsListMediaOnlyWhenAsked red
- an unknown kind let through: TestModelsListMediaOnlyWhenAsked red
Not tried: no real client was pointed at ?kind=; the agents' pickers were
checked by what they read (the default list, unchanged), not by opening
each one.
Credit: axelburks on Discord.