Skip to main content
MiniMax-M3.1-Flash natively supports Interleaved Thinking, enabling it to reason between each round of tool interactions. Before every Tool Use, the model reflects on the current environment and the tool outputs to decide its next action. This ability allows the model to excel at long-horizon and complex tasks, achieving state-of-the-art (SOTA) results on benchmarks such as SWE, BrowseCamp, and xBench, which test both coding and agentic reasoning performance. In the following examples, we’ll illustrate best practices for Tool Use and Interleaved Thinking with MiniMax-M3.1-Flash. The key principle is to return the model’s full response each time—especially the thinking fields (thinking / reasoning_content).

Parameters

Request Parameters

  • tools: Defines the list of callable functions, including function names, descriptions, and parameter schemas

Response Parameters

Key fields in Tool Use responses:
  • thinking / reasoning_content: The model’s thinking/reasoning process
  • text / content: The text content output by the model
  • tool_use / tool_calls: The tool calls the model has decided to make
  • name / function.name: The name of the function being called
  • input / function.arguments: Function call parameters (a JSON string in the OpenAI format)
  • id: Unique identifier for the tool call
MiniMax-M3.1-Flash thinks on demand: for simple tool calls, the model may call the tool directly without producing thinking content, in which case that turn has no thinking block or reasoning_content field. Check whether the field exists before reading it, and always append the full returned message to the history whether or not it contains thinking.

Important Note

In multi-turn function call conversations, the complete model response (i.e., the assistant message) must be appended to the conversation history to maintain the continuity of the reasoning chain. OpenAI SDK:
  • Append the full response_message object (including the reasoning_content and tool_calls fields) to the message history
  • The model’s thinking is returned in the reasoning_content field and must be kept when passing the message back
Anthropic SDK:
  • Append the full response.content list to the message history (includes all content blocks: thinking/text/tool_use)
See examples below for implementation details.

Examples

Anthropic SDK

Configure Environment Variables

Example

Output:
Response of the first request

OpenAI SDK

Configure Environment Variables

Example

When calling MiniMax-M3.1-Flash via the OpenAI SDK, the thinking content is returned in the reasoning_content field and can be displayed directly.
Important: To ensure that Interleaved Thinking works properly and the model’s chain of thought remains uninterrupted, the entire response_message, including reasoning_content, must be kept in the message history and passed back to the model in the next request. This is essential for achieving the model’s best performance.
Pay attention to how the send_messages function makes the request and parses the response, and to how the history is appended with messages.append(response_message):
Output:
Response of the first request

MiniMax-M3.1-Flash for AI Coding Tools

MiniMax-M3.1-Flash excels at code understanding, dialogue, and reasoning.

Text Generation

Supports text generation via compatible Anthropic API and OpenAI API.

Compatible Anthropic API (Recommended)

Use Anthropic SDK with MiniMax models

Compatible OpenAI API

Use OpenAI SDK with MiniMax models