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-Preview",
"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-Preview",
"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"
}Messages API
使用 Anthropic API 兼容 Messages 格式调用 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-Preview",
"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-Preview",
"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-Preview核心能力:1M 超长上下文、多模态、思考深度可调。暂时仅通过 Token Plan 和 MiniMax Code 提供。MiniMax-M3.1-Flash-Preview 新特性:- 支持图片、视频理解,可参考右方示例代码
- 支持通过
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-Preview 和 MiniMax-M3 是多模态模型,原生支持文本、图片和视频输入,并兼容工具调用与 thinking 内容块;MiniMax-M3.1-Flash-Preview 还会强制开启 thinking,并支持通过 output_config.effort 调节思考深度。M2.7、M2.5、M2.1 和 M2 系列仅支持文本与工具调用,不支持图片和视频输入。
MiniMax-M3.1-Flash-Preview, MiniMax-M3, MiniMax-M2.7, MiniMax-M2.7-highspeed, MiniMax-M2.5, MiniMax-M2.5-highspeed, MiniMax-M2.1, MiniMax-M2.1-highspeed, MiniMax-M2 对话历史。MiniMax-M3.1-Flash-Preview 和 MiniMax-M3 支持文本、图片、视频、工具调用、工具结果和 thinking 内容块。M2.7、M2.5、M2.1 和 M2 系列仅支持文本与工具调用相关内容块,不支持图片和视频输入。
Show child attributes
Show child attributes
设置模型角色与行为。
是否使用流式传输,默认为 false。设置为 true 后,响应将分批返回
指定生成内容长度的上限(Token 数)。MiniMax-M3.1-Flash-Preview 和 MiniMax-M3 推荐值为 131072(128K),上限为 524288(512K);其他模型推荐值为 65536(64K),上限为 204800(200K)。超过上限的内容会被截断。如果生成因 length 原因中断,请尝试调高此值
x >= 1温度系数,影响输出随机性,取值范围 [0, 2],默认值为 1。值越高,输出越随机;值越低,输出越确定。
0 <= x <= 2核采样参数,取值范围 [0, 1]。MiniMax-M3.1-Flash-Preview 和 MiniMax-M3 默认值为 0.95,M2.x 系列模型默认值为 0.9。
0 <= x <= 1Anthropic 兼容工具调用的工具定义。
Show child attributes
Show child attributes
工具选择策略。仅支持 auto 和 none。
Show child attributes
Show child attributes
控制 thinking 行为。默认值随模型不同,因此未在 schema 层声明统一默认值。
MiniMax-M3.1-Flash-Preview:强制开启 thinking。若传入type只能为adaptive;传入disabled会返回 HTTP 400。如需调节思考深度,请使用output_config.effort。MiniMax-M3:省略thinking时默认关闭;传入adaptive可开启并返回 thinking 块。- M2.x 模型:thinking 无法关闭,传入
disabled会被接收但不生效。
Show child attributes
Show child attributes
输出配置。通过 effort 调节 MiniMax-M3.1-Flash-Preview 的思考深度。
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:模型请求工具调用
end_turn, max_tokens, tool_use 本次请求的 token 用量,包含适用时的 prompt cache 用量。
Show child attributes
Show child attributes
此页面对您有帮助吗?