This ability allows M3 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 M3. The key principle is to return the model’s full response each time—especially the internal reasoning fields (e.g., thinking or reasoning_details).
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_details: The model’s thinking/reasoning processtext/content: The text content output by the modeltool_calls: Contains information about functions the model has decided to invokefunction.name: The name of the function being calledfunction.arguments: Function call parameters (JSON string format)id: Unique identifier for the tool call
Important Note
In multi-turn function call conversations, the complete model response (i.e., the assistant message) must be append to the conversation history to maintain the continuity of the reasoning chain. OpenAI SDK:- Append the full
response_messageobject (including thetool_callsfield) to the message history- When using MiniMax-M3, the
contentfield contains<think>tags which will be automatically preserved - In the Interleaved Thinking Compatible Format, by using the additional parameter (
reasoning_split=True), the model’s thinking content is separated into thereasoning_detailsfield. This content also needs to be added to historical messages.
- When using MiniMax-M3, the
- Append the full
response.contentlist to the message history (includes all content blocks: thinking/text/tool_use)
Examples
Anthropic SDK
Configure Environment Variables
For international users, usehttps://api.minimax.io/anthropic; for users in China, use https://api.minimaxi.com/anthropic
Example
OpenAI SDK
Configure Environment Variables
For international users, usehttps://api.minimax.io/v1; for users in China, use https://api.minimaxi.com/v1
Interleaved Thinking Compatible Format
When calling MiniMax-M3 via the OpenAI SDK, you can pass the extra parameterreasoning_split=True to get a more developer-friendly output format.
Important Note: To ensure that Interleaved Thinking functions properly and the model’s chain of thought remains uninterrupted, the entire
response_message — including the reasoning_details field — must be preserved in the message history and passed back to the model in the next round of interaction.This is essential for achieving the model’s best performance.send_messages) is implemented, as well as how you append the historical messages with messages.append(response_message).
OpenAI Native Format
Since the OpenAI ChatCompletion API native format does not natively support thinking return and pass-back, the model’s thinking is injected into thecontent field in the form of <think>reasoning_content</think>. Developers can manually parse it for display purposes. However, we strongly recommend developers use the Interleaved Thinking compatible format.
What extra_body={"reasoning_split": False} does:
- Embeds thinking in content: The model’s reasoning is wrapped in
<think>tags within thecontentfield - Requires manual parsing: You need to parse
<think>tags if you want to display reasoning separately
Important Reminder: If you choose to use the native format, please note that in the message history, do not modify the
content field. You must preserve the model’s thinking content completely, i.e., <think>reasoning_content</think>. This is essential to ensure Interleaved Thinking works effectively and achieves optimal model performance!Recommended Reading
M3 for AI Coding Tools
MiniMax-M3 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