curl --request POST \
--url https://api.minimax.cn/anthropic/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3.1-Flash",
"thinking": {
"type": "adaptive"
},
"messages": [
{
"role": "user",
"content": "9.11 和 9.9 哪个更大?"
}
],
"max_tokens": 4096,
"output_config": {
"effort": "max"
}
}
'{
"id": "066b367547c2650d17dc215f503da551",
"type": "message",
"role": "assistant",
"model": "MiniMax-M3.1-Flash",
"content": [
{
"thinking": "The user is asking which is larger: 9.11 or 9.9.\n\nComparing 9.11 and 9.9:\n9.9 = 9.90\n9.11 = 9.11\n\n9.90 > 9.11, so 9.9 is larger.",
"signature": "7564f4e0e54b5c08b380d0b800aeb5463ea050e546cec7722e08ef6e912f6c67",
"type": "thinking"
},
{
"text": "**9.9 更大。**\n\n比较方法很简单:将两个数的小数位数对齐后比较:\n\n- 9.11 = 9.**11**\n- 9.9 = 9.**90**\n\n因为 90 > 11,所以 **9.9 > 9.11**。\n\n这是一个常见的思维陷阱——虽然 11 看起来比 9 大,但在比较小数时,应该先比较整数部分(都是 9),然后再比较小数部分,而小数部分需要**补齐位数**后再比较。",
"type": "text"
}
],
"usage": {
"input_tokens": 13,
"output_tokens": 172,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 157
},
"stop_reason": "end_turn"
}消息生成
通过兼容 Anthropic Messages API 的接口调用 MiniMax 模型生成回复,支持流式与非流式。
curl --request POST \
--url https://api.minimax.cn/anthropic/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3.1-Flash",
"thinking": {
"type": "adaptive"
},
"messages": [
{
"role": "user",
"content": "9.11 和 9.9 哪个更大?"
}
],
"max_tokens": 4096,
"output_config": {
"effort": "max"
}
}
'{
"id": "066b367547c2650d17dc215f503da551",
"type": "message",
"role": "assistant",
"model": "MiniMax-M3.1-Flash",
"content": [
{
"thinking": "The user is asking which is larger: 9.11 or 9.9.\n\nComparing 9.11 and 9.9:\n9.9 = 9.90\n9.11 = 9.11\n\n9.90 > 9.11, so 9.9 is larger.",
"signature": "7564f4e0e54b5c08b380d0b800aeb5463ea050e546cec7722e08ef6e912f6c67",
"type": "thinking"
},
{
"text": "**9.9 更大。**\n\n比较方法很简单:将两个数的小数位数对齐后比较:\n\n- 9.11 = 9.**11**\n- 9.9 = 9.**90**\n\n因为 90 > 11,所以 **9.9 > 9.11**。\n\n这是一个常见的思维陷阱——虽然 11 看起来比 9 大,但在比较小数时,应该先比较整数部分(都是 9),然后再比较小数部分,而小数部分需要**补齐位数**后再比较。",
"type": "text"
}
],
"usage": {
"input_tokens": 13,
"output_tokens": 172,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 157
},
"stop_reason": "end_turn"
}MiniMax-M3.1-Flash核心能力:1M 超长上下文、多模态、思考深度可调。MiniMax-M3.1-Flash 新特性:- 支持图片、视频理解,可参考右方示例代码
- 支持通过
output_config.effort调节思考深度,可取low、medium、high、xhigh、max,默认档位为max - 深度思考默认开启,无需额外配置;思考内容通过
thinking内容块单独返回
授权
Bearer API Key 鉴权。发送 Authorization: Bearer <API_KEY>。如果 Authorization 和 x-api-key 同时存在,优先使用 Authorization。
请求头
请求体的媒介类型,请设置为 application/json,确保请求数据的格式为 JSON
application/json 请求体
模型 ID。MiniMax-M3.1-Flash 和 MiniMax-M3 是多模态模型,原生支持文本、图片和视频输入,并兼容工具调用与 thinking 内容块;MiniMax-M3.1-Flash 还会强制开启 thinking,并支持通过 output_config.effort 调节思考深度。
MiniMax-M3.1-Flash, MiniMax-M3 对话历史。MiniMax-M3.1-Flash 和 MiniMax-M3 支持文本、图片、视频、工具调用、工具结果和 thinking 内容块。
Show child attributes
Show child attributes
设置模型角色与行为。
是否使用流式传输,默认为 false。设置为 true 后,响应将分批返回
指定生成内容长度的上限(Token 数)。MiniMax-M3.1-Flash 和 MiniMax-M3 推荐值为 131072(128K),上限为 524288(512K)。超过上限的内容会被截断。如果生成因 length 原因中断,请尝试调高此值
x >= 1暂不支持指定,传入的值不会生效。MiniMax-M3.1-Flash 和 MiniMax-M3 固定使用 1。
暂不支持指定,传入的值不会生效。MiniMax-M3.1-Flash 和 MiniMax-M3 固定使用 0.95。若传入,取值需在 (0, 1] 范围内。
0 < x <= 1Anthropic 兼容工具调用的工具定义。
Show child attributes
Show child attributes
工具选择策略。仅支持 auto,由模型自动判断是否调用工具。
Show child attributes
Show child attributes
控制 thinking 行为。默认值随模型不同,因此未在 schema 层声明统一默认值。
MiniMax-M3.1-Flash:强制开启 thinking。若传入type只能为adaptive;传入disabled会返回 HTTP 400。如需调节思考深度,请使用output_config.effort。MiniMax-M3:省略thinking时默认关闭;传入adaptive可开启并返回 thinking 块。
Show child attributes
Show child attributes
输出配置。通过 effort 调节 MiniMax-M3.1-Flash 的思考深度。
Show child attributes
Show child attributes
请求元信息。建议对 to-C 业务传入 user_id,便于按终端用户聚合限流和计费分析。
Show child attributes
Show child attributes
响应
本次响应的唯一 ID
对象类型,固定为 message
message 角色,固定为 assistant
assistant 本次请求使用的模型 ID
响应内容块列表
Show child attributes
Show child attributes
模型停止生成的原因:
- end_turn:模型自然结束
- max_tokens:达到 max_tokens 限制
- tool_use:模型请求工具调用
- pause_turn:服务端工具(如 web_search)的调用次数达到上限,本轮暂停。将返回的 content 作为 assistant 消息追加后再次请求即可继续
end_turn, max_tokens, tool_use, pause_turn 本次请求的 token 用量,包含适用时的 prompt cache 用量。
Show child attributes
Show child attributes
此页面对您有帮助吗?