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 processtext/content: The text content output by the modeltool_use/tool_calls: The tool calls the model has decided to makename/function.name: The name of the function being calledinput/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_messageobject (including thereasoning_contentandtool_callsfields) to the message history - The model’s thinking is returned in the
reasoning_contentfield and must be kept when passing the message back
- Append the full
response.contentlist to the message history (includes all content blocks: thinking/text/tool_use)
Examples
Anthropic SDK
Configure Environment Variables
Example
OpenAI SDK
Configure Environment Variables
Example
When calling MiniMax-M3.1-Flash via the OpenAI SDK, the thinking content is returned in thereasoning_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.send_messages function makes the request and parses the response, and to how the history is appended with messages.append(response_message):
Recommended Reading
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