Messages API
使用 Anthropic API 兼容 Messages 格式调用 MiniMax 模型。
MiniMax-M3核心能力:Coding/Agentic SOTA、1M 超长上下文、多模态。MiniMax-M3 新特性:- 支持图片、视频理解,可参考右方示例代码
- 支持通过
thinking参数控制思考
授权
Bearer API Key 鉴权。发送 Authorization: Bearer <API_KEY>。如果 Authorization 和 x-api-key 同时存在,优先使用 Authorization。
请求头
请求体的媒介类型,请设置为 application/json,确保请求数据的格式为 JSON
application/json 请求体
模型 ID。MiniMax-M3 是多模态模型,原生支持文本、图片和视频输入,并兼容工具调用与 thinking 内容块;M2.7、M2.5、M2.1 和 M2 系列仅支持文本与工具调用,不支持图片和视频输入。
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 支持文本、图片、视频、工具调用、工具结果和 thinking 内容块。M2.7、M2.5、M2.1 和 M2 系列仅支持文本与工具调用相关内容块,不支持图片和视频输入。
Show child attributes
Show child attributes
设置模型角色与行为。
是否使用流式传输,默认为 false。设置为 true 后,响应将分批返回
指定生成内容长度的上限(Token 数)。MiniMax-M3 推荐值为 131072(128K),上限为 524288(512K);其他模型推荐值为 65536(64K),上限为 204800(200K)。超过上限的内容会被截断。如果生成因 length 原因中断,请尝试调高此值
x >= 1温度系数,影响输出随机性,取值范围 [0, 2],默认值为 1。值越高,输出越随机;值越低,输出越确定。
0 <= x <= 2核采样参数,取值范围 [0, 1]。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
控制 MiniMax-M3 thinking。省略时默认关闭 thinking,响应不会包含 thinking 块。对于 M2.x 模型,thinking 无法关闭。
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
此页面对您有帮助吗?