Skip to content

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

provider: Ark's plan models that see images are sent them, not their descriptions (tongzhenbao on X)

yetone10c85e1fe93f
diff --git a/internal/gateway/vision_ark_plan_test.go b/internal/gateway/vision_ark_plan_test.go
new file mode 100644
index 000000000..9ae16f7ef
--- /dev/null
+++ b/internal/gateway/vision_ark_plan_test.go
@@ -0,0 +1,42 @@
+package gateway
+
+import (
+ "net/http/httptest"
+ "strings"
+ "testing"
+
+ "github.com/yetone/magpie/internal/provider"
+)
+
+// tongzhenbao on X: an image to Volcengine Ark's Coding Plan took 100+s to
+// the first token. The plan's /models lists none of its models, and
+// models.dev's resellers disagree on doubao-seed-2.1-pro, so magpie took
+// it for text-only and had another model describe every image before Ark
+// was asked. Ark's own list says it sees: its image goes to it as sent, and
+// the describer isn't asked. A plan model Ark's list says is text-only
+// (glm-5.3-flash) still has its image described.
+func TestArkPlanModelThatSeesIsSentTheImage(t *testing.T) {
+ s, u := eyed(t)
+ up := strings.TrimSuffix(mustFind(t, "probe").Chat, "/v1")
+ if err := provider.Save(provider.Provider{ID: "volcengine", Name: "Volcengine Ark", Preset: "volcengine", Chat: up + "/api/coding/v3", Key: "ark-k",
+ Models: []string{"doubao-seed-2.1-pro", "glm-5.3-flash"}}); err != nil {
+ t.Fatal(err)
+ }
+ for _, model := range []string{"doubao-seed-2.1-pro", "glm-5.3-flash"} {
+ body := `{"model":"volcengine/` + model + `","input":[{"role":"user","content":[{"type":"input_text","text":"read"},{"type":"input_image","image_url":"data:image/png;base64,aGVsbG8="}]}]}`
+ rec := httptest.NewRecorder()
+ s.Handler().ServeHTTP(rec, httptest.NewRequest("POST", "/v1/responses", strings.NewReader(body)))
+ if rec.Code != 200 {
+ t.Fatalf("%s: %d %s", model, rec.Code, rec.Body.String())
+ }
+ }
+ if got := u.sent("doubao-seed-2.1-pro"); len(got) != 1 || !strings.Contains(got[0], "aGVsbG8=") || strings.Contains(got[0], "HELLO") {
+ t.Fatalf("doubao-seed-2.1-pro, which Ark says sees, was sent %v", got)
+ }
+ if got := u.sent("glm-5.3-flash"); len(got) != 1 || strings.Contains(got[0], "aGVsbG8=") || !strings.Contains(got[0], "HELLO") {
+ t.Fatalf("glm-5.3-flash, which Ark says is text-only, was sent %v", got)
+ }
+ if n := len(u.sent("eye")); n != 1 {
+ t.Fatalf("the describer was asked %d times, want once (for glm-5.3-flash alone)", n)
+ }
+}
diff --git a/internal/provider/models.go b/internal/provider/models.go
index e8d8fd468..8ae16ad7d 100644
--- a/internal/provider/models.go
+++ b/internal/provider/models.go
@@ -1103,8 +1103,16 @@ func (p Provider) planModels(ms []catalog.Model) []catalog.Model {
}
}
if len(out) == 0 {
+ var images map[string]bool
+ if r := p.regionOf(pr); r != nil {
+ images = r.Images
+ }
for _, id := range models {
- out = append(out, catalog.Model{ID: id, Name: id})
+ m := catalog.Model{ID: id, Name: id}
+ if v, ok := images[id]; ok {
+ m.ImageInput, m.Images = &v, v
+ }
+ out = append(out, m)
}
}
if len(free) == 0 && p.IsCline() {
diff --git a/internal/provider/presets.go b/internal/provider/presets.go
index 58cf97a6b..719c46e4b 100644
--- a/internal/provider/presets.go
+++ b/internal/provider/presets.go
@@ -105,6 +105,10 @@ type Region struct {
Embeddings []string `json:"embeddings,omitempty"`
Drawers []string `json:"drawers,omitempty"`
Videos []string `json:"videos,omitempty"`
+ // Images says which of Models take images, as the vendor's own list
+ // says, for a plan whose /models doesn't list its models: a model
+ // it leaves out is judged as before (models.dev, the user's say).
+ Images map[string]bool `json:"-"`
// Decide is the region's decision API, for a preset that routes groups
Decide string `json:"decide,omitempty"`
}
@@ -129,6 +133,19 @@ var arkPlanModels = []string{"ark-code-latest", "doubao-seed-evolving", "doubao-
"doubao-seed-2.0-mini", "minimax-m3", "glm-5.3", "glm-5.3-flash", "deepseek-v4.1-flash", "deepseek-v4.1-flash-economy", "deepseek-v4-flash", "deepseek-v4-pro",
"kimi-k2.8-preview", "kimi-k3", "kimi-k3.1-pro"}
+// arkPlanImages are which of arkPlanModels take images, as Ark's own
+// /api/coding/v3/models says of the dated model each one is (its
+// input_modalities, 10-29): models.dev's resellers disagree on
+// doubao-seed-2.1-pro and say nothing of 2.1-lite, so magpie took them for
+// text-only and had every image of theirs described by another model
+// first, a minute or more before the first token (tongzhenbao on X). The
+// ones Ark's list doesn't name (ark-code-latest, glm-5.3, kimi-k3,
+// kimi-k2.8-preview, minimax-m3) are left to models.dev.
+var arkPlanImages = map[string]bool{
+ "doubao-seed-evolving": true, "doubao-seed-2.1-pro": true, "doubao-seed-2.1-lite": true, "doubao-seed-2.0-mini": true, "kimi-k3.1-pro": true,
+ "glm-5.3-flash": false, "deepseek-v4.1-flash": false, "deepseek-v4.1-flash-economy": false, "deepseek-v4-flash": false, "deepseek-v4-pro": false,
+}
+
// alibabaPlanModels are the text models of Alibaba's Token Plan, the same
// on the Qwen AI platform's and on Bailian's, as their overviews list them.
var alibabaPlanModels = []string{"auto", "qwen3.8-max", "qwen3.8-flash", "qwen3.7-max", "qwen3.7-plus", "qwen3.6-flash",
@@ -344,10 +361,10 @@ var presets = []PresetDef{
Website: "https://www.volcengine.com/docs/82379/1925114", KeysURL: "https://ark.volcengine.com/region:cn-beijing/apikey",
RegionLabel: "Plan", KeyPlans: true, Regions: []Region{
{ID: "coding", Name: "Coding Plan", Chat: "https://ark.cn-beijing.volces.com/api/coding/v3", Responses: "https://ark.cn-beijing.volces.com/api/coding/v3", Anthropic: "https://ark.cn-beijing.volces.com/api/coding",
- Models: arkPlanModels,
+ Models: arkPlanModels, Images: arkPlanImages,
Embeddings: []string{"doubao-embedding-vision"}},
{ID: "agent", Name: "Agent Plan", Chat: "https://ark.cn-beijing.volces.com/api/plan/v3", Responses: "https://ark.cn-beijing.volces.com/api/plan/v3", Anthropic: "https://ark.cn-beijing.volces.com/api/plan",
- Models: arkPlanModels,
+ Models: arkPlanModels, Images: arkPlanImages,
Embeddings: []string{"doubao-embedding-vision"},
Drawers: []string{"doubao-seedream-5-0-pro", "doubao-seedream-5.0-flash"},
Videos: []string{"doubao-seedance-2.0", "doubao-seedance-2.0-fast", "doubao-seedance-2.0-mini", "doubao-seedance-2.5"}},
diff --git a/internal/provider/volcengine_test.go b/internal/provider/volcengine_test.go
index c380d8a6d..361a593d7 100644
--- a/internal/provider/volcengine_test.go
+++ b/internal/provider/volcengine_test.go
@@ -200,3 +200,26 @@ func TestVolcenginePlanModelsAsDocumented(t *testing.T) {
t.Fatalf("a user's picks %v exposed as %v", p.Models, got)
}
}
+
+// What Ark's list says of a plan model's images names a model of the
+// plan, and reaches the plan's models (tongzhenbao on X).
+func TestArkPlanImagesAreThePlans(t *testing.T) {
+ for id := range arkPlanImages {
+ if !slices.Contains(arkPlanModels, id) {
+ t.Errorf("arkPlanImages names %q, which isn't a plan model", id)
+ }
+ }
+ p, err := FromPreset("volcengine")
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, m := range p.planModels(nil) {
+ want, ok := arkPlanImages[m.ID]
+ switch {
+ case !ok && m.ImageInput != nil:
+ t.Errorf("%s: Ark's list doesn't name it, but it is marked %v", m.ID, *m.ImageInput)
+ case ok && (m.ImageInput == nil || *m.ImageInput != want || m.Images != want):
+ t.Errorf("%s: images %v (%v), want %v", m.ID, m.Images, m.ImageInput, want)
+ }
+ }
+}