Skip to content

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

cline: the Upstream tick holds Pass DeepSeek on DeepSeek with has, and leaves the plugin's to it

yetonefa22bc64676e
diff --git a/internal/gateway/cline_pin.go b/internal/gateway/cline_pin.go
index 7c7673bde..6a528b3b1 100644
--- a/internal/gateway/cline_pin.go
+++ b/internal/gateway/cline_pin.go
@@ -14,7 +14,9 @@ import (
// gets providerOptions.gateway.only, which that gateway reads to serve the
// model from that host alone, as ClinePass + ProviderPin set it
// (linux.do/t/topic/2918145); one it sends through OpenRouter gets
-// provider.only, OpenRouter's own field (sdytman on Discord). A body
+// provider.only, OpenRouter's own field (sdytman on Discord). A ClinePass
+// DeepSeek model's carries the gateway's has filter beside only, which
+// ClinePass needs for the pin to hold (provider.ClinePassHas). A body
// naming provider or providerOptions itself is left as the client sent
// it. The field goes at the end, so the prefix a cache keys on doesn't
// change.
@@ -31,7 +33,11 @@ func clinePin(p provider.Provider, to provider.Protocol, body []byte) []byte {
if end < 0 || start < 0 || start > end {
return body
}
- key, opts := "providerOptions", map[string]any{"gateway": map[string]any{"only": []string{up}}}
+ gw := map[string]any{"only": []string{up}}
+ if has := p.ClinePassHas(gjson.GetBytes(body, "model").String(), chatImages(body)); has != nil {
+ gw["has"] = has
+ }
+ key, opts := "providerOptions", map[string]any{"gateway": gw}
if openRouter {
key, opts = "provider", map[string]any{"only": []string{up}}
}
@@ -47,3 +53,18 @@ func clinePin(p provider.Provider, to provider.Protocol, body []byte) []byte {
out = append(out, val...)
return append(out, body[end:]...)
}
+
+// chatImages is whether a Chat body carries an image part
+func chatImages(body []byte) bool {
+ found := false
+ gjson.GetBytes(body, "messages").ForEach(func(_, m gjson.Result) bool {
+ m.Get("content").ForEach(func(_, part gjson.Result) bool {
+ if t := part.Get("type").String(); t == "image_url" || t == "image" || t == "input_image" {
+ found = true
+ }
+ return !found
+ })
+ return !found
+ })
+ return found
+}
diff --git a/internal/gateway/cline_pin_test.go b/internal/gateway/cline_pin_test.go
index 03a46ba90..f419513a5 100644
--- a/internal/gateway/cline_pin_test.go
+++ b/internal/gateway/cline_pin_test.go
@@ -65,12 +65,23 @@ func TestClinePinsDeepSeekAndGLM(t *testing.T) {
chat := func(model, extra string) string {
return ask("/v1/chat/completions", `{"model":"`+model+`","messages":[{"role":"user","content":"Say pong"}]`+extra+`}`)
}
- const pinned = `{"gateway":{"only":["deepseek"]}}`
+ // DeepSeek's only alone left ClinePass free to pick another upstream;
+ // has ["implicit-caching"] beside it is what held a request on
+ // DeepSeek (hy125245 on X, 10-23), and "vision" joins it when the
+ // request carries an image
+ const pinned = `{"gateway":{"has":["implicit-caching"],"only":["deepseek"]}}`
for _, m := range []string{"cline/cline-pass/deepseek-v4-pro", "cline/cline-pass/deepseek-v4.1-flash", "cline/cline-pass/deepseek-v4.1-flash-1017"} {
if got := chat(m, ""); got != pinned || orPin() != "" {
t.Errorf("%s: providerOptions %s provider %s, want providerOptions %s alone (sent %s)", m, got, orPin(), pinned, sent)
}
}
+ const seeing = `{"gateway":{"has":["vision","implicit-caching"],"only":["deepseek"]}}`
+ if got := ask("/v1/chat/completions", `{"model":"cline/cline-pass/deepseek-v4.1-flash","messages":[{"role":"user","content":[{"type":"text","text":"What is this?"},{"type":"image_url","image_url":{"url":"data:image/png;base64,iVBORw0KGgo="}}]}]}`); got != seeing {
+ t.Errorf("an image: providerOptions %s, want %s", got, seeing)
+ }
+ if got := ask("/v1/chat/completions", `{"model":"cline/cline-pass/deepseek-v4.1-flash","messages":[{"role":"user","content":[{"type":"text","text":"Say \"image_url\""}]}]}`); got != pinned {
+ t.Errorf("the word image_url in text: providerOptions %s, want %s", got, pinned)
+ }
if got := ask("/v1/messages", `{"model":"cline/cline-pass/deepseek-v4-pro","max_tokens":64,"messages":[{"role":"user","content":"Say pong"}]}`); got != pinned {
t.Errorf("messages: providerOptions %s, want %s", got, pinned)
}
diff --git a/internal/gateway/plugin_cline_pin_test.go b/internal/gateway/plugin_cline_pin_test.go
index e464df37c..9c803b257 100644
--- a/internal/gateway/plugin_cline_pin_test.go
+++ b/internal/gateway/plugin_cline_pin_test.go
@@ -106,6 +106,21 @@ func TestClinePluginPinsDeepSeekAndGLM(t *testing.T) {
if p, err = provider.Find(pid); err != nil || !p.PinUpstream {
t.Fatalf("the tick wasn't kept: %+v, %v", p, err)
}
+ // ClinePass's own DeepSeek models the plugin pins itself, with the
+ // has filter that holds them on DeepSeek and a way back (0.1.11), and
+ // it keeps a body's own providerOptions: magpie's only alone would
+ // take the plugin's place, so the tick leaves them to it
+ for _, m := range []string{"cline-pass/deepseek-v4-pro", "cline-pass/deepseek-v4.1-flash", "cline-pass/deepseek-v4.1-flash-1017"} {
+ if up, _ := p.ClinePin(m); up != "" {
+ t.Errorf("%s: magpie pinned it to %q ahead of the plugin", m, up)
+ }
+ if has := p.ClinePassHas(m, true); has != nil {
+ t.Errorf("%s: magpie sent has %v ahead of the plugin", m, has)
+ }
+ }
+ if up, _ := p.ClinePin("cline-pass/glm-5.3"); up != "zai" {
+ t.Errorf("cline-pass/glm-5.3: pinned to %q, want zai", up)
+ }
got := ask()
for i, q := range got[:4] {
want := `{"gateway":{"only":["deepseek"]}}`
diff --git a/internal/provider/cline.go b/internal/provider/cline.go
index 221321aac..d807c4686 100644
--- a/internal/provider/cline.go
+++ b/internal/provider/cline.go
@@ -207,6 +207,13 @@ func (p Provider) ClinePin(model string) (upstream string, openRouter bool) {
if !p.PinUpstream || !p.ClinePinnable() || strings.HasPrefix(model, clineFreePrefix) {
return "", false
}
+ // the Cline plugin pins ClinePass's DeepSeek models itself, by default,
+ // with ClinePassHas's filter and a way back when the pin can't be
+ // served (opencode-cline-auth 0.1.11). It keeps a body's own
+ // providerOptions, so magpie's only alone would stand in its place.
+ if p.PluginProvider() == "cline" && clinePassDeepSeek(model) {
+ return "", false
+ }
name := strings.ToLower(model[strings.LastIndex(model, "/")+1:])
for _, m := range clineMakers {
if m.exact && name == m.name || !m.exact && strings.HasPrefix(name, m.name) {
@@ -215,3 +222,33 @@ func (p Provider) ClinePin(model string) (upstream string, openRouter bool) {
}
return "", false
}
+
+// clinePassDeepSeek is a ClinePass DeepSeek model: cline-pass/deepseek-…
+func clinePassDeepSeek(model string) bool {
+ return strings.HasPrefix(strings.ToLower(model), "cline-pass/deepseek")
+}
+
+// ClinePassHas is the capability filter (providerOptions.gateway.has) a
+// pinned request for model carries beside only, or nil. On ClinePass the
+// server's own routing for a DeepSeek model wins over only alone, and a
+// fake upstream in only was served all the same; with has beside it the
+// request went to DeepSeek and a fake upstream was refused "no matching
+// upstream" (hy125245 on X, 10-23). The upstream must cache a repeated
+// prefix by itself, and, for a model that takes images (images: the
+// fetched list says so, or the request carries one), take them: a
+// text-only model asked "vision" (deepseek-v4-pro) would have no upstream
+// left. The Cline plugin's provider has none here: the plugin writes it.
+func (p Provider) ClinePassHas(model string, images bool) []string {
+ if up, _ := p.ClinePin(model); up == "" || !clinePassDeepSeek(model) {
+ return nil
+ }
+ if !images {
+ if ms := p.liveByID(model); len(ms) > 0 {
+ images = ms[0].Images
+ }
+ }
+ if images {
+ return []string{"vision", "implicit-caching"}
+ }
+ return []string{"implicit-caching"}
+}