curl --request POST \
--url https://api.minimaxi.com/anthropic/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "这张图片的内容是什么?"
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg"
}
}
]
}
],
"max_tokens": 500,
"thinking": {
"type": "adaptive"
}
}
'{
"id": "066a381bdc3c0ded310e27c9a46d16e7",
"type": "message",
"role": "assistant",
"model": "MiniMax-M3",
"content": [
{
"thinking": "The user is asking in Chinese what the content of the image is. I should describe the image in Chinese.",
"signature": "6b19dfedcc8d3e065eb0ebe4262efd4a69e3e73ad69eeb7e5e629e552c40f969",
"type": "thinking"
},
{
"text": "这张图片是一张温馨的儿童肖像照片,内容如下:\n\n**主体**:一个大约4-6岁的小女孩,有着棕色的卷曲长发和齐刘海,扎着蓬松的发型。她有一双大大的浅棕色(琥珀色)眼睛,长长的睫毛,粉嫩的嘴唇微微上扬,露出甜美自然的微笑。\n\n**服饰**:她穿着一件米白色或浅奶油色的连衣裙,领口和肩部有精致的蕾丝花边装饰,袖子是蓬松的荷叶边设计,整体风格显得优雅可爱。\n\n**光影与背景**:照片采用了柔和的暖色调光线,背景是朦胧的米灰色/暖灰色,营造出温馨柔和的氛围。光线从侧面打来,突出了她脸部的轮廓和头发的质感。\n\n**整体风格**:这是一张高质量的人像摄影作品,采用了浅景深的虚化效果(背景模糊),突出了小女孩纯真可爱的形象,画面充满童真与温暖感。",
"type": "text"
}
],
"usage": {
"input_tokens": 1209,
"output_tokens": 211,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 156
},
"stop_reason": "end_turn"
}Messages API
使用 Anthropic API 兼容 Messages 格式调用 MiniMax 模型。
curl --request POST \
--url https://api.minimaxi.com/anthropic/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "MiniMax-M3",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "这张图片的内容是什么?"
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg"
}
}
]
}
],
"max_tokens": 500,
"thinking": {
"type": "adaptive"
}
}
'{
"id": "066a381bdc3c0ded310e27c9a46d16e7",
"type": "message",
"role": "assistant",
"model": "MiniMax-M3",
"content": [
{
"thinking": "The user is asking in Chinese what the content of the image is. I should describe the image in Chinese.",
"signature": "6b19dfedcc8d3e065eb0ebe4262efd4a69e3e73ad69eeb7e5e629e552c40f969",
"type": "thinking"
},
{
"text": "这张图片是一张温馨的儿童肖像照片,内容如下:\n\n**主体**:一个大约4-6岁的小女孩,有着棕色的卷曲长发和齐刘海,扎着蓬松的发型。她有一双大大的浅棕色(琥珀色)眼睛,长长的睫毛,粉嫩的嘴唇微微上扬,露出甜美自然的微笑。\n\n**服饰**:她穿着一件米白色或浅奶油色的连衣裙,领口和肩部有精致的蕾丝花边装饰,袖子是蓬松的荷叶边设计,整体风格显得优雅可爱。\n\n**光影与背景**:照片采用了柔和的暖色调光线,背景是朦胧的米灰色/暖灰色,营造出温馨柔和的氛围。光线从侧面打来,突出了她脸部的轮廓和头发的质感。\n\n**整体风格**:这是一张高质量的人像摄影作品,采用了浅景深的虚化效果(背景模糊),突出了小女孩纯真可爱的形象,画面充满童真与温暖感。",
"type": "text"
}
],
"usage": {
"input_tokens": 1209,
"output_tokens": 211,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 156
},
"stop_reason": "end_turn"
}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
此页面对您有帮助吗?