You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: compatibility flag to suppress reasoning replay on assistant messages #62595
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Custom openai-compatible providers pointed at api.mistral.ai fail from the second assistant turn onward. Mistral rejects any reasoning field on replayed assistant messages, and @ai-sdk/openai-compatible always echoes one back.
HTTP 422
{"detail":[{"type":"extra_forbidden","loc":["body","messages",2,"assistant","reasoning_content"],"msg":"Extra inputs are not permitted","input":""}]}
Turn 1 succeeds. Turn 2 fails, because turn 1's assistant message now carries reasoning_content.
S="ses_repro$(date +%s)"
opencode run --session "$S" --model mistral-custom/deepseek-v4-1-flash-1017 "Reply: TURN1"# ok
opencode run --session "$S" --model mistral-custom/deepseek-v4-1-flash-1017 "Reply: TURN2"# 422
Why the existing knobs don't cover it
compatibility.reasoningField only selects the field name (reasoning | reasoning_content | reasoning_text | string). There is no way to say "don't send reasoning at all". Renaming doesn't help either — Mistral rejects unknown fields with extra_forbidden, so reasoning fails the same way as reasoning_content.
compatibility.requireReasoning: false doesn't help: it governs whether reasoning is required, not whether it is sent.
Proposal
Add compatibility.sendReasoning: boolean, default true. When false, omit reasoning from replayed assistant messages entirely.
This matters beyond Mistral: any strict OpenAI-compatible gateway fronting reasoning models has the same problem, and those users can't fall back to the built-in mistral provider because their endpoint isn't Mistral.
Workaround today: use the built-in mistral provider (@ai-sdk/mistral), which never sends the field. Only applies when the endpoint is actually api.mistral.ai.
In short, you're asking for a compatibility option (e.g. compatibility.sendReasoning: false) so OpenCode stops sending any reasoning field on earlier assistant messages. That would make strict OpenAI-compatible endpoints like api.mistral.ai work with reasoning models. The maintainers will consider it.
A note on why you get the empty field: OpenCode switches requireReasoning on by default for any model whose ID contains deepseek. So deepseek-v4-1-flash-1017 gets an empty reasoning_content: "" even when the endpoint is Mistral, which matches the "input": "" in your 422. Setting "requireReasoning": false in the model's compatibility should drop the empty field. But when the model does return reasoning text, it is always sent back, and no setting turns that off yet.
Until then, you can work around it with a small local plugin that removes reasoning fields from earlier assistant messages before the request goes out. Save this as .opencode/plugins/strip-reasoning.ts in your project (or in the plugins/ folder of your global OpenCode config directory). Change providerID to your provider's ID if it isn't mistral-custom:
Activity
opencodejr commentedon Nov 7, 2026
Thanks for the clear write-up and the repro!
In short, you're asking for a compatibility option (e.g.
compatibility.sendReasoning: false) so OpenCode stops sending any reasoning field on earlier assistant messages. That would make strict OpenAI-compatible endpoints likeapi.mistral.aiwork with reasoning models. The maintainers will consider it.A note on why you get the empty field: OpenCode switches
requireReasoningon by default for any model whose ID containsdeepseek. Sodeepseek-v4-1-flash-1017gets an emptyreasoning_content: ""even when the endpoint is Mistral, which matches the"input": ""in your 422. Setting"requireReasoning": falsein the model'scompatibilityshould drop the empty field. But when the model does return reasoning text, it is always sent back, and no setting turns that off yet.Until then, you can work around it with a small local plugin that removes reasoning fields from earlier assistant messages before the request goes out. Save this as
.opencode/plugins/strip-reasoning.tsin your project (or in theplugins/folder of your global OpenCode config directory). ChangeproviderIDto your provider's ID if it isn'tmistral-custom:This code type-checks against the v2 plugin API, but I haven't run it against Mistral, so please let us know if it doesn't fix the 422.
Related issues:
reasoning_contenton every earlier assistant message