Repository navigation
Description
Client or integration
Other
Area
Streaming
Summary
Streaming a Mistral reasoning model through native /v1/chat/completions breaks OpenAI-compatible Chat clients. The native Chat lane relays Mistral's typed content arrays unchanged, but these clients expect delta.content to be a string.
Mistral's reasoning models put typed blocks in delta.content / message.content:
[{"type":"thinking","thinking":[{"type":"text","text":"..."}],"closed":true},{"type":"text","text":"..."}]The translated path already converts these blocks with chatContentEvents in src/adapters/openai-chat/response-events.ts, so /v1/responses and combo routes work. A plain key-auth openai-chat route to https://api.mistral.ai/v1 takes the native Chat lane instead, and nativeChatSse relays the arrays as-is. OpenCode's OpenAI-compatible parser then rejects the stream.
Expected: Chat string fields, as the translated path already produces: thinking in reasoning_content and text in content.
About the key: my key comes from a Mistral Vibe student plan, so I checked whether this is specific to that plan. It isn't:
- The provider uses the standard
https://api.mistral.ai/v1endpoint. - The providers guide already treats Studio and Vibe keys as one provider.
- Mistral's reasoning docs describe this chunk format for reasoning models in general, with no mention of key type or plan.
So a separate provider or login for Vibe keys wouldn't help; the fix belongs in the native relay.
Reproduction
- Configure a key-auth
openai-chatprovider withbaseUrl: "https://api.mistral.ai/v1", with no combo. - From an OpenAI-compatible Chat client (OpenCode 2.2.5 here), send
POST /v1/chat/completionswithstream: trueto a Mistral reasoning model, e.g.mistral/deepseek-v4-1-flash-1017ormistral/zai-glm-5-3. - The relayed chunks carry
delta.contentas an array ofthinking/textblocks. - OpenCode fails with
Invalid opencodex/openai-compatible-chat stream event(Expected string | null | undefined).
The same model through /v1/responses returns proper reasoning and answer text.
Version
2.97.0 (installed hub). The same code path is unchanged on dev at 250ef01.
Operating system
Hub: Ubuntu 24.04.5 LTS. Client: Arch-based Linux (Omarchy).
Provider and model
mistral / deepseek-v4-1-flash-1017 (also zai-glm-5-3 and zai-glm-5-3-flash)
Logs or error output
Error: Invalid opencodex/openai-compatible-chat stream event
SchemaError: Expected string | null | undefinedScreenshots and supporting files
No response
Redacted configuration
{
"providers": {
"mistral": {
"adapter": "openai-chat",
"baseUrl": "https://api.mistral.ai/v1",
"authMode": "key",
"apiKey": "<redacted>"
}
}
}Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
github-actions commentedon Nov 6, 2026
Automated translation bookkeeping — detected language: English.
lidge-jun commentedon Nov 7, 2026
Fixed on dev by #8278: #8278 (squash 05408a3). Verified the native Chat SSE/JSON and streaming/buffered combinations on current dev.