Skip to content

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

Closed

Description

@zerogog

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?

Activity

  1. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

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

  2. whoisjeremylam commented on Oct 30, 2025

    @whoisjeremylam

    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.

  3. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

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

  4. zerogog commented on Oct 30, 2025

    @zerogog
    Author

    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.

  5. pascalandy commented on Oct 30, 2025

    @pascalandy

    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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions