gateway: MiniMax and Volcengine Ark refuse thinking turned off in their own words — so the request is asked again with it left to the model
What happens
On Claude Desktop in 3P gateway mode, selecting MiniMax-M3.1-Flash-Preview (provider: MiniMax (China)) is refused: the set_model control request returns API error: 400 … · model not changed, and Desktop restores the previous model.
The same 400 hits every request that carries no thinking — exactly the requests Desktop does not annotate itself:
- the CLI's
model_validationprobe behindset_model—bj({model, max_tokens:1, querySource:"model_validation", messages:[{role:"user",content:[{type:"text",text:"Hi",cache_control:{type:"ephemeral"}}]}]}) - the gateway health probe behind "Your gateway couldn't serve …" —
{model, max_tokens:1, messages:[{role:"user",content:"."}]} - session title generation —
[title-gen] direct request failed { kind: 'model_rejected', httpStatus: 400 }
Ordinary turns work, because Desktop passes thinking:{type:"adaptive"} itself when the model is judged adaptive-capable. So it never shows up in conversation — only when switching model, on the health card, and on titles.
Why the existing self-heal doesn't fire
thinkingOffUnlessAsked (internal/gateway/anthropic.go:186) appends "thinking":{"type":"disabled"} to a Messages request for a non-Claude model that doesn't mention thinking — injected at internal/gateway/gateway.go:2846-2847.
The self-heal for a vendor that refuses that is internal/gateway/gateway.go:2986:
if nb, ok := withoutThinkingOff(body); ok && (alwaysThinks.Match(b) || mandatoryReasoning.Match(b)) {
mandatoryReasoning (gateway.go:3429) is OpenRouter's wording. alwaysThinks (anthropic.go:214) covers Z.ai, DashScope and their Chinese phrasings. Neither matches these two:
MiniMax (China): invalid params, model "MiniMax-M3.1-Flash-Preview" requires adaptive thinking; thinking.type="disabled" (including reasoning.effort=none) is not allowed (2013)
Volcengine Ark: thinking.type `disabled` is not supported by this model Request id: …
withoutThinkingOff would have handled both. Only the match misses.
Minimal repro
curl -s -X POST http://127.0.0.1:3425/v1/messages \
-H "Authorization: Bearer $KEY" -H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"<catalog id>","max_tokens":1,"messages":[{"role":"user","content":"hi"}]}'
# → 400 … requires adaptive thinking; thinking.type="disabled" … is not allowed (2013)
# the same body with one field added:
-d '{"model":"<catalog id>","max_tokens":1,"thinking":{"type":"adaptive"},"messages":[{"role":"user","content":"hi"}]}'
# → 200
"thinking":null is 200 too, and {"type":"enabled","budget_tokens":1024} is 200. output_config is not involved: output_config.effort alongside adaptive is 200.
Blast radius (magpie 0.1.1101, one Messages request per model)
| model (upstream name) | provider | no thinking |
{"type":"adaptive"} |
|---|---|---|---|
| MiniMax-M3.1-Flash-Preview | minimax-cn | 400 | 200 |
| glm-5.3 | volcengine (Ark) | 400 | 200 |
| glm-5.3-flash | volcengine (Ark) | 400 | 200 |
| glm-5.3 (group) | volcengine (Ark) | 200 | 200 |
| MiniMax-M3 | minimax-cn | 200 | 200 |
| K3, K3-256k | kimi-code-cn | 200 | 200 |
| GLM-5.3, GLM-5.3-Flash | zcode | 200 | 200 |
Catalog ids carry a per-install hash suffix (e.g. mythos-magpie-6591897722); [1m] and stream:true variants behave the same.
Suggested fix
Either, in the spirit of #596 and #240:
- add the two wordings to
alwaysThinks:
var alwaysThinks = regexp.MustCompile(`(?i)always engages in thinking|thinking (?:can ?not|can't) be (?:disabled|turned off)|enable_thinking[^"]{0,60}restricted to true|requires adaptive thinking|thinking\.type[^"]{0,12}disabled[^"]{0,12}is not supported|始终(?:支持|开启|启用)?思考|思考[^"]{0,20}(?:不可|无法|不能)关闭`)
- or key the Anthropic retry on
withoutThinkingOffalone, without a wording match: a Messages request the gateway itself turned thinking off in, refused with 400, is a vendor saying the model thinks — in whatever words. That covers the next vendor too. It would not cover a request where the agent sent its own explicitdisabled, which is why #596 added a wording in the first place.
The retry deletes the field rather than asking for adaptive, which is the more conservative of the two and matches every model in the table.
Workaround in use
@magpie-community/middleware-param-override as gateway middleware, rewriting thinking to null on Anthropic-protocol requests whose model isn't Claude's:
{"operations":[
{"path":"thinking","mode":"set","value":null,"logic":"AND",
"conditions":[{"path":"protocol","mode":"full","value":"anthropic"},
{"path":"model","mode":"contains","value":"claude","invert":true},
{"path":"thinking.type","mode":"full","value":"disabled"}]},
{"path":"thinking","mode":"set","value":null,"keep_origin":true,"logic":"AND",
"conditions":[{"path":"protocol","mode":"full","value":"anthropic"},
{"path":"model","mode":"contains","value":"claude","invert":true}]}
]}
It fixes the switch, the health probe and title generation. It is a workaround, not the fix: a middleware cannot make the gateway omit the field (thinkingOffUnlessAsked only skips when the key is present), so it has to pre-empt the injection for every non-Claude model, and models that would have taken disabled get null instead.
Environment
magpie 0.1.1101 on Windows 11; Claude Desktop 2.16120.0.0 in 3P gateway mode ($schemaVersion: 2, inference.provider: gateway); providers MiniMax (China) and Volcengine Ark, both over their Anthropic-compatible endpoints.
中文摘要
thinkingOffUnlessAsked 会给非 Claude 模型的 Messages 请求补上 thinking.type=disabled,而 MiniMax 与火山方舟(Volcengine Ark)的 Anthropic 兼容端都拒收这个值,直接回 400。gateway.go:2986 的自动重试本来能救——withoutThinkingOff 会把字段删掉再问一次——但触发条件是 alwaysThinks || mandatoryReasoning,这两套措辞都没被覆盖,于是 400 原样返回给客户端。
表现:Claude Desktop 切到 MiniMax-M3.1-Flash-Preview 时 set_model 被拒并回退到上一个模型;网关健康探测与标题生成同样 400;正常对话没事,因为桌面自己会带 thinking:{type:"adaptive"}。
临时规避:用 @magpie-community/middleware-param-override 把 thinking 改写成 null(配置见上)。
Thanks for the precise report — it checks out against origin/main.
thinkingOffUnlessAsked(internal/gateway/anthropic.go) adds"thinking":{"type":"disabled"}to a Messages request for a non-Claude model that doesn't mention thinking.- The retry in
internal/gateway/gateway.go(theproto == provider.Anthropic && res.StatusCode == 400block) only fires when the refusal matchesalwaysThinks(Z.ai / ZCode / DashScope wordings,anthropic.go) ormandatoryReasoning(OpenRouter's). - MiMo's
requires adaptive thinking; thinking.type="disabled" ... is not allowed (2013)and Ark'sthinking.type `disabled` is not supported by this modelmatch neither, so the 400 goes back to Desktop on themodel_validationprobe, the health probe and title generation, exactly as you describe.withoutThinkingOffwould handle both; only the match misses.
There's no fix for this on main or in an open PR yet. Of your two options, adding the two wordings to alwaysThinks is the one in line with #596/#240: keying the retry on any 400 would also resend requests refused for unrelated reasons. We'll add both wordings with a test from your two error bodies. Until it ships, your param-override middleware is a reasonable workaround.
Reproduced again today (2026-10-10) with a live Volcengine Agent Plan account, on Windows Magpie 0.1.1143. The running binary embeds revision 059171006b119477d83e57ed3a512dec187fdd21, vcs.modified=false.
The same glm-5.3-flash Messages request was sent directly to Ark and through Magpie:
thinking in the caller's body |
Direct Ark | Magpie |
|---|---|---|
| omitted | 200, text = OK | 400: thinking.type disabled is not supported by this model |
{ "type": "disabled" } |
400 | 400 |
{ "type": "adaptive" } |
200, text = OK | 200, text = OK |
Minimal body for the omitted-field case, via POST /v1/messages:
{
"model": "volcengine/glm-5.3-flash",
"max_tokens": 256,
"stream": false,
"messages": [{"role": "user", "content": "Reply with OK."}]
}
For the direct control, use glm-5.3-flash without Magpie's provider prefix at the provider's configured Messages endpoint (https://ark.cn-beijing.volces.com/api/plan/v1/messages), with the provider's own authentication and anthropic-version: 2023-06-01. No other body field changes.
The matrix reproduced in two test rounds several hours apart. A separate Magpie Responses request to the same model completed successfully, so the observed defect is the omitted/disabled thinking path on Messages, not general model availability or a plan-quota failure.
I also checked current main at 61e296688e52c9dd4576d52e909a2921db4513ec: thinkingOffUnlessAsked still inserts disabled for this request, and alwaysThinks still does not match Ark's refusal. This supports the narrow fix already discussed here: recognize this exact unsupported-thinking wording, remove the disabled field and retry, with regression tests; do not retry unrelated 400s.
Suggested acceptance checks: omitted thinking works through Magpie on the live model, the adaptive control still works, the exact Ark refusal exercises the retry, and an unrelated 400 does not exercise it. All credentials and upstream request IDs have been omitted from this report.
@Edward4226 @skalitz-wolf sorry for the slow follow-up, and thank you for the live re-check with the exact Ark body.
Still not fixed on main (checked at 091593f7d). Since the first reply, main added a third refusal pattern, thinkingOffRefused (internal/gateway/anthropic.go:617, thinking\.type\.disabled\W+is not supported), for Opus 5.5's wording. It needs a literal thinking.type.disabled, so neither Ark's thinking.type `disabled` is not supported by this model nor MiniMax's requires adaptive thinking; thinking.type="disabled" ... is not allowed (2013) matches, and the retry at internal/gateway/gateway.go:3746 (and its sibling at :4225) still passes the 400 back.
It's being worked on now, as discussed: both wordings added, tested with your exact error bodies, plus your acceptance checks (omitted thinking succeeds after the retry, adaptive untouched, an unrelated 400 does not retry). I'll post the commit and version here; the issue stays open until you confirm on the live model.
@Edward4226 @skalitz-wolf Fixed in dc2e1cc12, and it will be in the next release. MiniMax's "requires adaptive thinking … thinking.type=disabled (including reasoning.effort=none) is not allowed" and Volcengine Ark's "thinking.type disabled is not supported by this model" are now recognised as a refusal of thinking turned off. magpie sends the request again with thinking left to the model, both on the Anthropic passthrough and on the translated Chat/Responses path. Other 400s from those vendors, and every other vendor's refusals, are handled as before. I tested it against your exact wording but not against the live MiniMax or Ark endpoints, so I'm leaving this open: please tell me whether it works for you once the release is out.
@skalitz-wolf @Edward4226 The fix (MiniMax and Volcengine Ark: a refused thinking-off turn is retried) is out in v0.1.1219 — update from inside magpie. Please let us know here whether it works for you.
Retested on a live Volcengine Agent Plan account with v0.1.1222 (Windows, 2026-10-13). Same minimal body as the 2026-10-10 report — POST /v1/messages, model: volcengine/glm-5.3-flash, max_tokens: 256, stream: false, one user turn "Reply with OK.":
thinking in the caller's body |
direct Ark (2026-10-10) | magpie 0.1.1143 (2026-10-10) | magpie v0.1.1222 (today) |
|---|---|---|---|
| omitted | 200 | 400 thinking.type `disabled` is not supported by this model |
200 |
{"type":"adaptive"} |
200 | 200 | 200 |
{"type":"disabled"} |
400 | 400 | 200 |
- Omitted: 200 (
id 02179186805249810ac68a140479f93d63741c4458c3d4869f872). Ark refuses any call carryingdisabledoutright, so the call that answered cannot have carried it. {"type":"adaptive"}is untouched, as before.- The explicit
{"type":"disabled"}row also comes back 200 now — the request ends up asked with thinking left to the model. - An unrelated 400 passes through unchanged:
max_tokens: 99999999→ 400The parameter max_tokens ... is not valid: integer above maximum value, expected a value <= 131072(62 ms, a single upstream attempt — the retry does not fire).
That is the Ark half of the report. The MiniMax half is still unverified from our side, so leaving this open for that one.
@yetone Updated to v0.1.1219 and confirmed the fix works on my side. The MiniMax thinking-off requests that previously returned 400 now complete successfully after the retry, and the daptive path is unchanged. Thanks for the quick fix!
@skalitz-wolf @yetone Both halves are now confirmed on released versions: MiniMax on v0.1.1219 and Volcengine Ark on v0.1.1222. The retry path and the unrelated-400 pass-through are both covered. Per the 3-day rule in #2123, please include this one in the next close-out batch as fixed. If it comes back, reply here and we'll reopen.
A third wording for alwaysThinks, same shape as the two fixed here: Kimi Code's K3.1 models.
Kimi Code (China): K3.1 Pro does not support disabled thinking mode. Please enable thinking and try again, or choose another model.
k3.1-pro and k3.1-pro-highspeed 400 on every Messages request that omits thinking, because thinkingOffUnlessAsked injects disabled and none of the current alwaysThinks alternatives matches this sentence. Direct to api.kimi.com the same body is 200, so it is the injection plus the missed match, not the model.
Full report with the repro matrix, the direct-upstream control, and a second silent symptom on k3-256k (accepts disabled, answers with zero thinking even when output_config.effort was asked for): #3739
Not asking to reopen this one — just noting the third wording so it lands with the same test pattern.