Skip to main content
M3 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 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 process
  • text/content: The text content output by the model
  • tool_calls: Contains information about functions the model has decided to invoke
  • function.name: The name of the function being called
  • function.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_message object (including the tool_calls field) to the message history
    • When using MiniMax-M3, the content field 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 the reasoning_details field. This content also needs to be added to historical messages.
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

For international users, use https://api.minimax.io/anthropic; for users in China, use https://api.minimaxi.com/anthropic

Example

Output:
Response Body

OpenAI SDK

Configure Environment Variables

For international users, use https://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 parameter reasoning_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.
Be sure to review how your API request and response handling function (e.g., send_messages) is implemented, as well as how you append the historical messages with messages.append(response_message).
Output:
Response Body

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 the content 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 the content field
  • 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!
Output:
Response Body

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