MiniMax-M3.1-Flash supports interleaved thinking between each round of tool interaction. The application must put the model's complete assistant message, including thinking / reasoning_content and tool-calling fields, back into the history before submitting the tool result.
Suitable tasks: Agent workflows that require multiple rounds of tool calling and continued decision-making based on tool results, such as weather queries, retrieval, code execution, and external API operations.
Unsuitable tasks: Call flows that only need one round of text generation and whose application cannot save the complete multi-turn message history.
Applicable model version: MiniMax-M3.1-Flash. The official page describes tool calling and interleaved thinking specifically for this model; do not extrapolate from it to other MiniMax models.
Applicable clients, agents, or APIs: MiniMax is compatible with the Anthropic API and OpenAI API; the examples use the Anthropic SDK and OpenAI SDK.
Recommended reasoning tiers and parameters: The official tool-calling page does not specify a fixed effort / reasoning_effort value. The Anthropic example uses max_tokens: 4096; the OpenAI example does not specify an output limit, temperature, top_p, or other sampling parameters.
| Location | Field | Purpose |
|---|---|---|
| Request | tools | Defines the function name, description, and parameter schema |
| Anthropic response | thinking, text, tool_use | Represent thinking, text, and tool-calling content blocks, respectively |
| OpenAI response | reasoning_content, content, tool_calls | Represent thinking, text, and tool calling, respectively |
| Tool call | name / function.name | Name of the called function |
| Tool call | input / function.arguments | Tool parameters; in the OpenAI example, this is a JSON string |
| Tool call | id / tool_call_id | Associates the tool result with this call |
A simple tool call may not include thinking or reasoning_content. The application should first check whether the fields exist, but it must append the model's complete message regardless of whether thinking fields are present.
The following preserves the model, tool schema, max_tokens, and message loop from the official example:
import anthropic
import json
client = anthropic.Anthropic()
tools = [
{
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first.",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, US",
}
},
"required": ["location"]
}
}
]
def send_messages(messages):
params = {
"model": "MiniMax-M3.1-Flash",
"max_tokens": 4096,
"messages": messages,
"tools": tools,
}
return client.messages.create(**params)
messages = [{"role": "user", "content": "How's the weather in San Francisco?"}]
response = send_messages(messages)
tool_use_blocks = [
block for block in response.content if block.type == "tool_use"
]
if tool_use_blocks:
# Preserve every returned block: thinking, text, and tool_use.
messages.append({"role": "assistant", "content": response.content})
tool_call = tool_use_blocks[0]
tool_result = "24℃, sunny" # Replace with the real tool result.
messages.append({
"role": "user",
"content": [{
"type": "tool_result",
"tool_use_id": tool_call.id,
"content": tool_result,
}]
})
final_response = send_messages(messages)The Anthropic-compatible endpoint in the official example is:
export ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic
export ANTHROPIC_API_KEY=${YOUR_API_KEY}In the OpenAI-compatible response, tool parameters are parsed from function.arguments; the complete response_message must be put back into the history unchanged:
import json
from openai import OpenAI
client = OpenAI()
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, US",
}
},
"required": ["location"],
},
},
},
]
def send_messages(messages):
response = client.chat.completions.create(
model="MiniMax-M3.1-Flash",
messages=messages,
tools=tools,
)
return response.choices[0].message
messages = [{"role": "user", "content": "How's the weather in San Francisco?"}]
response_message = send_messages(messages)
if response_message.tool_calls:
tool_call = response_message.tool_calls[0]
function_args = json.loads(tool_call.function.arguments)
# Preserve reasoning_content, content, and tool_calls together.
messages.append(response_message)
messages.append({
"role": "tool",
"tool_call_id": tool_call.id,
"content": "24℃, sunny", # Replace with the real tool result.
})
final_message = send_messages(messages)The OpenAI-compatible endpoint in the official example is:
export OPENAI_BASE_URL=https://api.minimax.io/v1
export OPENAI_API_KEY=${YOUR_API_KEY}Pin the model to MiniMax-M3.1-Flash and select the official compatible endpoint according to the SDK.
Use tools to declare the function name, description, parameter types, and required fields; the example tool is get_weather(location: string).
Send the user message and read the returned text, thinking fields, and tool-calling fields. A simple call may not include thinking fields.
If a tool call exists, execute the corresponding function first, then put the complete assistant response back into the message history: for Anthropic, preserve all blocks in response.content; for OpenAI, preserve the complete response_message.
Associate the tool result with the original call ID: Anthropic uses tool_use_id, while OpenAI uses tool_call_id.
Add the tool result to the history and request the model again to read the final answer; if there is another tool call, repeat steps 4–6.
In production, record the message structure and call IDs, and check whether serialization, field filtering, or saving only content causes the thinking and tool-calling context to be lost.
sequenceDiagram
participant U as User
participant M as MiniMax-M3.1-Flash
participant A as Application
participant T as External tool
U->>A: User request
A->>M: messages + tools
M-->>A: thinking/reasoning_content + text + tool call
A->>A: Save the complete assistant response
A->>T: Execute the function
T-->>A: tool result
A->>M: Original assistant response + tool result
M-->>A: Final answer or next tool call
A-->>U: Output resultThe page explicitly calls MiniMax-M3.1-Flash an Agentic Model with tool-calling capability and native support for Interleaved Thinking.
The page says the model decides what to do next before each tool call by combining the current environment with the tool output; it provides no independent reproduction experiment, sample size, or performance figures.
The Anthropic example uses the request parameters model: "MiniMax-M3.1-Flash", max_tokens: 4096, messages, and tools.
The OpenAI example uses model: "MiniMax-M3.1-Flash", messages, and tools, returns tool_calls, and places the tool parameters in function.arguments.
The tool result shown in the official example is 24℃, sunny; this is a demonstration value, not real-time weather data.
The page does not specify the author, publication date, tool-count limit, parameter schema restrictions, timeout, retry behavior, parallel tool-calling strategy, cost, or rate limits.
Interleaved thinking depends on the full context. After deleting thinking, reasoning_content, tool_calls, tool_use, or their IDs, the official page does not guarantee that the reasoning chain will remain continuous in subsequent requests.
“Complete message” means the assistant response object returned by the SDK or all content blocks; only the final text cannot be retained.
Even when there is no tool call, append the complete message from the actual response; do not assume that every round will include thinking fields.
The official page does not specify whether thinking content may be shown to end users, how long logs should be retained, or how they should be redacted; these are application-side privacy and logging policies.
Anthropic and OpenAI use different tool-result message structures, which cannot be mixed directly; implement them according to the fields and role format of the corresponding SDK.
This page does not provide a complete independent prompt, so this article is categorized as workflow and does not claim that a copyable model-specific prompt exists.
On 2026-10-21, the original page was opened and checked through the Tabbit task M31 prompt02 tools. The page body, code blocks, field descriptions, and navigation links were all visible; the evidence was saved to /tmp/m31-tools-evidence.txt.
Official documentation that can be collected next:
MiniMax M3.1 Flash