MiniMax-M3.1-Flash 在每轮工具交互之间支持交错思考;应用必须把模型返回的完整 assistant 消息连同 thinking / reasoning_content 和工具调用字段一起放回历史,再提交工具结果。
适合的任务:需要多轮工具调用、根据工具结果继续决策的 Agent 工作流,例如天气查询、检索、代码执行和外部 API 操作。
不适合的任务:只需要一次文本生成、且应用无法保存完整多轮消息历史的调用流程。
适用的模型版本:MiniMax-M3.1-Flash。官方页面明确以该型号说明工具调用和交错思考;不要据此外推其他 MiniMax 型号。
适用的客户端、Agent 或 API:MiniMax 兼容 Anthropic API 与 OpenAI API;示例使用 Anthropic SDK 和 OpenAI SDK。
推荐的推理档位和参数:官方工具调用页未注明固定 effort / reasoning_effort 值。Anthropic 示例使用 max_tokens: 4096;OpenAI 示例未注明输出上限、温度、top_p 或其他采样参数。
| 位置 | 字段 | 用途 |
|---|---|---|
| 请求 | tools | 定义函数名、描述和参数 schema |
| Anthropic 响应 | thinking、text、tool_use | 分别表示思考、文本和工具调用 content block |
| OpenAI 响应 | reasoning_content、content、tool_calls | 分别表示思考、文本和工具调用 |
| 工具调用 | name / function.name | 被调用的函数名 |
| 工具调用 | input / function.arguments | 工具参数;OpenAI 示例中是 JSON 字符串 |
| 工具调用 | id / tool_call_id | 将工具结果关联回本次调用 |
简单工具调用可能没有 thinking 或 reasoning_content。应用应先检查字段是否存在,但无论是否存在思考字段,都要追加完整的模型消息。
下面保留官方示例中的模型、工具 schema、max_tokens 和消息闭环:
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)官方示例的 Anthropic 兼容地址为:
export ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic
export ANTHROPIC_API_KEY=${YOUR_API_KEY}OpenAI 兼容响应中,工具参数从 function.arguments 解析;完整 response_message 必须原样放回历史:
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)官方示例的 OpenAI 兼容地址为:
export OPENAI_BASE_URL=https://api.minimax.io/v1
export OPENAI_API_KEY=${YOUR_API_KEY}将模型固定为 MiniMax-M3.1-Flash,按 SDK 选择官方兼容地址。
用 tools 声明函数名、描述、参数类型和必填字段;示例工具为 get_weather(location: string)。
发送用户消息,读取返回的文本、思考字段和工具调用字段。简单调用可能没有思考字段。
如果存在工具调用,先执行对应函数,再把完整的 assistant 响应放回消息历史:Anthropic 保留 response.content 全部 blocks;OpenAI 保留完整 response_message。
用原始调用 ID 关联工具结果:Anthropic 使用 tool_use_id,OpenAI 使用 tool_call_id。
将工具结果加入历史后再次请求模型,读取最终答复;如果还有工具调用,重复步骤 4–6。
在生产环境记录消息结构和调用 ID,检查是否因为序列化、字段过滤或只保存 content 而丢失思考与工具调用上下文。
sequenceDiagram
participant U as 用户
participant M as MiniMax-M3.1-Flash
participant A as 应用
participant T as 外部工具
U->>A: 用户请求
A->>M: messages + tools
M-->>A: thinking/reasoning_content + text + tool call
A->>A: 保存完整 assistant 响应
A->>T: 执行函数
T-->>A: tool result
A->>M: 原始 assistant 响应 + tool result
M-->>A: 最终答复或下一次 tool call
A-->>U: 输出结果页面明确称 MiniMax-M3.1-Flash 是具备工具调用能力的 Agentic Model,并原生支持 Interleaved Thinking。
页面说明模型会在每次工具调用前结合当前环境和工具输出决定下一步;页面没有提供独立复现实验、样本量或性能数字。
Anthropic 示例的请求参数为 model: "MiniMax-M3.1-Flash"、max_tokens: 4096、messages 和 tools。
OpenAI 示例使用 model: "MiniMax-M3.1-Flash"、messages 和 tools,返回 tool_calls,工具参数位于 function.arguments。
官方示例展示的工具结果为 24℃, sunny,这是演示值,不是实时天气数据。
页面未注明作者、发布日期、工具数量上限、参数 schema 限制、超时、重试、并行工具调用策略、成本或限流。
交错思考依赖完整上下文。删除 thinking、reasoning_content、tool_calls、tool_use 或其 ID 后继续请求,官方页面没有保证推理链仍能连续。
“完整消息”指 SDK 返回的 assistant 响应对象或全部 content blocks;不能只保留最终文本。
没有工具调用时也要按实际响应追加完整消息;不能假设每轮都会返回思考字段。
官方页没有规定是否可把思考内容展示给终端用户、日志应保存多久或如何脱敏;这些属于应用侧的隐私和日志策略。
Anthropic 与 OpenAI 的工具结果消息结构不同,不能直接混用;应按对应 SDK 的字段和角色格式实现。
本页没有提供独立的完整 prompt,因此本文归类为 workflow,不宣称存在可复制的模型专属 prompt。
2026-10-21 通过 Tabbit 任务 M31 prompt02 tools 打开并检查原始页面。页面正文、代码块、字段说明和导航链接均可见;证据保存于 /tmp/m31-tools-evidence.txt。
可继续采集的官方文档:
MiniMax M3.1 Flash