cline: the Upstream tick never writes providerOptions, which Cline refuses with 403 (#5442)
Since 2026-11-06 the Cline API answers any request carrying a
client-supplied providerOptions with 403 `client-supplied
"providerOptions" model routing is not supported`. HK-bruc1 showed it
with the same key: 403 with the field, 200 without. magpie's Upstream
tick ("DeepSeek and GLM models only from their makers' own APIs")
wrote providerOptions.gateway.only (and has) into every ClinePass
DeepSeek and GLM request, usage-billed deepseek/… and zai/glm-… too,
so with the tick on every one of them failed.
This overrides a value the user set. It is done because the value
breaks every request it touches: the models Cline sends through
Vercel's AI Gateway can only be pinned with providerOptions, and that
field is refused on each request. The saved pinUpstream is left as
set, so if Cline takes the field again the pin can come back without
asking anyone to tick it again.
Changed:
- provider.ClinePin pins only the OpenRouter entry (glm-5.3-flash,
provider.only ["z-ai"], which Cline still accepts); DeepSeek and the
other GLM models get "". The Cline plugin's DeepSeek skip and
ClinePassHas/clinePassDeepSeek are gone.
- gateway clinePin writes only top-level provider.only, never
providerOptions. A body's own provider/providerOptions goes as sent.
- provider.ClinePassAsked is what magpie actually wrote (ClinePin). It
no longer claims "deepseek" for the Cline plugin's DeepSeek models:
opencode-cline-auth 0.1.13 pins nothing by default, and a pin it
writes is refused, so no reply is served on it.
- GUI: the Upstream note says Cline refuses the pin since 11-06 and
only glm-5.3-flash still asks Z.ai (en, zh, zh-TW, ja, de). The
Routing page's "tick … to ask for the maker's own API" is gone.
Run on mote at this tree on origin/main a1774d123, HOME=$(mktemp -d):
- go test ./internal/provider -run Cline, ./internal/gateway -run
Cline: ok. go test ./internal/gui -run 'Budget|I18n|Script': ok.
- GOOS=linux go vet provider, gateway, testenv; GOOS=windows go vet
those and internal/gui: ok. gofmt -l: nothing.
- GUI, Chromium and WebKit, node --test (concurrency 6): every
Cline file (clinepass-pin, routing-cline-route and 15 more naming
Cline), all routing-* files, i18n-keys, i18n-en-no-cjk, gui-zh-tw,
gui-ja, gui-de: 2878 tests, 20 red in 7 routing-* files. Run alone
and serially, routing-idle-frame passed; the other 6 files had the
same 19 reds on a fresh origin/main 325dc3ab3 copy (#5475, #5586).
- Broken by hand: origin/main's cline.go and cline_pin.go with the new
tests, red: TestClinePassAsked, TestClinePassTryKeepsWhatWasAsked,
TestClineTickSendsNoProviderOptions,
TestClinePluginTickSendsNoProviderOptions.
- Rebased on 325dc3ab3, again on mote: go test provider and gateway
-run Cline, gui -run 'Budget|I18n|Script': ok; clinepass-pin and
routing-cline-route: ok; i18n-keys "a plugin's words are its own"
red for three words none of this touches, red the same on a
325dc3ab3 copy (#5332, #5426, #5482).
Not tried: a live Cline request (no Cline account here), glm-5.3-flash
actually served by Z.ai (the #819 author's checks say Cline ignores
provider.only there), GOOS=linux vet of internal/gui on mote (Wails
needs cgo).
Reported-by: kvjxhjwentnwm
This commit is contained in:
@@ -11,18 +11,30 @@ import (
|
||||
)
|
||||
|
||||
// A ClinePass reply that names a route of its own (vmc/…-contributor-
|
||||
// fallbacks) and no provider still leaves its try saying what was asked
|
||||
// for, so the Routing page can tell "DeepSeek asked for, not said who
|
||||
// answered" from "nothing asked for" (zRain on Discord, 10-24): DeepSeek
|
||||
// with the Upstream tick, nothing without it, on a Chat client's path and
|
||||
// fallbacks) and no provider leaves its try saying what was asked for, so
|
||||
// the Routing page can tell "asked for, not said who answered" from
|
||||
// "nothing asked for" (zRain on Discord, 10-24). Since 2026-11-06 Cline
|
||||
// refuses providerOptions (#5442), so a DeepSeek request asks for nothing
|
||||
// with the Upstream tick or without it, and the try doesn't say it asked
|
||||
// DeepSeek; glm-5.3-flash, pinned by OpenRouter's provider.only, which
|
||||
// Cline still takes, says z-ai with the tick. On a Chat client's path and
|
||||
// on the Responses one Codex takes.
|
||||
func TestClinePassTryKeepsWhatWasAsked(t *testing.T) {
|
||||
for _, path := range []string{"/v1/chat/completions", "/v1/responses"} {
|
||||
for _, tick := range []bool{false, true} {
|
||||
name := path + "/tick-off"
|
||||
want := ""
|
||||
for _, c := range []struct {
|
||||
model string
|
||||
tick bool
|
||||
want string
|
||||
}{
|
||||
{"cline-pass/deepseek-v4.1-flash-1017", false, ""},
|
||||
{"cline-pass/deepseek-v4.1-flash-1017", true, ""},
|
||||
{"cline-pass/glm-5.3-flash", false, ""},
|
||||
{"cline-pass/glm-5.3-flash", true, "z-ai"},
|
||||
} {
|
||||
model, tick, want := c.model, c.tick, c.want
|
||||
name := path + "/" + model + "/tick-off"
|
||||
if tick {
|
||||
name, want = path+"/tick-on", "deepseek"
|
||||
name = path + "/" + model + "/tick-on"
|
||||
}
|
||||
t.Run(name, func(t *testing.T) {
|
||||
fresh(t)
|
||||
@@ -37,13 +49,13 @@ func TestClinePassTryKeepsWhatWasAsked(t *testing.T) {
|
||||
}))
|
||||
t.Cleanup(up.Close)
|
||||
p := provider.Provider{ID: "clinepass", Name: "ClinePass", Preset: "clinepass", Key: "k", Chat: up.URL + "/v1",
|
||||
Models: []string{"cline-pass/deepseek-v4.1-flash-1017"}, PinUpstream: tick}
|
||||
Models: []string{model}, PinUpstream: tick}
|
||||
if err := provider.Save(p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body := `{"model":"clinepass/cline-pass/deepseek-v4.1-flash-1017","max_tokens":100,"stream":true,"messages":[{"role":"user","content":"hi"}]}`
|
||||
body := `{"model":"clinepass/` + model + `","max_tokens":100,"stream":true,"messages":[{"role":"user","content":"hi"}]}`
|
||||
if path == "/v1/responses" {
|
||||
body = `{"model":"clinepass/cline-pass/deepseek-v4.1-flash-1017","stream":true,"input":"hi"}`
|
||||
body = `{"model":"clinepass/` + model + `","stream":true,"input":"hi"}`
|
||||
}
|
||||
s := New()
|
||||
rec := httptest.NewRecorder()
|
||||
@@ -51,8 +63,11 @@ func TestClinePassTryKeepsWhatWasAsked(t *testing.T) {
|
||||
if rec.Code != 200 {
|
||||
t.Fatalf("%d %s", rec.Code, rec.Body)
|
||||
}
|
||||
if pinned := strings.Contains(sent, `"only":["deepseek"]`); pinned != tick {
|
||||
t.Errorf("pin sent %v with the tick %v: %s", pinned, tick, sent)
|
||||
if strings.Contains(sent, `providerOptions`) {
|
||||
t.Errorf("providerOptions sent with the tick %v: %s", tick, sent)
|
||||
}
|
||||
if pinned := strings.Contains(sent, `"provider":{"only":["z-ai"]}`); pinned != (want != "") {
|
||||
t.Errorf("provider.only sent %v, want %v: %s", pinned, want != "", sent)
|
||||
}
|
||||
r := lastRoute(s)
|
||||
if len(r.Tries) != 1 {
|
||||
|
||||
@@ -8,24 +8,21 @@ import (
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// clinePin is body with its DeepSeek or GLM model pinned to its maker's
|
||||
// own API (DeepSeek's, Z.ai's) on the Cline API, when the provider asks it
|
||||
// (provider.PinUpstream). A model Cline sends through Vercel's AI Gateway
|
||||
// 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 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.
|
||||
// clinePin is body with its model pinned to its maker's own API on the
|
||||
// Cline API, when the provider asks it (provider.PinUpstream) and Cline
|
||||
// still takes the pin (provider.ClinePin): glm-5.3-flash, which Cline
|
||||
// sends through OpenRouter, gets OpenRouter's own provider.only
|
||||
// (sdytman on Discord). providerOptions, the field that pinned a model
|
||||
// Cline sends through Vercel's AI Gateway, is never written: Cline
|
||||
// answers it with 403 since 2026-11-06 (#5442). 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.
|
||||
func clinePin(p provider.Provider, to provider.Protocol, body []byte) []byte {
|
||||
if to != provider.Chat {
|
||||
return body
|
||||
}
|
||||
up, openRouter := p.ClinePin(gjson.GetBytes(body, "model").String())
|
||||
if up == "" || gjson.GetBytes(body, "providerOptions").Exists() || gjson.GetBytes(body, "provider").Exists() {
|
||||
if up == "" || !openRouter || gjson.GetBytes(body, "providerOptions").Exists() || gjson.GetBytes(body, "provider").Exists() {
|
||||
return body
|
||||
}
|
||||
end := bytes.LastIndexByte(body, '}')
|
||||
@@ -33,38 +30,13 @@ func clinePin(p provider.Provider, to provider.Protocol, body []byte) []byte {
|
||||
if end < 0 || start < 0 || start > end {
|
||||
return body
|
||||
}
|
||||
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}}
|
||||
}
|
||||
val, _ := json.Marshal(opts)
|
||||
val, _ := json.Marshal(map[string]any{"only": []string{up}})
|
||||
out := make([]byte, 0, len(body)+len(val)+24)
|
||||
out = append(out, body[:end]...)
|
||||
if len(bytes.TrimSpace(body[start+1:end])) > 0 {
|
||||
out = append(out, ',')
|
||||
}
|
||||
out = append(out, '"')
|
||||
out = append(out, key...)
|
||||
out = append(out, `":`...)
|
||||
out = append(out, `"provider":`...)
|
||||
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
|
||||
getIn(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
|
||||
}
|
||||
|
||||
@@ -11,19 +11,18 @@ import (
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// ClinePass's DeepSeek models are served by DeepSeek's own API alone when
|
||||
// the provider pins them (White Immortal on Discord, as ClinePass +
|
||||
// ProviderPin does): each request for one carries
|
||||
// providerOptions.gateway.only ["deepseek"], on Chat and when an Anthropic
|
||||
// or Responses request is built into one. Its GLM models are pinned to
|
||||
// Z.ai's the same way, ["zai"] (sdytman on Discord). glm-5.3-flash, which
|
||||
// Cline sends through OpenRouter, not Vercel's gateway, is pinned by
|
||||
// OpenRouter's top-level provider.only ["z-ai"] instead, while
|
||||
// deepseek-v4.1-flash and its -1017 stay on providerOptions (sdytman,
|
||||
// 10-20). Its other makers' models, Cline's free ones, a provider that
|
||||
// doesn't pin, and a body naming provider or providerOptions itself go as
|
||||
// they were.
|
||||
func TestClinePinsDeepSeekAndGLM(t *testing.T) {
|
||||
// The Upstream tick no longer writes providerOptions to the Cline API:
|
||||
// since 2026-11-06 Cline answers a request carrying it with 403
|
||||
// "client-supplied \"providerOptions\" model routing is not supported"
|
||||
// (#5442, kvjxhjwentnwm and HK-bruc1: the same request and key, 403 with
|
||||
// the field and 200 without). With the tick on, a ClinePass DeepSeek or
|
||||
// GLM request goes as sent, on Chat and when an Anthropic or Responses
|
||||
// request is built into one. glm-5.3-flash, which Cline sends through
|
||||
// OpenRouter, keeps OpenRouter's top-level provider.only ["z-ai"], which
|
||||
// Cline still takes (sdytman, 10-20). Its other makers' models, Cline's
|
||||
// free ones, a provider that doesn't pin, and a body naming provider or
|
||||
// providerOptions itself go as they were.
|
||||
func TestClineTickSendsNoProviderOptions(t *testing.T) {
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||||
cline, err := provider.FromPreset("clinepass")
|
||||
@@ -31,7 +30,7 @@ func TestClinePinsDeepSeekAndGLM(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cline.ID, cline.Key, cline.PinUpstream = "cline", "clp_key", true
|
||||
cline.Models = []string{"cline-pass/deepseek-v4-pro", "cline-pass/glm-5.3", "cline-pass/glm-5.3-flash", "cline-pass/deepseek-v4.1-flash", "cline-pass/deepseek-v4.1-flash-1017", "cline-pass/kimi-k3", "cline-pass/qwen3.8-max", "cline-free/deepseek-v4.1-flash", "cline-free/glm-5.3-flash"}
|
||||
cline.Models = []string{"deepseek/deepseek-v4-pro", "zai/glm-5.3", "cline-pass/deepseek-v4-pro", "cline-pass/glm-5.3", "cline-pass/glm-5.3-flash", "cline-pass/deepseek-v4.1-flash", "cline-pass/deepseek-v4.1-flash-1017", "cline-pass/kimi-k3", "cline-pass/qwen3.8-max", "cline-free/deepseek-v4.1-flash", "cline-free/glm-5.3-flash"}
|
||||
plain := cline
|
||||
plain.ID, plain.Name, plain.PinUpstream = "cline2", "ClinePass 2", false
|
||||
for _, p := range []provider.Provider{cline, plain} {
|
||||
@@ -65,32 +64,22 @@ 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+`}`)
|
||||
}
|
||||
// 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)
|
||||
// ClinePass's and the usage-billed models alike
|
||||
for _, m := range []string{"cline/deepseek/deepseek-v4-pro", "cline/zai/glm-5.3", "cline/cline-pass/deepseek-v4-pro", "cline/cline-pass/deepseek-v4.1-flash", "cline/cline-pass/deepseek-v4.1-flash-1017", "cline/cline-pass/glm-5.3"} {
|
||||
if got := chat(m, ""); got != "" || orPin() != "" {
|
||||
t.Errorf("%s with the tick: providerOptions %s provider %s, want neither (sent %s)", m, got, orPin(), 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":"What is this?"},{"type":"image_url","image_url":{"url":"data:image/png;base64,iVBORw0KGgo="}}]}]}`); got != "" {
|
||||
t.Errorf("an image: providerOptions %s, want none", got)
|
||||
}
|
||||
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)
|
||||
}
|
||||
if got := ask("/v1/responses", `{"model":"cline/cline-pass/deepseek-v4-pro","input":"Say pong","stream":false}`); got != pinned {
|
||||
t.Errorf("responses: providerOptions %s, want %s", got, pinned)
|
||||
}
|
||||
const zai = `{"gateway":{"only":["zai"]}}`
|
||||
if got := chat("cline/cline-pass/glm-5.3", ""); got != zai || orPin() != "" {
|
||||
t.Errorf("glm-5.3: providerOptions %s provider %s, want providerOptions %s alone (sent %s)", got, orPin(), zai, sent)
|
||||
for _, m := range []string{"cline/cline-pass/deepseek-v4-pro", "cline/cline-pass/glm-5.3"} {
|
||||
if got := ask("/v1/messages", `{"model":"`+m+`","max_tokens":64,"messages":[{"role":"user","content":"Say pong"}]}`); got != "" || orPin() != "" {
|
||||
t.Errorf("messages, %s: providerOptions %s provider %s, want neither", m, got, orPin())
|
||||
}
|
||||
if got := ask("/v1/responses", `{"model":"`+m+`","input":"Say pong","stream":false}`); got != "" || orPin() != "" {
|
||||
t.Errorf("responses, %s: providerOptions %s provider %s, want neither", m, got, orPin())
|
||||
}
|
||||
}
|
||||
const zaiOR = `{"only":["z-ai"]}`
|
||||
const flash = `{"model":"cline-pass/glm-5.3-flash","messages":[{"role":"user","content":"Say pong"}]`
|
||||
@@ -104,9 +93,6 @@ func TestClinePinsDeepSeekAndGLM(t *testing.T) {
|
||||
if ask("/v1/messages", `{"model":"cline/cline-pass/glm-5.3-flash","max_tokens":64,"messages":[{"role":"user","content":"Say pong"}]}`); orPin() != zaiOR {
|
||||
t.Errorf("messages, glm-5.3-flash: provider %s, want %s (sent %s)", orPin(), zaiOR, sent)
|
||||
}
|
||||
if got := ask("/v1/messages", `{"model":"cline/cline-pass/glm-5.3","max_tokens":64,"messages":[{"role":"user","content":"Say pong"}]}`); got != zai {
|
||||
t.Errorf("messages, GLM: providerOptions %s, want %s", got, zai)
|
||||
}
|
||||
for _, m := range []string{"cline/cline-pass/kimi-k3", "cline/cline-pass/qwen3.8-max", "cline/cline-free/deepseek-v4.1-flash", "cline/cline-free/glm-5.3-flash", "cline2/cline-pass/deepseek-v4-pro", "cline2/cline-pass/glm-5.3"} {
|
||||
if got := chat(m, ""); got != "" || orPin() != "" {
|
||||
t.Errorf("%s: providerOptions %s provider %s, want none", m, got, orPin())
|
||||
|
||||
@@ -11,12 +11,12 @@ import (
|
||||
)
|
||||
|
||||
// The Cline plugin's provider has ClinePass's Upstream tick too (ARNO on
|
||||
// Discord): saved on it, a DeepSeek model's request reaches the plugin
|
||||
// pinned to DeepSeek's own API and a GLM model's to Z.ai's (sdytman on
|
||||
// Discord), on Chat and Anthropic Messages alike, glm-5.3-flash by
|
||||
// OpenRouter's provider.only since Cline sends it there, and its other
|
||||
// models' requests go as sent.
|
||||
func TestClinePluginPinsDeepSeekAndGLM(t *testing.T) {
|
||||
// Discord). Since 2026-11-06 Cline answers providerOptions with 403
|
||||
// (#5442), so with the tick saved on, a DeepSeek or GLM model's request
|
||||
// reaches the plugin as sent, on Chat and Anthropic Messages alike, and
|
||||
// only glm-5.3-flash carries OpenRouter's provider.only, which Cline
|
||||
// still takes; its other models' requests go as sent too.
|
||||
func TestClinePluginTickSendsNoProviderOptions(t *testing.T) {
|
||||
t.Setenv("FAKE_DEEPSEEK", "1")
|
||||
t.Setenv("FAKE_GLM", "1")
|
||||
var mu sync.Mutex
|
||||
@@ -106,30 +106,15 @@ 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"} {
|
||||
for _, m := range []string{"deepseek-v4-pro", "glm-5.3", "cline-pass/deepseek-v4-pro", "cline-pass/deepseek-v4.1-flash-1017", "cline-pass/glm-5.3"} {
|
||||
if up, _ := p.ClinePin(m); up != "" {
|
||||
t.Errorf("%s: magpie pinned it to %q ahead of the plugin", m, up)
|
||||
t.Errorf("%s: pinned to %q, which only providerOptions could say", 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"]}}`
|
||||
if i >= 2 {
|
||||
want = `{"gateway":{"only":["zai"]}}`
|
||||
}
|
||||
po, _ := json.Marshal(q["providerOptions"])
|
||||
if string(po) != want {
|
||||
t.Fatalf("request %d reached the plugin with providerOptions %s, want %s", i, po, want)
|
||||
if q["providerOptions"] != nil || q["provider"] != nil {
|
||||
t.Fatalf("request %d reached the plugin with providerOptions %v provider %v, want neither", i, q["providerOptions"], q["provider"])
|
||||
}
|
||||
}
|
||||
if got[4]["providerOptions"] != nil || got[4]["provider"] != nil {
|
||||
|
||||
@@ -9426,12 +9426,13 @@ function drawEditor(p, presetID) {
|
||||
ed.append(...field("Base URL", urlWrap));
|
||||
}
|
||||
|
||||
// Cline's DeepSeek and GLM models pinned to their makers' APIs (sdytman, ARNO on Discord)
|
||||
// Cline's DeepSeek and GLM models pinned to their makers' APIs (sdytman, ARNO on Discord);
|
||||
// since 11-06 Cline refuses the pin for all but glm-5.3-flash (#5442), as the note says
|
||||
const upstreamField = () => {
|
||||
const [ptk, pcb] = tick(t("DeepSeek and GLM models only from their makers' own APIs"), !!draft.pinUpstream);
|
||||
ptk.classList.add("pin-upstream");
|
||||
pcb.onchange = () => { draft.pinUpstream = pcb.checked; };
|
||||
return field(t("Upstream"), ptk, t("Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek and one for a GLM model only to Z.ai, which keeps its prompt cache, and fails when that API can't take it"));
|
||||
return field(t("Upstream"), ptk, t("Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai"));
|
||||
};
|
||||
|
||||
// the settings few need, under Advanced: open when one is set, or as left here
|
||||
|
||||
@@ -4078,7 +4078,7 @@ const I18N = {
|
||||
"For a plan that serves only the coding agents it names: each request goes with the User-Agent the agent sent (pi, OpenCode, Claude Code…), not magpie's. Requests magpie makes itself, and ones the agent sent without one, still go as magpie. A User-Agent set in Headers above always wins.": "给只允许指定编程 Agent 使用的套餐:每个请求带上 Agent 自己发来的 User-Agent(pi、OpenCode、Claude Code…),而不是 magpie 的。magpie 自己发出的请求,以及 Agent 没带 User-Agent 的请求,仍以 magpie 的身份发送。上面请求头里设置的 User-Agent 始终优先。",
|
||||
"DeepSeek and GLM models only from their makers' own APIs": "DeepSeek、GLM 模型只走各自官方上游",
|
||||
"Upstream": "上游",
|
||||
"Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek and one for a GLM model only to Z.ai, which keeps its prompt cache, and fails when that API can't take it": "Cline 的网关会把一个模型发给它挑的任意上游;钉住后,DeepSeek 模型的请求只发给 DeepSeek 官方,GLM 模型的只发给 Z.ai 官方,缓存能命中;官方接不了时请求会失败,不会换别家",
|
||||
"Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai": "自 2026-11-06 起,Cline 对钉住上游的 DeepSeek、GLM 请求一律回 403,所以 magpie 不再钉住它们,由 Cline 自己挑上游;只有 glm-5.3-flash 仍指定 Z.ai",
|
||||
"For a relay in front of Anthropic's or OpenAI's own API: Claude Code's WebSearch and Codex's web_search go to it as they were sent, not through magpie's search. magpie doesn't automatically search with it for other models, but you can name it as the searcher.": "用于 Anthropic 或 OpenAI 官方 API 前的中转:Claude Code 的 WebSearch 和 Codex 的 web_search 原样发给它,不经 magpie 搜索。不会自动用它为其他模型搜索,但可手动选为代搜供应商。",
|
||||
"Its models leave the list agents pick from; the routing groups they are in still use them": "它的模型不出现在 Agent 的可选列表里;所在的路由分组仍会使用它们",
|
||||
"Picked: the routing groups it is in use it. Agents don't see it.": "已选:它所在的路由分组会用到。Agent 看不到它。",
|
||||
@@ -8720,7 +8720,7 @@ const I18N = {
|
||||
"For a plan that serves only the coding agents it names: each request goes with the User-Agent the agent sent (pi, OpenCode, Claude Code…), not magpie's. Requests magpie makes itself, and ones the agent sent without one, still go as magpie. A User-Agent set in Headers above always wins.": "給只允許指定程式設計 Agent 使用的方案:每個請求帶上 Agent 自己送來的 User-Agent(pi、OpenCode、Claude Code…),而不是 magpie 的。magpie 自己發出的請求,以及 Agent 沒帶 User-Agent 的請求,仍以 magpie 的身分傳送。上面請求頭裡設定的 User-Agent 永遠優先。",
|
||||
"DeepSeek and GLM models only from their makers' own APIs": "DeepSeek、GLM 模型只走各自官方上游",
|
||||
"Upstream": "上游",
|
||||
"Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek and one for a GLM model only to Z.ai, which keeps its prompt cache, and fails when that API can't take it": "Cline 的閘道會把一個模型發給它挑的任意上游;釘住後,DeepSeek 模型的請求只發給 DeepSeek 官方,GLM 模型的只發給 Z.ai 官方,快取能命中;官方接不了時請求會失敗,不會換別家",
|
||||
"Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai": "自 2026-11-06 起,Cline 對釘住上游的 DeepSeek、GLM 請求一律回 403,所以 magpie 不再釘住它們,由 Cline 自己挑上游;只有 glm-5.3-flash 仍指定 Z.ai",
|
||||
"For a relay in front of Anthropic's or OpenAI's own API: Claude Code's WebSearch and Codex's web_search go to it as they were sent, not through magpie's search. magpie doesn't automatically search with it for other models, but you can name it as the searcher.": "用於 Anthropic 或 OpenAI 官方 API 前的中轉:Claude Code 的 WebSearch 和 Codex 的 web_search 原樣發給它,不經 magpie 搜尋。不會自動用它為其他模型搜尋,但可手動選為代搜供應商。",
|
||||
"Its models leave the list agents pick from; the routing groups they are in still use them": "它的模型不出現在 Agent 的可選列表裡;所在的路由分組仍會使用它們",
|
||||
"Picked: the routing groups it is in use it. Agents don't see it.": "已選:它所在的路由分組會用到。Agent 看不到它。",
|
||||
@@ -13378,7 +13378,7 @@ const I18N = {
|
||||
"For a plan that serves only the coding agents it names: each request goes with the User-Agent the agent sent (pi, OpenCode, Claude Code…), not magpie's. Requests magpie makes itself, and ones the agent sent without one, still go as magpie. A User-Agent set in Headers above always wins.": "指定したコーディングエージェントだけが使えるプラン向け:各リクエストは magpie のものではなく、エージェントが送ってきた User-Agent(pi、OpenCode、Claude Code…)で送られます。magpie 自身のリクエストと、エージェントが User-Agent を付けなかったリクエストは、引き続き magpie として送られます。上のヘッダーで設定した User-Agent が常に優先されます。",
|
||||
"DeepSeek and GLM models only from their makers' own APIs": "DeepSeek・GLM モデルはそれぞれの公式 API のみ",
|
||||
"Upstream": "上流",
|
||||
"Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek and one for a GLM model only to Z.ai, which keeps its prompt cache, and fails when that API can't take it": "Cline のゲートウェイはモデルを任意の上流に送ります。固定すると DeepSeek モデルへのリクエストは DeepSeek 公式だけに、GLM モデルへのリクエストは Z.ai 公式だけに送られ、プロンプトキャッシュが効きます。公式が受けられないときは失敗します",
|
||||
"Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai": "2026-11-06 以降、Cline は上流を固定した DeepSeek・GLM のリクエストを 403 で拒否するため、magpie は固定せずに送り、上流は Cline が選びます。Z.ai を指定するのは glm-5.3-flash だけです",
|
||||
"For a relay in front of Anthropic's or OpenAI's own API: Claude Code's WebSearch and Codex's web_search go to it as they were sent, not through magpie's search. magpie doesn't automatically search with it for other models, but you can name it as the searcher.": "Anthropic または OpenAI 公式 API の前段にあるリレー向け:Claude Code の WebSearch と Codex の web_search は magpie の検索を通さず、送られたままこのプロバイダに届きます。magpie は他のモデルのためにこれで自動検索はしませんが、検索役として指定することはできます。",
|
||||
"Its models leave the list agents pick from; the routing groups they are in still use them": "そのモデルはエージェントが選ぶリストから外れます。所属するルーティンググループでは引き続き使われます",
|
||||
"Picked: the routing groups it is in use it. Agents don't see it.": "選択済み:所属するルーティンググループが使います。エージェントには見えません。",
|
||||
@@ -18051,7 +18051,7 @@ const I18N = {
|
||||
"For a plan that serves only the coding agents it names: each request goes with the User-Agent the agent sent (pi, OpenCode, Claude Code…), not magpie's. Requests magpie makes itself, and ones the agent sent without one, still go as magpie. A User-Agent set in Headers above always wins.": "Für einen Tarif, der nur die genannten Coding-Agenten zulässt: Jede Anfrage geht mit dem User-Agent, den der Agent gesendet hat (pi, OpenCode, Claude Code…), nicht mit dem von magpie. Anfragen, die magpie selbst stellt, und solche, die der Agent ohne einen gesendet hat, gehen weiter als magpie. Ein oben unter Header gesetzter User-Agent hat immer Vorrang.",
|
||||
"DeepSeek and GLM models only from their makers' own APIs": "DeepSeek- und GLM-Modelle nur über die eigene API ihres Herstellers",
|
||||
"Upstream": "Upstream",
|
||||
"Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek and one for a GLM model only to Z.ai, which keeps its prompt cache, and fails when that API can't take it": "Cline lässt ein Modell von einem beliebigen Anbieter seines Gateways bedienen; angeheftet geht eine Anfrage an ein DeepSeek-Modell nur an DeepSeek und eine an ein GLM-Modell nur an Z.ai, das jeweils seinen Prompt-Cache behält, und schlägt fehl, wenn dieser Anbieter sie nicht annimmt",
|
||||
"Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai": "Seit 2026-11-06 lehnt Cline eine angeheftete DeepSeek- oder GLM-Anfrage mit 403 ab, daher sendet magpie sie ohne Anheftung und Cline wählt den Anbieter; nur glm-5.3-flash fragt weiter Z.ai an",
|
||||
"For a relay in front of Anthropic's or OpenAI's own API: Claude Code's WebSearch and Codex's web_search go to it as they were sent, not through magpie's search. magpie doesn't automatically search with it for other models, but you can name it as the searcher.": "Für ein Relay vor der eigenen API von Anthropic oder OpenAI: WebSearch von Claude Code und web_search von Codex gehen unverändert dorthin, nicht über die Suche von magpie. magpie sucht damit nicht automatisch für andere Modelle, aber Sie können es als Suchdienst festlegen.",
|
||||
"Its models leave the list agents pick from; the routing groups they are in still use them": "Seine Modelle verschwinden aus der Auswahlliste der Agenten; die Weiterleitungsgruppen, in denen sie sind, nutzen sie weiterhin",
|
||||
"Picked: the routing groups it is in use it. Agents don't see it.": "Ausgewählt: Die Weiterleitungsgruppen, in denen es ist, nutzen es. Agenten sehen es nicht.",
|
||||
|
||||
@@ -3476,8 +3476,8 @@ function routingPage(part) {
|
||||
if (tr.upstream) return s + " " + t("Its reply says {upstream} answered.", { upstream: tr.upstream });
|
||||
if (o.pinUnknown) return s + " " + t("Its reply didn't say which provider answered.");
|
||||
if (tr.pin) return s + " " + t("{pin} was asked for, but its reply didn't say which provider answered, so whether ClinePass kept to it is unknown.", { pin: tr.pin });
|
||||
const tick = /(^|\/)cline-pass\/(deepseek|glm)/i.test(tr.model) ? " " + t("To ask for the maker's own API, tick “{tick}” in the provider's settings.", { tick: t("DeepSeek and GLM models only from their makers' own APIs") }) : "";
|
||||
return s + " " + t("No provider was asked for, and its reply didn't say which one answered.") + tick;
|
||||
// no tick to point to: since 11-06 Cline refuses the pin it wrote (#5442)
|
||||
return s + " " + t("No provider was asked for, and its reply didn't say which one answered.");
|
||||
}
|
||||
window.swapWhy = swapWhy; // the Usage page's Requests say it too
|
||||
// a try that asked a remote magpie for one of its routing groups: the
|
||||
|
||||
@@ -655,7 +655,6 @@ magpie.strings({
|
||||
"Its reply says {upstream} answered.": "回复说是 {upstream} 作答。",
|
||||
"Its reply didn't say which provider answered.": "回复没有说是哪家上游作答。",
|
||||
"{pin} was asked for, but its reply didn't say which provider answered, so whether ClinePass kept to it is unknown.": "请求时指定了 {pin},但回复没有说是哪家上游作答,所以无法确定 ClinePass 是否照做。",
|
||||
"To ask for the maker's own API, tick “{tick}” in the provider's settings.": "要指定模型厂商的官方 API,请在该服务商设置里勾选“{tick}”。",
|
||||
"No provider was asked for, and its reply didn't say which one answered.": "请求时没有指定上游,回复也没有说是哪家作答。",
|
||||
"{h} h {m} min": "{h} 小时 {m} 分钟",
|
||||
"magpie saved a report of where it held this request. If it keeps happening, send the report with yours.": "magpie 保存了一份报告,记下这个请求卡在了哪里。如果反复出现,请把这份报告附在你的反馈里。",
|
||||
@@ -1324,7 +1323,6 @@ magpie.strings({
|
||||
"Its reply says {upstream} answered.": "回覆說是 {upstream} 作答。",
|
||||
"Its reply didn't say which provider answered.": "回覆沒有說是哪家上游作答。",
|
||||
"{pin} was asked for, but its reply didn't say which provider answered, so whether ClinePass kept to it is unknown.": "請求時指定了 {pin},但回覆沒有說是哪家上游作答,所以無法確定 ClinePass 是否照做。",
|
||||
"To ask for the maker's own API, tick “{tick}” in the provider's settings.": "要指定模型廠商的官方 API,請在該服務商設定裡勾選「{tick}」。",
|
||||
"No provider was asked for, and its reply didn't say which one answered.": "請求時沒有指定上游,回覆也沒有說是哪家作答。",
|
||||
"{h} h {m} min": "{h} 小時 {m} 分鐘",
|
||||
"magpie saved a report of where it held this request. If it keeps happening, send the report with yours.": "magpie 儲存了一份報告,記下這個請求卡在了哪裡。如果反覆出現,請把這份報告附在你的回報裡。",
|
||||
@@ -1991,7 +1989,6 @@ magpie.strings({
|
||||
"Its reply says {upstream} answered.": "応答では {upstream} が答えたとあります。",
|
||||
"Its reply didn't say which provider answered.": "応答にはどのプロバイダーが答えたか書かれていません。",
|
||||
"{pin} was asked for, but its reply didn't say which provider answered, so whether ClinePass kept to it is unknown.": "{pin} を指定しましたが、応答にはどのプロバイダーが答えたか書かれておらず、ClinePass がそれに従ったかは分かりません。",
|
||||
"To ask for the maker's own API, tick “{tick}” in the provider's settings.": "モデル提供元の公式 API を指定するには、プロバイダーの設定で「{tick}」をオンにしてください。",
|
||||
"No provider was asked for, and its reply didn't say which one answered.": "プロバイダーは指定されておらず、応答にもどこが答えたか書かれていません。",
|
||||
"{h} h {m} min": "{h} 時間 {m} 分",
|
||||
"This routing group will no longer be available to agents.": "このルーティンググループはエージェントから利用できなくなります。",
|
||||
@@ -2660,7 +2657,6 @@ magpie.strings({
|
||||
"Its reply says {upstream} answered.": "Laut Antwort hat {upstream} geantwortet.",
|
||||
"Its reply didn't say which provider answered.": "Die Antwort sagt nicht, welcher Anbieter geantwortet hat.",
|
||||
"{pin} was asked for, but its reply didn't say which provider answered, so whether ClinePass kept to it is unknown.": "{pin} wurde angefragt, aber die Antwort sagt nicht, welcher Anbieter geantwortet hat; ob ClinePass sich daran gehalten hat, ist unbekannt.",
|
||||
"To ask for the maker's own API, tick “{tick}” in the provider's settings.": "Um die eigene API des Herstellers anzufragen, aktiviere „{tick}“ in den Einstellungen des Anbieters.",
|
||||
"No provider was asked for, and its reply didn't say which one answered.": "Es wurde kein Anbieter angefragt, und die Antwort sagt nicht, wer geantwortet hat.",
|
||||
"{h} h {m} min": "{h} h {m} min",
|
||||
"This routing group will no longer be available to agents.": "Diese Weiterleitungsgruppe steht Agenten nicht mehr zur Verfügung.",
|
||||
|
||||
@@ -72,9 +72,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
await page.goto("http://magpie.test/?view=providers");
|
||||
const zh = await page.evaluate(() => [
|
||||
"DeepSeek and GLM models only from their makers' own APIs", "Upstream",
|
||||
"Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek and one for a GLM model only to Z.ai, which keeps its prompt cache, and fails when that API can't take it",
|
||||
"Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai",
|
||||
].map((k) => I18N.zh[k]));
|
||||
assert(zh.every(Boolean), "every string has its Chinese");
|
||||
for (const l of ["zh-TW", "ja", "de"]) {
|
||||
const has = await page.evaluate(([l, k]) => !!I18N[l][k], [l, "Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai"]);
|
||||
assert(has, `the Upstream note has its ${l}`);
|
||||
}
|
||||
if (lang === "zh") w.tick = zh[0];
|
||||
|
||||
await page.locator(".row.provider", { hasText: "ClinePass" }).click();
|
||||
@@ -84,6 +88,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
await tick.waitFor();
|
||||
assert.equal((await tick.textContent()).trim(), w.tick);
|
||||
assert.equal(await tick.locator("input").isChecked(), false, "not pinned as saved");
|
||||
// the note says what the tick does since Cline refused providerOptions (#5442)
|
||||
const note = await tick.locator("input").evaluate((i) => (i.getAttribute("aria-describedby") || "").split(" ").map((id) => document.getElementById(id)?.textContent).filter(Boolean).join(" "));
|
||||
assert.equal(note, lang === "zh" ? zh[2] : "Since 2026-11-06 Cline refuses a pinned DeepSeek or GLM request with 403, so magpie sends them unpinned and Cline picks the host; only glm-5.3-flash still asks Z.ai");
|
||||
await tick.locator("input").check();
|
||||
const n = posts.length;
|
||||
await page.locator(".editor .bar").getByRole("button", { name: w.save, exact: true }).click();
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
// (zRain on Discord, 10-24): its tag says "ClinePass route …", not
|
||||
// "served …", and its title and story say it is the route's name, not
|
||||
// another model, and whether DeepSeek was asked for: asked and not said
|
||||
// who answered, or nothing asked and the tick that asks. Another vendor's
|
||||
// who answered, or nothing asked (with no tick to point to: since 11-06
|
||||
// Cline refuses the pin, #5442). Another vendor's
|
||||
// swap still reads as one. The Usage page's Requests say the route too.
|
||||
// English and Chinese; the API is faked. MAGPIE_ROUTE_ASSETS points at an
|
||||
// older asset folder to watch it fail.
|
||||
@@ -75,7 +76,7 @@ const want = {
|
||||
tags: ["ClinePass route " + VMC, "ClinePass route " + VMC, "served gpt-4o-mini"],
|
||||
route: /a route it picks itself: the name is the route's, not another model's/,
|
||||
asked: /deepseek was asked for, but its reply didn't say which provider answered/,
|
||||
none: /No provider was asked for.*tick “DeepSeek and GLM models only from their makers' own APIs”/,
|
||||
none: /No provider was asked for, and its reply didn't say which one answered\./,
|
||||
swap: /likely another model/,
|
||||
usage: /didn't say which provider answered\.$/,
|
||||
},
|
||||
@@ -83,7 +84,7 @@ const want = {
|
||||
tags: ["ClinePass 路由 " + VMC, "ClinePass 路由 " + VMC, "实际 gpt-4o-mini"],
|
||||
route: /这是路由的名字,不是换成了别的模型/,
|
||||
asked: /请求时指定了 deepseek,但回复没有说是哪家上游作答/,
|
||||
none: /请求时没有指定上游.*勾选“DeepSeek、GLM 模型只走各自官方上游”/,
|
||||
none: /请求时没有指定上游,回复也没有说是哪家作答。/,
|
||||
swap: /很可能换成了别的模型/,
|
||||
usage: /回复没有说是哪家上游作答。$/,
|
||||
},
|
||||
@@ -122,6 +123,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.match(tags[0][1], w.asked);
|
||||
assert.match(tags[1][1], w.route);
|
||||
assert.match(tags[1][1], w.none);
|
||||
// the tick no longer pins DeepSeek (#5442), so nothing points to it
|
||||
assert.doesNotMatch(tags[1][1], /tick|勾选/);
|
||||
assert.doesNotMatch(tags[0][1], w.swap);
|
||||
assert.match(tags[2][1], w.swap);
|
||||
const fits = await page.locator(".rt-req .to .swap").evaluateAll((es) => es.map((e) => {
|
||||
@@ -154,7 +157,6 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
"ClinePass answered {sent} through {served}, a route it picks itself: the name is the route's, not another model's.",
|
||||
"Its reply says {upstream} answered.", "Its reply didn't say which provider answered.",
|
||||
"{pin} was asked for, but its reply didn't say which provider answered, so whether ClinePass kept to it is unknown.",
|
||||
"To ask for the maker's own API, tick “{tick}” in the provider's settings.",
|
||||
"No provider was asked for, and its reply didn't say which one answered."].filter((k) => !I18N[l][k]), l);
|
||||
assert.deepEqual(missing, [], `every string has its ${l}`);
|
||||
}
|
||||
|
||||
+29
-59
@@ -184,7 +184,8 @@ func (p Provider) ClinePinnable() bool {
|
||||
// sdytman (#feedback, 10-20) found glm-5.3-flash among them, and
|
||||
// deepseek-v4.1-flash and deepseek-v4.1-flash-1017 going through Vercel.
|
||||
// An exact entry is a model name; the others match a name's start, the
|
||||
// first match winning.
|
||||
// first match winning. Only the OpenRouter entries are pinned now: Cline
|
||||
// refuses providerOptions since 2026-11-06 (ClinePin).
|
||||
var clineMakers = []struct {
|
||||
name string
|
||||
exact bool
|
||||
@@ -197,75 +198,44 @@ var clineMakers = []struct {
|
||||
}
|
||||
|
||||
// ClinePin is the upstream a request for model is pinned to on p
|
||||
// (PinUpstream), and whether Cline sends the model through OpenRouter
|
||||
// (pinned by provider.only) rather than Vercel's AI Gateway (pinned by
|
||||
// providerOptions.gateway.only): "deepseek" for a DeepSeek model of the
|
||||
// Cline API, "zai" for a GLM one, "z-ai" through OpenRouter for
|
||||
// glm-5.3-flash, "" for anything else. Cline's free models are served
|
||||
// where Cline puts them, so they never are.
|
||||
// (PinUpstream), and whether Cline sends the model through OpenRouter:
|
||||
// "z-ai" through OpenRouter for glm-5.3-flash, "" for anything else.
|
||||
// Since 2026-11-06 the Cline API answers a request carrying
|
||||
// providerOptions with 403 "client-supplied \"providerOptions\" model
|
||||
// routing is not supported" (#5442: the same request, the same key, 403
|
||||
// with the field and 200 without), so a model Cline sends through
|
||||
// Vercel's AI Gateway (DeepSeek's, GLM's but glm-5.3-flash), which only
|
||||
// providerOptions.gateway.only could pin, goes unpinned whatever the
|
||||
// tick says: the tick would fail every such request. OpenRouter's
|
||||
// top-level provider.only is still taken, so glm-5.3-flash keeps it.
|
||||
// Cline's free models are served where Cline puts them, so they never
|
||||
// are.
|
||||
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) {
|
||||
return m.upstream, m.openRouter
|
||||
if !m.openRouter {
|
||||
return "", false
|
||||
}
|
||||
return m.upstream, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// ClinePassAsked is the upstream a request for model asks the Cline API
|
||||
// to serve it from on p, "" when it asks for none: ClinePin's, sent with
|
||||
// the Upstream tick, or, on the Cline plugin's provider, DeepSeek for a
|
||||
// ClinePass DeepSeek model, which opencode-cline-auth 0.1.11 pins by
|
||||
// itself unless its pinUpstream option is set off. The Routing page says
|
||||
// it beside a reply that names no provider, so a route ClinePass picked
|
||||
// reads as asked for DeepSeek or not (zRain on Discord, 10-24).
|
||||
// ClinePassAsked is the upstream a request for model asked the Cline
|
||||
// API to serve it from on p, "" when it asked for none: what magpie
|
||||
// wrote into it (ClinePin). The Routing page says it beside a reply that
|
||||
// names no provider, so a route ClinePass picked reads as asked for an
|
||||
// upstream or not (zRain on Discord, 10-24). The Cline plugin's own
|
||||
// pinUpstream option is not counted: 0.1.13 pins nothing without it,
|
||||
// and a pin it writes (0.1.12 by default, or the option on) is
|
||||
// providerOptions, which Cline refuses with a 403, so no reply is ever
|
||||
// served on it.
|
||||
func (p Provider) ClinePassAsked(model string) string {
|
||||
if up, _ := p.ClinePin(model); up != "" {
|
||||
return up
|
||||
}
|
||||
if p.PluginProvider() == "cline" && clinePassDeepSeek(model) {
|
||||
return "deepseek"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 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"}
|
||||
up, _ := p.ClinePin(model)
|
||||
return up
|
||||
}
|
||||
|
||||
@@ -6,17 +6,23 @@ import (
|
||||
"github.com/yetone/magpie/internal/plugin"
|
||||
)
|
||||
|
||||
// ClinePassAsked says what a ClinePass DeepSeek request asks the Cline API
|
||||
// for (zRain on Discord, 10-24): the built-in ClinePass only with the
|
||||
// Upstream tick, the Cline plugin's provider by default (the plugin pins
|
||||
// it itself), and nothing for a model with no maker to pin to.
|
||||
// ClinePassAsked says what a ClinePass request asked the Cline API for
|
||||
// (zRain on Discord, 10-24): what magpie wrote into it, and nothing more.
|
||||
// Since 2026-11-06 Cline refuses providerOptions (#5442), so the Upstream
|
||||
// tick asks for nothing on a DeepSeek or GLM model and only glm-5.3-flash
|
||||
// keeps OpenRouter's provider.only; the Cline plugin's provider asks for
|
||||
// nothing by default (0.1.13 pins nothing unless its own option is on,
|
||||
// and a pin it writes is refused, so no reply is served on it).
|
||||
func TestClinePassAsked(t *testing.T) {
|
||||
const ds = "cline-pass/deepseek-v4.1-flash-1017"
|
||||
builtin := Provider{ID: "clinepass", Preset: "clinepass"}
|
||||
ticked := builtin
|
||||
ticked.PinUpstream = true
|
||||
plug := Provider{ID: "cline", Account: &Account{plugin: &plugin.Provider{ID: "cline"}}}
|
||||
plugTicked := plug
|
||||
plugTicked.PinUpstream = true
|
||||
other := Provider{ID: "grok", Account: &Account{plugin: &plugin.Provider{ID: "grok"}}}
|
||||
other.PinUpstream = true
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
p Provider
|
||||
@@ -24,11 +30,16 @@ func TestClinePassAsked(t *testing.T) {
|
||||
want string
|
||||
}{
|
||||
{"built-in, tick off", builtin, ds, ""},
|
||||
{"built-in, tick on", ticked, ds, "deepseek"},
|
||||
{"built-in, tick on, GLM", ticked, "cline-pass/glm-5.3", "zai"},
|
||||
{"plugin by default", plug, ds, "deepseek"},
|
||||
{"built-in, tick on", ticked, ds, ""},
|
||||
{"built-in, tick on, GLM", ticked, "cline-pass/glm-5.3", ""},
|
||||
{"built-in, tick on, usage-billed DeepSeek", ticked, "deepseek/deepseek-v4-pro", ""},
|
||||
{"built-in, tick on, glm-5.3-flash", ticked, "cline-pass/glm-5.3-flash", "z-ai"},
|
||||
{"built-in, tick off, glm-5.3-flash", builtin, "cline-pass/glm-5.3-flash", ""},
|
||||
{"plugin by default", plug, ds, ""},
|
||||
{"plugin, tick on", plugTicked, ds, ""},
|
||||
{"plugin, tick on, glm-5.3-flash", plugTicked, "cline-pass/glm-5.3-flash", "z-ai"},
|
||||
{"plugin, a model it doesn't pin", plug, "cline-pass/kimi-k3", ""},
|
||||
{"another plugin", other, ds, ""},
|
||||
{"another plugin", other, "cline-pass/glm-5.3-flash", ""},
|
||||
} {
|
||||
if got := c.p.ClinePassAsked(c.model); got != c.want {
|
||||
t.Errorf("%s: ClinePassAsked(%s) = %q; want %q", c.name, c.model, got, c.want)
|
||||
|
||||
@@ -407,7 +407,10 @@ type Provider struct {
|
||||
// by DeepSeek's own API (White Immortal on Discord) and its GLM models
|
||||
// only by Z.ai's (sdytman on Discord): Cline routes a model through an
|
||||
// AI gateway that may serve it from any host, and the maker's own
|
||||
// keeps its prompt cache. See ClinePin.
|
||||
// keeps its prompt cache. Since 2026-11-06 Cline refuses the
|
||||
// providerOptions field that pinned all but glm-5.3-flash, so only
|
||||
// that model is pinned now (#5442); the saved value is kept as set.
|
||||
// See ClinePin.
|
||||
PinUpstream bool `json:"pinUpstream,omitempty"`
|
||||
|
||||
// AuthHeader is which header the key goes in on a third-party
|
||||
|
||||
@@ -18,8 +18,9 @@ import (
|
||||
//
|
||||
// The kernel hands a port a test freed to the next listener that asks,
|
||||
// in this process or another shard's, and a request still on its way to
|
||||
// the old one lands here (#3357): TestClinePluginPinsDeepSeekAndGLM's
|
||||
// vendor got a seventh request while magpie had sent six, and
|
||||
// the old one lands here (#3357): TestClinePluginTickSendsNoProviderOptions's
|
||||
// vendor (then named TestClinePluginPinsDeepSeekAndGLM) got a seventh
|
||||
// request while magpie had sent six, and
|
||||
// TestPluginToldWhereTheAgentWorks's a second (#3347). A test that holds
|
||||
// its plugin to exactly one request per ask keeps that guarantee for its
|
||||
// own requests, and a stranger's is no longer one of them.
|
||||
|
||||
Reference in New Issue
Block a user