Skip to content

Native Chat passthrough relays Mistral typed content arrays, breaking OpenAI-compatible clients #8251

Closed

Description

@Masih-0x3

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/v1 endpoint.
  • 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

  1. Configure a key-auth openai-chat provider with baseUrl: "https://api.mistral.ai/v1", with no combo.
  2. From an OpenAI-compatible Chat client (OpenCode 2.2.5 here), send POST /v1/chat/completions with stream: true to a Mistral reasoning model, e.g. mistral/deepseek-v4-1-flash-1017 or mistral/zai-glm-5-3.
  3. The relayed chunks carry delta.content as an array of thinking/text blocks.
  4. 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 | undefined

Screenshots 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

  1. github-actions commented on Nov 6, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. added
    bug
    provider
    streaming
    on Nov 6, 2026
  3. lidge-jun commented on Nov 7, 2026

    @lidge-jun
    Owner

    Fixed on dev by #8278: #8278 (squash 05408a3). Verified the native Chat SSE/JSON and streaming/buffered combinations on current dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugproviderstreaming

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions