MiniMax-M2 reasoning content not properly handled in OpenAI-compatible mode, should we support this ? #2352

Closed
opened 2026-02-16 17:35:16 -05:00 by yindo · 5 comments
Owner

Originally created by @zerogog on GitHub (Oct 29, 2025).

Question

Title: MiniMax-M2 reasoning content not properly handled in OpenAI-compatible mode

I configured and tested the "MiniMax-M2" model in opencode, but it appears to not be working correctly without any error messages.

Here's my configuration:

{
  "minimax": {
    "npm": "@ai-sdk/openai-compatible",
    "name": "MiniMax",
    "options": {
      "baseURL": "https://api.minimax.io/v1"
    },
    "models": {
      "MiniMax-M2": {
        "name": "MiniMax-M2",
        "reasoning": true,
        "tool_call": true,
        "limit": {
          "context": 204800,
          "output": 131100
        }
      }
    }
  }
}

Here's the API documentation.

After testing, I discovered the issue. The API returns reasoning content wrapped in think tags within delta.content instead of placing it in delta.reasoning_content:

[
  {
    index: 0,
    delta: {
      content: '</think>
I'm',
      role: 'assistant',
      name: 'MiniMax AI',
      audio_content: '',
      reasoning_content: ''
    }
  }
]

As you can see, the reasoning content is wrapped in "think" tags in delta.content rather than being placed in delta.reasoning_content.

I can fix this by adding functions to handle the message processing, but should this be necessary? Does this behavior align with the OpenAI API specification?

Originally created by @zerogog on GitHub (Oct 29, 2025). ### Question **Title: MiniMax-M2 reasoning content not properly handled in OpenAI-compatible mode** I configured and tested the "MiniMax-M2" model in opencode, but it appears to not be working correctly without any error messages. Here's my configuration: ```json { "minimax": { "npm": "@ai-sdk/openai-compatible", "name": "MiniMax", "options": { "baseURL": "https://api.minimax.io/v1" }, "models": { "MiniMax-M2": { "name": "MiniMax-M2", "reasoning": true, "tool_call": true, "limit": { "context": 204800, "output": 131100 } } } } } ``` Here's the [API documentation](https://platform.minimax.io/docs/guides/text-generation#compatible-openai-api). After testing, I discovered the issue. The API returns reasoning content wrapped in `think` tags within `delta.content` instead of placing it in `delta.reasoning_content`: ```text [ { index: 0, delta: { content: '</think> I'm', role: 'assistant', name: 'MiniMax AI', audio_content: '', reasoning_content: '' } } ] ``` As you can see, the reasoning content is wrapped in "think" tags in `delta.content` rather than being placed in `delta.reasoning_content`. I can fix this by adding functions to handle the message processing, but should this be necessary? Does this behavior align with the OpenAI API specification?
yindo closed this issue 2026-02-16 17:35:16 -05:00
Author
Owner

@rekram1-node commented on GitHub (Oct 29, 2025):

if reasoning parts are returned in content chunks instead of actual reasoning chunks then it isnt following the spec

@rekram1-node commented on GitHub (Oct 29, 2025): if reasoning parts are returned in content chunks instead of actual reasoning chunks then it isnt following the spec
Author
Owner

@whoisjeremylam commented on GitHub (Oct 29, 2025):

MiniMax-M2 is an 'interleaved thinking model', which requires the thinking content to be added to the context. See the model card on HuggingFace: https://huggingface.co/MiniMaxAI/MiniMax-M2.

@whoisjeremylam commented on GitHub (Oct 29, 2025): MiniMax-M2 is an 'interleaved thinking model', which requires the thinking content to be added to the context. See the model card on HuggingFace: https://huggingface.co/MiniMaxAI/MiniMax-M2.
Author
Owner

@rekram1-node commented on GitHub (Oct 29, 2025):

i think the ai sdk may provide some utility to automatically parse the reasoning chunjs for these types of models

@rekram1-node commented on GitHub (Oct 29, 2025): i think the ai sdk may provide some utility to automatically parse the reasoning chunjs for these types of models
Author
Owner

@zerogog commented on GitHub (Oct 29, 2025):

MiniMax-M2 is an 'interleaved thinking model', which requires the thinking content to be added to the context. See the model card on HuggingFace: https://huggingface.co/MiniMaxAI/MiniMax-M2.

Good to know this.

@zerogog commented on GitHub (Oct 29, 2025): > MiniMax-M2 is an 'interleaved thinking model', which requires the thinking content to be added to the context. See the model card on HuggingFace: https://huggingface.co/MiniMaxAI/MiniMax-M2. Good to know this.
Author
Owner

@pascalandy commented on GitHub (Oct 30, 2025):

Works with this config:

    "minimax": {
      "npm": "@ai-sdk/anthropic",
      "options": {
        "baseURL": "https://api.minimax.io/anthropic/v1",
        "apiKey": "asdasdasdas"
      },
      "models": {
        "MiniMax-M2": {
          "name": "MiniMax-M2"
        }
      }
    },

but it gets 10K context window from a simple ping:

Image

@pascalandy commented on GitHub (Oct 30, 2025): Works with this config: ```json "minimax": { "npm": "@ai-sdk/anthropic", "options": { "baseURL": "https://api.minimax.io/anthropic/v1", "apiKey": "asdasdasdas" }, "models": { "MiniMax-M2": { "name": "MiniMax-M2" } } }, ``` but it gets 10K context window from a simple ping: ![Image](https://github.com/user-attachments/assets/7c7cde17-1704-4bee-8a67-38ff1690c061)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2352