magpie icon indicating copy to clipboard operation
magpie copied to clipboard

[bug] reasoning off 被静默收敛成 low:catalog 的 toggle 未被识别(DeepSeek 官方 deepseek-flash、Kimi K3)

Open worksyang opened this issue 1 month ago • 13 comments

现状

deepseek/deepseek-flash(DeepSeek 官方直连)在 Magpie 里只有 low / high / max 三个推理档,没有「关闭思考」档。任何要求关闭思考的请求都被静默收敛成 low,思考照常跑,用户无从真正关掉。

但这个模型实际支持关闭思考——我直连官方实测确认过(见下)。

代码依据(本地 main,71f0541)

internal/gateway/gateway.go:3273-3276:

if offEffort(req.Effort) && !s.fits(p.ID, offRefused(model), to) {
    r := *req
    r.Effort, req = onEffort(p, model), &r
}

onEffort(gateway.go:4217)把关闭请求改写成「最低的开启档」:

func onEffort(p provider.Provider, model string) string {
    levels := slices.DeleteFunc(slices.Clone(p.Efforts(model)), offEffort)
    return fitEffort("low", levels)   // 关闭 → low
}

而 p.Efforts(model) 对官方渠道来自 models.dev 的 catalog。该条目的 reasoning_options 是:

[{"type": "toggle"}, {"type": "effort", "values": ["low", "high", "max"]}]

{"type":"toggle"} 就代表「可整个关掉」。 但 catalog 的解析只认 effort 的 values:

// internal/catalog/catalog.go
func (m mdModel) efforts() []string {
    var out []string
    for _, r := range m.Reasoning {
        if r.Type == "effort" {   // toggle 被跳过
            out = r.Values
        }
    }
    return out
}

于是 Efforts() 不含 none → offEffort 判定失败 → 请求被降级成 low。这与 #899 是同一类问题的另一个入口:#899 修的是内置目录里认识的模型,而官方渠道 deepseek-flash 走 models.dev catalog + toggle,没被覆盖。

实测证据

1. 官方接口自报档位(根因)

GET https://api.deepseek.com/v1/models
deepseek-flash → effort.supported_levels: ["low", "high", "max"]

官方只报了 effort 三档,没在 supported_levels 里体现「可关闭」;但同一份数据里有 {"type":"toggle"},且官方文档明确支持关闭:

{"thinking": {"type": "disabled"}}

2. 直连官方(绕过 Magpie)——证明它真能关

请求 reasoning_tokens
不传 thinking 18
{"thinking":{"type":"disabled"}} 无(关闭)
reasoning_effort: "none" 无(关闭)

3. 经 Magpie——被挡住

请求(同一个 prompt「1+1=?只回答数字」) reasoning_tokens
deepseek/deepseek-flash:none 28
reasoning_effort: "none" 31
{"thinking":{"type":"disabled"}} 无(关闭)
对照:ark-cn-beijing-volces/deepseek-v4-1-flash-260910:none(该渠道自报有 none) 0

复测(各 3 次,稳定可复现):

  • thinking.type=disabled → reasoning_tokens = None、reasoning_content 长度 0,3/3 一致
  • :none → 35 / 35,reasoning_content 长度 119 / 57(仍在思考)

请求

  1. 让 catalog 认 {"type":"toggle"}:efforts() 里遇到 toggle 时补上 none(或至少让 offEffort 判定能通过)。这样官方 deepseek-flash 会像火山渠道那样出现 none 档。
  2. 或者:官方渠道的 DeepSeek 系列(deepseek-flash、deepseek-v4-pro)在模型目录里直接声明 none,它们上游确实支持。

补充说明

  • 版本:magpie 0.1.1099
  • 平台:macOS arm64
  • 该问题不止影响"省 token"——对延迟敏感的用途(压缩上下文、分类、简单改写)损失明显。绕开办法是走火山渠道(自报有 none),但官方直连通常更快更便宜,值得修。

如果 toggle 的语义在 models.dev 那边不是「可关闭」,也请在目录或文档里说明,避免用户误以为 low 就是"关掉了"。

worksyang avatar Oct 07 '26 03:10 worksyang

English version (same report)

Summary

On the DeepSeek official provider (deepseek/deepseek-flash), Magpie offers only low / high / max reasoning levels — there is no "thinking off" level. Any request asking to turn thinking off is silently collapsed to low, so thinking still runs and the user cannot actually disable it.

The model does support disabling thinking — confirmed by calling the vendor API directly (evidence below).

Code path (main, local build 0.1.1099, commit 71f0541)

internal/gateway/gateway.go:3273-3276:

if offEffort(req.Effort) && !s.fits(p.ID, offRefused(model), to) {
    r := *req
    r.Effort, req = onEffort(p, model), &r
}

onEffort (gateway.go:4217) rewrites an off request into the lowest reasoning-on level:

func onEffort(p provider.Provider, model string) string {
    levels := slices.DeleteFunc(slices.Clone(p.Efforts(model)), offEffort)
    return fitEffort("low", levels)   // off -> low
}

p.Efforts(model) for the official provider comes from the models.dev catalog. That entry is:

[{"type": "toggle"}, {"type": "effort", "values": ["low", "high", "max"]}]

{"type":"toggle"} is the marker that reasoning can be turned off entirely. But the catalog parser only reads the effort values:

// internal/catalog/catalog.go
func (m mdModel) efforts() []string {
    var out []string
    for _, r := range m.Reasoning {
        if r.Type == "effort" {   // toggle is skipped
            out = r.Values
        }
    }
    return out
}

So Efforts() never contains none → the offEffort check can never pass → the request is downgraded to low. This looks like the same class of bug as #899, via a different entry point: #899 fixed models in the built-in table, while the official deepseek-flash goes through the models.dev catalog and its toggle flag, which is not covered.

Evidence

1. What the vendor reports (root cause)

GET https://api.deepseek.com/v1/models
deepseek-flash -> effort.supported_levels: ["low", "high", "max"]

The vendor only lists effort levels; it does not surface "can be turned off" in supported_levels. But the same dataset carries {"type":"toggle"}, and DeepSeek's docs explicitly document disabling:

{"thinking": {"type": "disabled"}}

2. Direct to the vendor (bypassing Magpie) — it really can be turned off

Request reasoning_tokens
no thinking field 18
{"thinking":{"type":"disabled"}} none (off)
reasoning_effort: "none" none (off)

3. Through Magpie — it is blocked

Same prompt ("1+1=? answer with the number only") for every row:

Request reasoning_tokens
deepseek/deepseek-flash:none 28
reasoning_effort: "none" 31
{"thinking":{"type":"disabled"}} none (off)
control: ark-cn-beijing-volces/deepseek-v4-1-flash-260910:none (that provider advertises none) 0

Repeated runs (3 each, stable):

  • thinking.type=disabled → reasoning_tokens = None, reasoning_content length 0 — 3/3 identical
  • :none → 35 / 35, reasoning_content length 119 / 57 (still thinking)

Requested fix

  1. Honour {"type":"toggle"} in the catalog: when efforts() sees a toggle, add none, or at least let the offEffort check pass. Then the official deepseek-flash would expose a none level the same way the Volcengine provider already does.
  2. Or: declare none directly in the model catalog entry for the official DeepSeek models (deepseek-flash, deepseek-v4-pro) — their upstream genuinely supports it.

Notes

  • Version: magpie 0.1.1099, macOS arm64
  • Impact is not only token savings — latency-sensitive uses (context compaction, classification, simple rewrites) pay for it. Putting Volcengine in front works around it, but the official endpoint is usually faster and cheaper, so this is worth fixing.
  • If toggle does not mean "can be disabled" in models.dev terms, please say so in the catalog or docs, so users don't assume low already means "off".

worksyang avatar Oct 07 '26 03:10 worksyang

Same root cause, second case: Kimi K3 (kimiplan/k3-256k)

Adding this here because it looks like the same defect — worth fixing in one pass.

Version: magpie 0.1.1099, macOS arm64. Provider: kimiplan (https://api.kimi.com/coding/v1, Kimi Code plan).

What Magpie offers

magpie model efforts kimiplan/k3-256k   ->   low high max · all offered

No off level, same as the DeepSeek case.

Direct to the vendor — thinking can be turned off

Request (prompt 1+1=?) reasoning_tokens
no thinking field 28
{"thinking":{"type":"disabled"}} none (off)
reasoning_effort: "none" none (off)

Through Magpie — blocked

Request reasoning_tokens
kimiplan/k3-256k:none 3 (reasoning_content length 7)
reasoning_effort: "none" 43 (reasoning_content length 174)
{"thinking":{"type":"disabled"}} none (off)

Same pattern as DeepSeek: :none / reasoning_effort: none get collapsed to low, while thinking.type=disabled passes through and genuinely disables thinking.

Catalog data

~/.cache/magpie/models.json (from models.dev), provider moonshotai:

"kimi-k3": {"reasoning_options": [{"type": "effort", "values": ["low", "high", "max"]}]}
"kimi-k2.6": {"reasoning_options": [{"type": "toggle"}]}

Note the difference from the DeepSeek case: for kimi-k3 the catalog has no toggle at all — only effort values. So even a fix to honour toggle in efforts() would not cover K3; the entry itself is missing the marker. kimi-k2.6 does carry toggle and would be fixed by that change.

Vendor documentation

Kimi Code docs state K3 and K2.8 Preview carry reasoning_effort: low / high / max (default high), and — quoting the model page — when thinking is turned off, requests are served by K2.8 Preview (no-thinking). The response still reports "model": "k3", so the handoff is not visible to the caller. Either way, from the caller's side the effect is "thinking off", and it is reachable directly but not through Magpie.

Requested fix (both cases together)

  1. Honour {"type":"toggle"} in efforts() — covers deepseek-flash (official) and kimi-k2.6.
  2. For kimi-k3 / kimi-k2.8-preview: the catalog entry has no toggle, yet the vendor accepts thinking.type=disabled. Worth either fixing upstream at models.dev or declaring the off level for these in Magpie's own catalog, so :none reaches the vendor instead of being collapsed to low.

Workaround in the meantime

thinking.type=disabled on the request works through Magpie for both DeepSeek official and Kimi K3 (verified: 0 reasoning tokens, 3/3 stable for DeepSeek).

worksyang avatar Oct 07 '26 03:10 worksyang

Correction + full test: all four Kimi Code models

Correcting my previous comment: for the Kimi Code plan models the catalog does carry {"type":"toggle"} — so this is not a data-source gap, it is Magpie's parser skipping toggle. (The moonshotai provider entry I quoted earlier is a different provider than the one this plan uses; my mistake.)

The catalog entry this plan actually uses (kimi-code-plan-global / -cn)

"k3":                         [{"type":"toggle"}, {"type":"effort","values":["low","high","max"]}]
"kimi-for-coding":            [{"type":"toggle"}, {"type":"effort","values":["low","high","max"]}]
"k3-256k":                    [{"type":"effort","values":["low","high","max"]}]
"kimi-for-coding-highspeed":  []

So toggle is present for K3 and K2.8 Preview and is being dropped. Magpie offers only:

kimiplan/k3                        -> low high max · all offered
kimiplan/k3-256k                   -> low high max · all offered
kimiplan/kimi-for-coding           -> low high max · all offered
kimiplan/kimi-for-coding-highspeed -> no reasoning levels known

Tested all four models, both directions

Vendor: https://api.kimi.com/coding/v1 (Kimi Code plan). Prompt: 1+1=?

Direct to the vendor:

Model no thinking thinking.type=disabled reasoning_effort=none
k3 8 off off
k3-256k 5 off off
kimi-for-coding (K2.8 Preview) 14 off off
kimi-for-coding-highspeed (K2.7) 19 off 17 (still thinking)

Through Magpie:

Model :none reasoning_effort: "none" thinking.type=disabled
kimiplan/k3 4 5 off
kimiplan/k3-256k 3 3 off
kimiplan/kimi-for-coding 7 9 off
kimiplan/kimi-for-coding-highspeed 11 49 off

(reasoning_tokens; "off" = reasoning_tokens absent and reasoning_content length 0.)

What this shows

  1. Every model whose catalog entry carries toggle (k3, kimi-for-coding) still gets no off level — consistent with the efforts() parser skipping toggle. Fixing that one function should cover k3, kimi-for-coding, deepseek-flash and kimi-k2.6.
  2. k3-256k has no toggle in its entry but the vendor accepts thinking.type=disabled. Same for kimi-for-coding-highspeed (empty entry). These two need the off level declared for them — either upstream at models.dev or in Magpie's own catalog.
  3. kimi-for-coding-highspeed (K2.7 Code) legitimately rejects effort=none (17 tokens, still thinking) — that matches the vendor docs, where K2.7 uses thinking rather than reasoning_effort. Not a bug; listing it so the fix doesn't wrongly add none there.

Note on :none being "not fully off"

For k3 the through-Magpie :none run shows reasoning_tokens=4 rather than the vendor's 8 — it is being reduced to low, not switched off, which is the onEffort() collapse described in the original report.

worksyang avatar Oct 07 '26 04:10 worksyang

谢谢报告和两边的实测,原因对着代码确认了:

  • internal/catalog/catalog.go 的 mdModel.efforts() 只读 {"type":"effort"} 的 values,{"type":"toggle"} 被跳过,所以 deepseek-flash、k3、kimi-for-coding 这些带 toggle 的模型,Efforts() 里都没有 none。
  • 请求要求关闭思考时,出去前会按模型自己的档位取最近的一档(fitFor → fitEffort,internal/gateway/decide.go / ir.go),fitEffort 跳过 none,于是 none 被收敛成 low。(gateway.go 里 onEffort 那一处只在 magpie 记住了上游拒绝过「关闭」之后才会生效,不是这里的主因。)
  • thinking.type=disabled 原样透传,所以它能关掉。

修复已排上:catalog 认 toggle,让这些模型出现「关闭」档;没有 toggle、但上游实际接受关闭的 k3-256k 一类,也会一并看怎么声明。你提到 kimi-for-coding-highspeed 不接受 reasoning_effort=none,修的时候会注意不给它错加。修好后在这里回复。

在那之前,你找到的办法就是可用的绕过:请求里直接带 {"thinking":{"type":"disabled"}}。


Thanks for the report and the measurements. Cause confirmed in the code: the catalog's efforts() reads only {"type":"effort"} values and skips {"type":"toggle"}, so these models have no none level, and the outgoing fit (fitFor → fitEffort) turns none into the nearest level, low. A fix is planned (honour toggle, and look at models like k3-256k that accept off without one, without adding it to kimi-for-coding-highspeed). Meanwhile, sending {"thinking":{"type":"disabled"}} works as you found.

yetone avatar Oct 07 '26 04:10 yetone

感谢确认。想问一下这个修复大概在什么版本?

我在 MiniMax Code 里用 deepseek-flash(provider-ds-official,直连 api.deepseek.com)时需要「关闭思考」这一档。现在 magpie 只列出 low / high / max,MCode 那边配不了 none,只能靠手动传 {"thinking":{"type":"disabled"}} 绕过。

如果能知道大概的版本号或者有没有关联的 PR,我就先不折腾了,等更新。

worksyang avatar Oct 09 '26 06:10 worksyang

@worksyang 还没发:catalog 认 toggle(让 deepseek-flash、k3、kimi-for-coding 出现「关闭」档)这一修复现在开始做,修好会在这里回复具体版本号。在那之前请继续用 {"thinking":{"type":"disabled"}} 绕过。

yetone avatar Oct 09 '26 06:10 yetone

非常感谢作者!冒昧再来跟进一下这个修复的进展。

我们日常极度重度依赖 Magpie,打心底里觉得这是一个非常优秀的原创工具。最近看到 X 上有些关于「迭代太快、用 AI 修 bug」之类的声音,我们觉得完全是无稽之谈。真正好用的产品自己会说话,做原创产品从来不容易,我们绝对坚定支持你!

之所以想再催一下,是因为我们目前有很多高频轻量任务(例如意图分类、总结压缩、简单重写)。在无法关闭思考(no-thinking)的情况下,每个请求都要多跑十几秒思考,很多任务处理速度严重不达标,卡住了流程。

如果官方 DeepSeek 和 Kimi 能够正常通过 :none / toggle 关闭思考,Magpie 对我们来说就极度完美了。

作者辛苦!期待早日合入修复,给那些质疑的人看看真正能打的好产品!

worksyang avatar Oct 13 '26 18:10 worksyang

同类问题的另一个入口,已转到插件仓库:magpie-community/plugins#334

简报:Command Code(commandcode-plan)的上游 Provider API 关闭思考用的是 reasoning_effort: "off",不是 "none";DeepSeek 的 v4-pro / v4-flash / v4.1-flash / v4.1-flash-fast / vision-exp 实测都能关到 0 reasoning tokens,thinking.type=disabled 则被忽略。但插件目前只给这些模型 low/high/max,转发时还会把内部的 none 丢掉,所以经 Magpie 无论 :none 还是 reasoning_effort: "off" 都仍在思考。

这条不需要主仓库改(Command Code 已由插件服务),放在这里只是给同类问题留个索引;reasoningOffProviders 目前不含 commandcode 也是对的,因为它的关闭拼写和验证都归插件。

A sibling case, moved to the plugin repo: magpie-community/plugins#334. Command Code turns thinking off with reasoning_effort: "off" (not "none"), verified 0 reasoning tokens on its DeepSeek models; the plugin offers no off level and drops Magpie's none before sending. No main-repo change needed — just an index for the same class of bug.

CHENJIAMIAN avatar Oct 23 '26 07:10 CHENJIAMIAN

Tested on magpie 0.1.1939 / macOS (arm64) with the Volcengine Ark Coding Plan channel, and this still happens for volcengine/deepseek-v4-flash.

  • magpie model efforts volcengine/deepseek-v4-flash lists only low high max, while deepseek/deepseek-flash lists none low high max.
  • Sending "reasoning_effort": "none" gets clamped to low, and the model still thinks (14 reasoning tokens).
  • Passing "thinking": {"type": "disabled"} straight through works (0 reasoning tokens). With no parameter it uses 38.

So the upstream supports turning thinking off, but magpie doesn't expose none for the volcengine DeepSeek V4 models, probably because they borrow their effort levels (ListedByBorrowed). Could none be added for the volcengine deepseek-v4-* models, or mapped to thinking.type=disabled the way the official deepseek channel does? Happy to test a build.

pintaste avatar Oct 29 '26 07:10 pintaste

The toggle half of this was fixed on main (reasoningOffProviders, which now covers deepseek and both kimi-code-plan-*). This closes the remaining case pintaste reported on 10-29: volcengine/deepseek-v4-* lists low high max and clamps none to low.

The repo doesn't take pull requests, so the fix is a branch of my fork for cherry-picking — it shares nothing with the other commits in that branch beyond two files at different hunks:

git fetch https://github.com/Niko-Wu/magpie fix/oss-batch && git cherry-pick 83b8acad

(based on 4534561f, one commit, internal/provider/ and internal/gateway/ only)

Root cause — the volcengine channel's deepseek-v4-pro / -flash have no models.dev entry of their own, so they borrow DeepSeek's levels, and borrowing is deliberately without the off level (ListedByBorrowed: a provider's API accepting "none" does not verify that a relay serving the same model does — the rule the toggle fix set). That rule is right for a relay and wrong for Ark, whose API turns thinking off its own way.

What the request has to look like — not reasoning_effort: "none". Ark's own console turns these models' thinking off with thinking: {"type": "disabled"}, which is what pintaste measured end to end through magpie (0 reasoning tokens, where none clamped to low still thought for 14). So exposing the level alone would have produced a none that does nothing.

Fix

  • internal/provider/models.go — AtArk (the preset's plans, or a provider added by hand on ark.<region>.volces.com), ArkThinksOff (its deepseek-v4 line) and effortsFor, which gives those entries none first. Provider.Known and entryFor both go through it, so the level reaches the model list and the effort fitting alike.
  • internal/gateway/chat.go — for those models at Ark, an Effort of none is sent as thinking: {"type": "disabled"} instead of reasoning_effort, the way the console sends it.
  • internal/gateway/draw_volcengine.go — its isArk now asks provider.AtArk, so there is one predicate for "this is Ark".
  • Everything else borrowing these levels is untouched: a relay's deepseek-v4-pro still says low high max, Ark's doubao-* still get reasoning_effort, and DeepSeek's own host still gets none as an effort.

Tests, red before and green after

  • TestArkDeepseekOffersThinkingOff (internal/provider/host_efforts_test.go) — Ark's deepseek-v4-pro says none,low,high,max where a relay's entry, borrowing the same list, says low,high,max.
  • TestArkDeepseekOffGoesAsThinkingDisabled (internal/gateway/ark_off_effort_test.go) — off to Ark's deepseek-v4-flash goes as thinking.type=disabled with no reasoning_effort; at low it goes as reasoning_effort: low; Ark's doubao-seed-2 and DeepSeek's own host are unchanged.

Still open on this issue, deliberately

  • kimi-k3 / kimi-k2.8-preview: their models.dev entry has no toggle at all, and the vendor's documented off is a handoff to K2.8 rather than a level. That needs its own decision (and either a models.dev fix or an entry in magpie's catalog) — not covered here.
  • kimi-for-coding-highspeed, which the maintainer's reply says rejects reasoning_effort=none: untouched, as asked.
  • Command Code's reasoning_effort: "off" spelling stays with its plugin (magpie-community/plugins#334), as CHENJIAMIAN noted.

Verification

  • go test ./internal/provider/ ./internal/catalog/ → 1934 passed.
  • go test ./internal/gateway/ -timeout 45m → 428s; green except four that are red on unmodified upstream/main 4534561f on this machine (macOS 27, Go 1.27.3): TestCodexFittedImagesPastTheBudget, TestMarshalRawIsEncodingJSON, TestServeWSLListensBesideLoopback, FuzzMarshalRaw/seed#7.
  • gofmt -l, go vet, and GOOS=linux/GOOS=windows (CGO_ENABLED=0) go vet → clean.
  • Not tried: a real Ark key, so the thinking.type=disabled behaviour is pintaste's measurement, not mine. The natural check on a build is magpie model efforts volcengine/deepseek-v4-flash showing none low high max, then :none returning no reasoning_content and 0 reasoning tokens.

No .github/, no site/, no dependency changes.

Niko-Wu avatar Oct 29 '26 10:10 Niko-Wu

I tested @Niko-Wu's fix (83b8acad from Niko-Wu/magpie fix/oss-batch) against a real Volcengine Ark Coding Plan. It works.

Setup. I cherry-picked it onto origin/main 172e65c with no conflicts. On macOS arm64 I built it with go1.26.8 and ran it as a separate magpie serve on port 3435. That instance used a sandbox HOME whose only provider was my volcengine preset (https://ark.cn-beijing.volces.com/api/coding/v3).

Levels (magpie model efforts volcengine/deepseek-v4-flash):

  • 0.1.2049 (current release), same sandbox: low high max
  • with the fix: none low high max (deepseek-v4-pro shows the same)

Real requests (/v1/chat/completions, "What is 17*23?", answer 391 every time):

effort reasoning_tokens completion_tokens reasoning text
reasoning_effort: "none" 0 1 none
reasoning_effort: "low" 14 16 yes
model volcengine/deepseek-v4-flash:none 0 1 none
model volcengine/deepseek-v4-flash:low 15 17 yes

(Ark reported the upstream model as deepseek-v4-flash-ga-260731.)

Tests (sandbox HOME, go1.26.8):

  • TestArkDeepseekOffersThinkingOff and TestArkDeepseekOffGoesAsThinkingDisabled pass. With chat.go, models.go and draw_volcengine.go reverted, both fail: volcengine: levels "low,high,max", want "none,low,high,max" and thinking <nil>, want off true (… reasoning_effort:none …).
  • go test ./internal/provider ./internal/catalog: ok. go test ./internal/gateway -run 'Ark|Effort|Volc|Seedream|Reasoning|Thinking': ok.
  • gofmt -l and go vet ./internal/gateway ./internal/provider are clean. I didn't run the full gateway package.

One note. ArkThinksOff is a prefix match, so Ark's deepseek-v4.1-flash also gets none low high max. I only measured deepseek-v4-flash live. deepseek-v4.1-flash-economy has no known levels either way.

pintaste avatar Oct 30 '26 02:10 pintaste

Same root cause, third case: 天机阁 yujianwudi-3/deepseek-v4.1-flash (custom relay)

Adding a third case here — the same toggle gap, now on a custom (non-catalog) provider, so the fix likely needs to cover this path too.

Version: magpie 0.1.2926, macOS arm64 (HEAD a9b1877) Provider: yujianwudi-3 — custom NewAPI relay (https://yujianwudi.top/v1), key group China-国模 Model: deepseek-v4.1-flash (Relay's own label; the same underlying DeepSeek V4.1 Flash)

What Magpie offers

magpie model efforts yujianwudi-3/deepseek-v4.1-flash
  -> low high max · only the bold ones are offered

No off level. The /v1/models record Magpie serves carries the same two entries:

"reasoning_levels": ["low", "max"],
"supported_reasoning_levels": [{"effort":"low"},{"effort":"max"}]

Direct to the relay — thinking turns off cleanly

Request (reasoning_effort) reasoning_content reasoning_tokens completion_tokens
"none" length 0 0 33
"low" length 71 44 70

Same key, same prompt (用一句话说明什么是复利), only the effort changed.

Through Magpie — silently rewritten

Path (reasoning_effort: "none") reasoning_content note
yujianwudi-3/deepseek-v4.1-flash direct via gateway length 81 rewritten to low
auto/deepseek-v4.1-flash (routing group, same member first) length 91 rewritten to low

History in the gateway log (~250 calls on this provider/model)

effort sent calls reasoning tokens total avg
(unset) 162 13,418 83
low 68 4,222 62
none 20 170 8.5

19 of the 20 none calls logged reasoning null (= off) — but that is only because those were tiny probes. The one real write-path call (2026-11-02 19:46, reasoning=170) shows the rewrite taking effect on actual content generation. A fresh A/B through the gateway today (above table) reproduces it deterministically.

Why this case is worth adding

  1. The provider is a plain OpenAI-compatible relay, not a models.dev catalog entry. So the toggle data is not the only thing missing here — for custom providers, Efforts() is derived from what the user/panel declares, and there is currently no way for a user to declare "this model can be fully off". The modelEfforts field in settings.json was tried earlier (comment above) and is filtered by effortsKept() as an intersection, not an append — so writing ["none","low","max"] there cannot introduce none when the model record only has low, max.
  2. It is the same user-visible symptom as the DeepSeek-official and Kimi K3 cases: the agent asks for none, the client UI even shows "thinking: none", and thinking still runs.
  3. Cost impact is real on long-form writing: on this relay the low overhead is ~44 tokens per answer (~38% of the answer itself).

Suggested fix surface (same spirit as before)

Any of these would close it:

  • honour {"type":"toggle"} in the catalog parser (as originally proposed above), and/or
  • let modelEfforts (or a per-provider override) add a level instead of intersecting, and/or
  • for custom providers, let the user declare none as a supported level on the model record.

I am happy to run more A/B tests if it helps narrow the path. Thanks again for the continued work on magpie — and apologies for piling yet another case onto this thread.


同一根因的第三个案例:天机阁 yujianwudi-3/deepseek-v4.1-flash(自定义中转站)

版本:magpie 0.1.2926,macOS arm64(HEAD a9b1877) 渠道:yujianwudi-3 —— 自定义 NewAPI 中转站(https://yujianwudi.top/v1),Key 分组 China-国模 模型:deepseek-v4.1-flash(中转站自己的标签,底层是 DeepSeek V4.1 Flash)

Magpie 提供的档位

magpie model efforts yujianwudi-3/deepseek-v4.1-flash
  -> low high max · only the bold ones are offered

没有关闭档。Magpie 下发的 /v1/models 也是同样的两条:

"reasoning_levels": ["low", "max"],
"supported_reasoning_levels": [{"effort":"low"},{"effort":"max"}]

直连中转站 —— 思考能干净关闭

请求 reasoning_effort reasoning_content reasoning_tokens completion_tokens
"none" 长度 0 0 33
"low" 长度 71 44 70

同一把 Key、同一句 prompt(用一句话说明什么是复利),只换档位。

走 Magpie —— 被静默改写

路径(reasoning_effort: "none") reasoning_content 说明
直调 yujianwudi-3/deepseek-v4.1-flash 长度 81 被改成 low
走 auto/deepseek-v4.1-flash(组里第一个就是它) 长度 91 被改成 low

网关日志统计(该渠道该模型约 250 次)

传的 effort 次数 reasoning tokens 合计 平均
未传 162 13,418 83
low 68 4,222 62
none 20 170 8.5

20 次 none 里 19 次 reasoning 是 null(因为都是极小探针);唯一一次真实写作请求(2026-11-02 19:46,reasoning=170)显示改写生效。今天重新做 A/B(上表)稳定复现。

为什么值得补充这个案例

  1. 这是纯 OpenAI 兼容的中转站,不是 models.dev catalog 条目。也就是说除了 toggle 解析之外,自定义渠道的用户目前没有任何办法声明「这个模型可以完全关思考」。之前试过 settings.json 的 modelEfforts,但 effortsKept() 做的是交集不是追加,写 ["none","low","max"] 也加不进去 none。
  2. 用户看到的症状和 DeepSeek 官方、Kimi K3 完全一致:客户端明明选了「思考:none」,思考照跑。
  3. 成本影响是实打实的:这个渠道上 low 的思考开销约 44 tokens/次,占答案本身的 38%。

修复建议(和之前思路一致)

任选其一即可闭合:

  • catalog 解析认 {"type":"toggle"}(原帖方案);且/或
  • modelEfforts(或渠道级覆盖)允许追加档位而不是取交集;且/或
  • 自定义渠道允许用户在模型记录里声明 none 是支持的档位。

如果需要更多 A/B 我可以随时配合。再次感谢 magpie 的持续维护,抱歉又往这个帖子里堆案例了。

worksyang avatar Nov 07 '26 13:11 worksyang

补一个 toggle 修复覆盖不到的入口:opencode-go/deepseek-v4.1-flash。

它的 models.dev 条目本身就没有 {"type":"toggle"}(只有 effort low/high/max),所以 reasoningOffProviders 里加不加这个 provider 都不起作用——efforts() 的第 3 个条件 toggle 就过不了。

但上游实测是支持的(0.1.4747 / Windows amd64):直连 https://opencode.ai/inference/go/openai/v1(需 x-opencode-session: <uuid> 头,否则 400),同一句 prompt:

请求 reasoning_tokens
不传 reasoning 20
reasoning_effort: "none" 0
thinking: {"type":"disabled"} 0

详细复现、model spec 报错原文和路由组降级日志我补在 #6845 了:#6845 (comment)。

影响面:auto/deepseek-v4.1-flash 是 smart 路由组,三个成员里只有 opencode-go 缺 none;路由落到它时,agent 设的 off 会被降成 low,思考照跑(网关日志里能看到 routed to opencode-go)。

如果 reasoningOffProviders 想保持「已验证才放行」的原则,opencode-go 这条按上面的实测可以直接进白名单;或者按 #6845 / #4303 的方向给用户一个手动加档的口子。

CHENJIAMIAN avatar Nov 24 '26 10:11 CHENJIAMIAN