Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

provider, plugin: a plugin model that says it gives no text leaves the chat lists (#3279)

yetone8c63c5b7873c
diff --git a/docs/subsystems/provider-plugins.md b/docs/subsystems/provider-plugins.md
index f120d03f1..6c44709ec 100644
--- a/docs/subsystems/provider-plugins.md
+++ b/docs/subsystems/provider-plugins.md
@@ -158,6 +158,10 @@ A 401 marks the account's sign-in by default (`notePluginSignIn` in [`plugins.go
magpie never reads `free` from `rate`: `rate` 0 is none given (`plugin.Model.Rate` in [`providers.go`](../../internal/plugin/providers.go)), and a model is free only by its own `free: true` or a $0 list price (`FreeModel` in [`models.go`](../../internal/provider/models.go)). A plugin sets `free` from the vendor's word; the guide says so ([magpie-community/plugins#468](https://github.com/magpie-community/plugins/issues/468)).
+## A model that gives no text
+
+A model's `capabilities.output` says what it gives. The host passes on the kinds marked `true` (`kinds` in [`host.js`](../../internal/plugin/host.js), `plugin.Model.Outputs`) and whether the object said yes or no to any kind at all (`kindsSaid`, `plugin.Model.OutputsSaid`), so an embedding's `{"text": false}` is a model said to give nothing, not one said nothing of. `pluginCatalog` leaves out a model whose outputs were said and name no text, image or video (`pluginTalks` in [`plugins.go`](../../internal/provider/plugins.go)): an embedding, a TTS that gives audio alone. Every chat list builds on that list (`/v1/models`, the agents' `provider.Catalog`, `Available` and the editor's chips, routing), as the catalog's own lists leave such models out (`textModel`), #3279. A model whose plugin says nothing of its outputs is kept, whatever its id; an image or video model alone is kept where it is until #2792 places it. Tests: `TestPluginModelGivingNoTextLeavesTheChatLists` (gateway, a real host), `TestPluginModelSayingNoTextLeavesTheChatList`, `TestPluginAccountListLeavesTheSpeechlessOut`.
+
## A GitHub listing's licence
A repository tagged `magpie-plugin` shows the licence GitHub's search reads from its `LICENSE` file. GitHub gives `NOASSERTION` for a file it can't match to one (MIT's text with a line of credit added) and nothing for none, and magpie drops `NOASSERTION`, so such a card had no licence while the same package on npm shows its `package.json` `license`. `readTagged` in [`github.go`](../../internal/plugin/github.go) now keeps `package.json`'s `license` (a string) as `PkgLicense`, and `License` falls back to it, on a fresh read and on one kept across searches (`fresh`) ([magpie-community/plugins#468](https://github.com/magpie-community/plugins/issues/468)). `TestTaggedRepos` covers both cases and the one with neither.
diff --git a/internal/gateway/plugin_kinds_test.go b/internal/gateway/plugin_kinds_test.go
new file mode 100644
index 000000000..1014d36a8
--- /dev/null
+++ b/internal/gateway/plugin_kinds_test.go
@@ -0,0 +1,72 @@
+package gateway
+
+import (
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "strings"
+ "testing"
+
+ "github.com/yetone/magpie/internal/provider"
+)
+
+// A plugin model that says it gives no text is no model to talk with: its
+// embedding and its TTS leave the chat lists, the gateway's /v1/models,
+// the agents' (provider.Catalog) and the provider's own (Available, the
+// GUI's chips), as XYenon's Google AI Studio plugin lists them (#3279). A
+// model naming text among what it gives stays, speaking or drawing too.
+// An embedding is known by what its plugin says, not its id (bge-m3).
+func TestPluginModelGivingNoTextLeavesTheChatLists(t *testing.T) {
+ t.Setenv("FAKE_KINDS", "1")
+ pid := besideFake(t, "google-ai-studio", &cursorUp{})
+
+ gone := []string{"gemini-embedding-001", "bge-m3", "gemini-2.5-flash-preview-tts"}
+ kept := []string{"fake-1", "gemini-2.5-flash-native-audio", "gemini-2.5-flash-image"}
+ check := func(where string, got map[string]bool) {
+ t.Helper()
+ for _, id := range gone {
+ if got[id] {
+ t.Errorf("%s lists %s, which gives no text", where, id)
+ }
+ }
+ for _, id := range kept {
+ if !got[id] {
+ t.Errorf("%s lost %s", where, id)
+ }
+ }
+ }
+
+ rec := httptest.NewRecorder()
+ New().Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/v1/models", nil))
+ var list struct {
+ Data []struct{ ID string } `json:"data"`
+ }
+ if err := json.Unmarshal(rec.Body.Bytes(), &list); err != nil {
+ t.Fatalf("/v1/models: %v\n%s", err, rec.Body.String())
+ }
+ got := map[string]bool{}
+ for _, m := range list.Data {
+ if id, ok := strings.CutPrefix(m.ID, pid+"/"); ok {
+ got[id] = true
+ }
+ }
+ check("/v1/models", got)
+
+ got = map[string]bool{}
+ for _, e := range provider.Catalog() {
+ if e.Provider.ID == pid {
+ got[e.Model] = true
+ }
+ }
+ check("the agents' catalog", got)
+
+ p, err := provider.Find(pid)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got = map[string]bool{}
+ for _, m := range p.Available() {
+ got[m.ID] = true
+ }
+ check("Available", got)
+}
diff --git a/internal/plugin/host.js b/internal/plugin/host.js
index 034490874..1ed552cbd 100644
--- a/internal/plugin/host.js
+++ b/internal/plugin/host.js
@@ -1705,6 +1705,11 @@ function kinds(c) {
return out.length ? out : undefined
}
+// kindsSaid is whether a capabilities.input or .output says yes or no to a kind
+// at all: one that says no to each (an embedding's {"text": false}, #3279)
+// gives no kinds, and is not one that said nothing.
+const kindsSaid = (c) => !!c && typeof c === "object" && MODALITIES.some((k) => typeof c[k] === "boolean")
+
// fromModelsDev is a models.dev model as OpenCode's provider list has it.
function fromModelsDev(p, m) {
return {
@@ -2035,6 +2040,7 @@ async function providers({ proxies } = {}) {
// every kind it takes and gives, not image alone (#1595)
inputs: kinds(m.capabilities?.input),
outputs: kinds(m.capabilities?.output),
+ outputsSaid: kindsSaid(m.capabilities?.output),
released: m.release_date ?? "",
cost: m.cost,
variants: Object.keys(m.variants ?? {}),
diff --git a/internal/plugin/providers.go b/internal/plugin/providers.go
index c55760b8c..b4f30eee3 100644
--- a/internal/plugin/providers.go
+++ b/internal/plugin/providers.go
@@ -91,6 +91,10 @@ type Model struct {
// OpenCode's order: not image alone (#1595)
Inputs []string `json:"inputs,omitempty"`
Outputs []string `json:"outputs,omitempty"`
+ // OutputsSaid is whether capabilities.output said yes or no to any
+ // kind: an embedding's {"text": false} gives no Outputs and is still
+ // said (#3279), where a model said nothing of gives none and isn't
+ OutputsSaid bool `json:"outputsSaid,omitempty"`
// Fast is set by the plugin on a model it runs in its vendor's fast
// mode when the request says service_tier "priority" (m.fast: Cursor's
// plugin from 0.2.2, for a model Cursor has a fast variant of)
diff --git a/internal/plugin/testdata/fake/index.js b/internal/plugin/testdata/fake/index.js
index e19e22651..3d8e3f2b4 100644
--- a/internal/plugin/testdata/fake/index.js
+++ b/internal/plugin/testdata/fake/index.js
@@ -349,6 +349,20 @@ export const FakePlugin = async ({ client }) => ({
p.models["mimo-v2.6-flash-free"] = { ...p.models["fake-1"], id: "mimo-v2.6-flash-free", name: "MiMo V2.6 Flash Free", api: { ...p.models["fake-1"].api, id: "mimo-v2.6-flash-free" }, free: true, variants: {},
capabilities: {"temperature":true,"reasoning":true,"attachment":true,"toolcall":true,"input":{"text":true,"image":true,"audio":true,"video":true,"pdf":false},"output":{"text":true,"image":false,"audio":false,"video":false,"pdf":false},"interleaved":{"field":"reasoning_content"}} }
}
+ // $FAKE_KINDS: models as XYenon's magpie-google-ai-studio lists them
+ // (#3279): the embedding as the report gives it (output text false,
+ // nothing else said), one not named an embedding, a TTS with its
+ // parseModels' outputs (audio alone), a model that talks and speaks,
+ // one that talks and draws
+ if (process.env.FAKE_KINDS) {
+ const as = (id, output) => ({ ...p.models["fake-1"], id, name: id, api: { ...p.models["fake-1"].api, id }, free: false,
+ capabilities: { ...p.models["fake-1"].capabilities, input: { text: true }, output } })
+ p.models["gemini-embedding-001"] = as("gemini-embedding-001", { text: false })
+ p.models["bge-m3"] = as("bge-m3", { text: false })
+ p.models["gemini-2.5-flash-preview-tts"] = as("gemini-2.5-flash-preview-tts", { text: false, image: false, audio: true, video: false, pdf: false })
+ p.models["gemini-2.5-flash-native-audio"] = as("gemini-2.5-flash-native-audio", { text: true, image: false, audio: true, video: false, pdf: false })
+ p.models["gemini-2.5-flash-image"] = as("gemini-2.5-flash-image", { text: true, image: true, audio: false, video: false, pdf: false })
+ }
// $FAKE_SEARCHER: one more model, that searches the web by itself
// when asked in plain words, marked on the list the hook gives, as
// Trae CN's search_agent ("Search") is listed beside its chat models
diff --git a/internal/provider/plugin_speech_test.go b/internal/provider/plugin_speech_test.go
new file mode 100644
index 000000000..c041fdbf0
--- /dev/null
+++ b/internal/provider/plugin_speech_test.go
@@ -0,0 +1,110 @@
+package provider
+
+import (
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/yetone/magpie/internal/catalog"
+ "github.com/yetone/magpie/internal/plugin"
+ "github.com/yetone/magpie/internal/settings"
+)
+
+// gaiModels are a Google AI Studio plugin's models as the host hands them
+// over (#3279): the embeddings say "text": false and nothing else
+// (OutputsSaid, no Outputs), one named for what it is and one not; a TTS
+// names audio alone. Beside them: models that talk (and speak, or draw), a
+// drawing model alone (#2792's to place), one said nothing of, and one
+// whose id says embedding while its plugin says nothing of what it gives.
+var gaiModels = []plugin.Model{
+ {ID: "gemini-embedding-001", Name: "Gemini Embedding 001", Inputs: []string{"text"}, OutputsSaid: true},
+ {ID: "bge-m3", Name: "BGE M3", Inputs: []string{"text"}, OutputsSaid: true},
+ {ID: "gemini-2.5-flash-preview-tts", Name: "Gemini TTS", Inputs: []string{"text"}, Outputs: []string{"audio"}, OutputsSaid: true},
+ {ID: "gemini-2.5-flash", Name: "Gemini Flash", Outputs: []string{"text"}, OutputsSaid: true},
+ {ID: "gemini-2.5-flash-native-audio", Name: "Native Audio", Outputs: []string{"text", "audio"}, OutputsSaid: true},
+ {ID: "imagen-4", Name: "Imagen 4", Outputs: []string{"image"}, OutputsSaid: true},
+ {ID: "a-quiet-elder", Name: "Quiet"},
+ {ID: "embedder-chat", Name: "Unsaid"},
+}
+
+var (
+ gaiGone = []string{"gemini-embedding-001", "bge-m3", "gemini-2.5-flash-preview-tts"}
+ gaiKept = []string{"gemini-2.5-flash", "gemini-2.5-flash-native-audio", "imagen-4", "a-quiet-elder", "embedder-chat"}
+)
+
+// gaiPlugin is a Google AI Studio plugin signed in, its models gaiModels.
+func gaiPlugin(t *testing.T) {
+ t.Helper()
+ claudeHome(t)
+ t.Setenv("MAGPIE_BUN", "")
+ os.MkdirAll(filepath.Dir(catalog.CachePath()), 0o755)
+ os.WriteFile(catalog.CachePath(), []byte(`{}`), 0o644)
+ catalog.Reset()
+ t.Cleanup(catalog.Reset)
+ spec := "@magpie-community/opencode-google-ai-studio"
+ write := func(name string, v any) {
+ t.Helper()
+ b, _ := json.Marshal(v)
+ os.MkdirAll(settings.Dir(), 0o700)
+ if err := os.WriteFile(filepath.Join(settings.Dir(), name), b, 0o600); err != nil {
+ t.Fatal(err)
+ }
+ }
+ write("plugins.json", map[string]any{"plugins": []map[string]any{{"spec": spec}}})
+ write("plugin-auth.json", map[string]map[string]any{"google-ai-studio": {"type": "api", "key": "sk-gai-1234"}})
+ plugin.UseCached([]plugin.Provider{{ID: "google-ai-studio", Spec: spec, Name: "Google AI Studio",
+ Methods: []plugin.Method{{Type: "api", Label: "API key"}},
+ Accounts: []plugin.Account{{Key: "google-ai-studio", Type: "api"}},
+ Models: gaiModels}})
+ t.Cleanup(func() { plugin.UseCached(nil) })
+}
+
+// A model its plugin says gives nothing to talk with is no chat model: the
+// catalog's own leave such a model out (textModel), but a plugin's list
+// took every model as one (#3279: a Google AI Studio account's
+// gemini-embedding-001 and its TTS sat in the chat list). A model said
+// nothing of keeps its place whatever its id, and text (or an image, #2792's
+// to place) among the outputs keeps it: what isn't said isn't guessed.
+func TestPluginModelSayingNoTextLeavesTheChatList(t *testing.T) {
+ pp := plugin.Provider{ID: "google-ai-studio", Models: gaiModels}
+ got := map[string]bool{}
+ for _, m := range pluginCatalog(pp) {
+ got[m.ID] = true
+ }
+ for _, gone := range gaiGone {
+ if got[gone] {
+ t.Errorf("%s: in the list, though the plugin says it gives nothing to talk with", gone)
+ }
+ }
+ for _, kept := range gaiKept {
+ if !got[kept] {
+ t.Errorf("%s: lost from the list", kept)
+ }
+ }
+}
+
+// The account's list is what the chat chips, the agents' lists and the
+// gateway build on (Available), and the embedding and the TTS are out of it
+// there too, the models to talk with kept.
+func TestPluginAccountListLeavesTheSpeechlessOut(t *testing.T) {
+ gaiPlugin(t)
+ p, err := Find("google-ai-studio")
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := map[string]bool{}
+ for _, m := range p.Available() {
+ got[m.ID] = true
+ }
+ for _, gone := range gaiGone {
+ if got[gone] {
+ t.Errorf("%s: in Available (the editor's chat chips)", gone)
+ }
+ }
+ for _, kept := range gaiKept {
+ if !got[kept] {
+ t.Errorf("%s: lost from Available", kept)
+ }
+ }
+}
diff --git a/internal/provider/plugins.go b/internal/provider/plugins.go
index 354d2de13..b03333fc8 100644
--- a/internal/provider/plugins.go
+++ b/internal/provider/plugins.go
@@ -254,6 +254,9 @@ func pluginTierOn(provider string, m plugin.Model, tier string) bool {
func pluginCatalog(pp plugin.Provider) []catalog.Model {
out := make([]catalog.Model, 0, len(pp.Models))
for _, m := range pp.Models {
+ if !pluginTalks(m) {
+ continue
+ }
c := catalog.Model{
ID: m.ID, Name: m.Name, Provider: pp.ID, Released: m.Released,
APIs: []string{string(pluginProtocol(pp.ID, m))}, Images: m.Image,
@@ -319,6 +322,20 @@ func pluginCatalog(pp plugin.Provider) []catalog.Model {
return out
}
+// pluginTalks is whether m is a model to talk with, as its plugin says
+// what it gives: one that gives text, or images or videos (whose place is
+// #2792's to decide, a drawing model kept where it is until then), or one
+// said nothing of. An embedding ({"text": false}) and a TTS (audio alone)
+// are not, and stay out of every chat list, as the catalog's own lists
+// leave them out (textModel), #3279. Nothing is guessed from its id: a
+// plugin that says nothing of its outputs keeps every model it lists.
+func pluginTalks(m plugin.Model) bool {
+ if !m.OutputsSaid {
+ return true
+ }
+ return slices.ContainsFunc(m.Outputs, func(k string) bool { return k == "text" || k == "image" || k == "video" })
+}
+
// pluginPrice is m's price as its plugin gives it (m.Cost), if it gives
// one: OpenCode's price of a model it has none for is 0, so only an input
// or output price above it is one. A cache price of 0 is none given.