ModelSiteAPI

MiniMax 模型

minimax-m3 按场景的调用示例:思考开关、流式、工具调用、图片与视频输入、缓存、Anthropic 格式

MiniMax 通过 /v1/chat/completions 与 /v1/messages 两种格式调用。平台对请求体透传,由上游模型决定参数是否生效。本页按场景组织,场景划分参照 MiniMax 官方文档(OpenAI 兼容页、Anthropic 兼容页、文本生成指南:思考、工具调用、图片与视频输入),但是否支持以平台实际接入的上游为准,不以官方为准。

每个场景标注证据:

  • 已实测(线上测试账号,2026-10-19):用线上账号真实调用过,响应取自真实输出(id、时间戳已替换为占位符)。
  • 依官方文档(未实测):只对照了官方文档,没有真实请求确认。

支持的模型

平台模型 id说明上下文窗口最大输出能力标签
minimax-m3MiniMax-M3,编码与 Agent 场景,原生多模态(文本、图片、视频输入,不支持音频)1,000,000官方未标明对话、流式、视觉、工具调用、思考

官方说明 M3 支持 1M 上下文;输入超过 512K token 的请求按高一档的价格计费。官方模型页没有给出 M3 的最大输出 token 数,平台模型库里也未设置该值,请用 max_completion_tokens 自行控制输出长度;思考 token 计入输出上限,值太小可能只有思考没有正文(Anthropic 格式下表现为 stop_reason: "max_tokens" 且没有文本)。

平台不会替你开启或关闭思考。平台不会默认注入 thinking、reasoning_effort 或 temperature。唯一的例外是 reasoning_split:你没传时平台自动加 reasoning_split: true,让思考内容出现在 reasoning_content 字段而不是混在 content 里的 <think> 标签中;它只改变思考内容放在哪,不会开启思考。实测不传 thinking 时 minimax-m3 默认就在思考。

场景总览

场景官方是否提供我们的情况示例
基础对话是支持思考开关与基础对话
思考:默认开启并返回 reasoning_content是支持工具调用、Anthropic 格式 的响应
思考:关闭(thinking: disabled)是(M3 可关闭)支持思考开关与基础对话
思考:thinking: adaptive是部分支持:依赖尚未发布的更新,未实测思考开关与基础对话 注意事项
流式输出是部分支持:同一条管线,MiniMax 上未单独实测流式输出
工具调用与交错思考是支持:第一轮已实测,回传工具结果的第二轮依官方(未实测)工具调用
图片输入是支持图片与视频输入
视频输入是部分支持:依官方文档,未实测图片与视频输入
缓存官方定价页有缓存命中价,指南页未说明部分支持:实测会自动命中,但平台能力标签没有缓存,不承诺缓存
Anthropic 格式调用是(官方推荐入口)支持;thinking 只接受 adaptive / disabled,传 enabled 返回 400Anthropic 格式
Token 计数(/v1/messages/count_tokens)是部分支持:平台有此入口,MiniMax 上未实测见 Messages 页
思考强度 reasoning_effort / output_config.effort官方只适用于 M3.1-Flash不适用:minimax-m3 不要使用无
结构化输出(JSON 模式)官方没有提供未验证:不要依赖 response_format无
音频输入官方不支持不支持无
文件接口(mm_file://)是未接入无
快速档位(service_tier: priority)是(1.5 倍价格)不支持:平台不会把该字段转给上游,传了也不生效无
M3.1-Flash 等其他 MiniMax 模型是未接入:平台只接入了 minimax-m3无

思考开关与基础对话

证据:已实测(线上测试账号,2026-10-19),minimax-m3,OpenAI 格式,thinking: disabled。

何时用:简单问答、需要低延迟和少 token 时关闭思考。thinking 官方取值是 adaptive 或 disabled;M3 设为 disabled 时直接回答、不思考。不传 thinking 时 M3 默认就思考(见工具调用里的响应)。thinking 不是 OpenAI 标准字段,Python SDK 放进 extra_body。

请求

from openai import OpenAI

client = OpenAI(base_url="https://api.modelsite.ai/v1", api_key="sk-ms-xxxxxxxx")

# 关闭思考
resp = client.chat.completions.create(
    model="minimax-m3",
    messages=[{"role": "user", "content": "用一句话解释量子纠缠"}],
    max_tokens=300,
    extra_body={"thinking": {"type": "disabled"}},
)
print(resp.choices[0].message.content)

# 不传 thinking:默认思考,思考内容在 reasoning_content
resp = client.chat.completions.create(
    model="minimax-m3",
    messages=[{"role": "user", "content": "用一句话解释量子纠缠"}],
    max_tokens=1500,
)
msg = resp.choices[0].message
print(getattr(msg, "reasoning_content", None))  # 思考过程
print(msg.content)                              # 最终回答

响应(关闭思考):没有 reasoning_content,reasoning_tokens 为 0。

{
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "量子纠缠是指两个或多个粒子在某种特殊状态下,即使相隔很远,它们的量子属性也会瞬间关联,测量其中一个会立即决定另一个的状态。",
        "refusal": null
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1760000000,
  "id": "xxxxxxxx",
  "model": "minimax-m3",
  "object": "chat.completion",
  "output_sensitive_int": 0,
  "service_tier": "standard",
  "usage": {
    "completion_tokens": 30,
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens": 168,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "total_tokens": 198
  }
}

注意事项

  • thinking: {"type": "adaptive"}(依赖尚未发布的更新,未实测):官方用它显式开启思考。目前线上会丢弃 adaptive 取值,更新发布后才会转发给 MiniMax;在此之前不传 thinking 即默认思考。
  • reasoning_split:官方 true 时思考内容放在 reasoning_content,false 时以 <think> 标签留在 content 里。平台默认替你加 true;如果你自己传 false,平台尊重你的值,但不会解析响应里的 <think> 标签,会原样出现在 content。
  • 响应里的 reasoning_details 是该上游附带的结构化思考内容,与 reasoning_content 同源。
  • 采样:temperature 范围 [0, 2]、默认并推荐 1,超出范围上游会报错;top_p 范围 [0, 1],M3 默认 0.95;n 只支持 1;presence_penalty、frequency_penalty、logit_bias 被忽略。平台不做范围校验。
  • max_completion_tokens 为官方推荐的新写法,max_tokens 为旧写法,思考 token 同样计入。

流式输出

证据:依官方文档(未实测);流式管线与 DeepSeek、GLM 页的实测响应一致。

何时用:边生成边显示。传 stream: true;思考在 delta.reasoning_content,回答在 delta.content。

请求

from openai import OpenAI

client = OpenAI(base_url="https://api.modelsite.ai/v1", api_key="sk-ms-xxxxxxxx")

stream = client.chat.completions.create(
    model="minimax-m3",
    messages=[{"role": "user", "content": "数到五,用逗号分隔。"}],
    max_tokens=1000,
    stream=True,
)
reasoning, content = "", ""
for chunk in stream:
    if not chunk.choices:
        continue
    d = chunk.choices[0].delta
    if getattr(d, "reasoning_content", None):
        reasoning += d.reasoning_content
    elif d.content:
        content += d.content
print(content)

响应:SSE 数据块的结构与其他模型相同(见 DeepSeek 页的流式响应),最后带 usage。

注意事项

  • 流式请求没传 stream_options 时,网关自动加 include_usage。
  • 历史上 MiniMax 默认把思考以 <think> 标签内联在 content 里;平台默认加了 reasoning_split: true 避免这一点,流式同样适用。

工具调用

证据:已实测(线上测试账号,2026-10-19),minimax-m3,只测了第一轮(模型返回工具调用,默认思考);回传工具结果的第二轮依官方文档(未实测)。

何时用:Agent、让模型决定调用你定义的函数。模型本身不执行函数:返回 tool_calls,你的代码执行后把结果以 role: "tool" 消息(带对应 tool_call_id)放回历史再请求。

第一轮请求

from openai import OpenAI

client = OpenAI(base_url="https://api.modelsite.ai/v1", api_key="sk-ms-xxxxxxxx")

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, CA"}},
            "required": ["location"],
        },
    },
}]
messages = [{"role": "user", "content": "How is the weather in Hangzhou?"}]
resp = client.chat.completions.create(
    model="minimax-m3", messages=messages, tools=tools, max_tokens=1500,
)
msg = resp.choices[0].message
messages.append(msg)  # 把带 tool_calls 的 assistant 消息放回历史

第一轮响应:finish_reason 为 tool_calls,思考内容同时出现在 reasoning_content 与 reasoning_details,content 为 null。

{
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "refusal": null,
        "tool_calls": [
          {
            "id": "call_xxxx",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"location\": \"Hangzhou, Zhejiang\"}"
            }
          }
        ],
        "reasoning_content": "The user is asking about the weather in Hangzhou. The tool requires both location (as city and state format) and unit parameters. Hangzhou is a city in China, in Zhejiang province. I'll call the weather function for Hangzhou.",
        "reasoning_details": [
          {
            "type": "reasoning.text",
            "text": "The user is asking about the weather in Hangzhou. The tool requires both location (as city and state format) and unit parameters. Hangzhou is a city in China, in Zhejiang province. I'll call the weather function for Hangzhou.",
            "id": "reasoning-text-1",
            "format": "MiniMax-response-v1",
            "index": 0
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ],
  "created": 1760000000,
  "id": "xxxxxxxx",
  "model": "minimax-m3",
  "object": "chat.completion",
  "output_sensitive_int": 0,
  "service_tier": "standard",
  "usage": {
    "completion_tokens": 81,
    "completion_tokens_details": {
      "reasoning_tokens": 48,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens": 435,
    "prompt_tokens_details": {
      "cached_tokens": 203
    },
    "total_tokens": 516
  }
}

第二轮(依官方文档,未实测):官方要求多轮工具调用时,把包含 tool_calls 的完整 assistant 回复(含思考内容)追加回历史,思考内容必须完整保留,再追加 role: "tool" 的结果。

for call in msg.tool_calls:
    messages.append({"role": "tool", "tool_call_id": call.id, "content": "24℃, cloudy"})
resp = client.chat.completions.create(
    model="minimax-m3", messages=messages, tools=tools, max_tokens=1500,
)
print(resp.choices[0].message.content)

注意事项

  • 平台会把历史 assistant 消息里的 reasoning_content(以及 reasoning_details)原样转发给上游;Anthropic 格式下历史里的 thinking 内容块会转成 reasoning_content。你的客户端要把上一轮的完整 assistant 消息放回历史,平台不会凭空补出没保存的内容。
  • tools 官方支持;tool_choice 官方 Anthropic 兼容页写完整支持,OpenAI 兼容页没有说明,OpenAI 格式下是否生效未验证;已弃用的 function_call 不支持。
  • Anthropic 格式 tool_choice: {"type": "none"} 转成 tool_choice: "none",disable_parallel_tool_use: true 转成 parallel_tool_calls: false。

图片与视频输入

证据:图片已实测(线上测试账号,2026-10-19),minimax-m3;视频依官方文档(未实测)。

何时用:看图问答、截图分析。图片放在 content 数组里,用 image_url 块,url 是公网 URL 或 Base64 Data URL。官方说明支持文本、图片、视频输入,不支持音频。

图片请求(一张纯红色 64x64 PNG)

import base64
from openai import OpenAI

client = OpenAI(base_url="https://api.modelsite.ai/v1", api_key="sk-ms-xxxxxxxx")

b64 = base64.b64encode(open("red.png", "rb").read()).decode()
resp = client.chat.completions.create(
    model="minimax-m3",
    messages=[{"role": "user", "content": [
        {"type": "text", "text": "这张图是什么颜色?一句话。"},
        {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
    ]}],
    max_tokens=1500,
)
print(resp.choices[0].message.content)

响应(模型把纯红色描述成「深红色」,视觉理解的细节不能当精确值用)

{
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "这张图是深红色(暗红/酒红色)的纯色背景。",
        "refusal": null,
        "reasoning_content": "The user is asking about the color in the image. The image appears to be a solid dark red/maroon color. I need to answer in one sentence in Chinese.",
        "reasoning_details": [
          {
            "type": "reasoning.text",
            "text": "The user is asking about the color in the image. The image appears to be a solid dark red/maroon color. I need to answer in one sentence in Chinese.",
            "id": "reasoning-text-1",
            "format": "MiniMax-response-v1",
            "index": 0
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1760000000,
  "id": "xxxxxxxx",
  "model": "minimax-m3",
  "object": "chat.completion",
  "output_sensitive_int": 0,
  "service_tier": "standard",
  "usage": {
    "completion_tokens": 54,
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens": 201,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "total_tokens": 255
  }
}

视频输入(依官方文档,未实测):用 video_url 内容块,官方支持 MP4、AVI、MOV、MKV,URL 或 Base64 单个不超过 50 MB,fps 范围 0.2 到 5(默认 1)。官方的文件接口 mm_file:// 平台未接入。视频的传入方式与大小限制平台没有验证,请先用短样例验证。

注意事项

  • 官方图片限制:JPEG、PNG、GIF、WEBP,单张不超过 10 MB;image_url 可选 detail(low / default / high)与 max_long_side_pixel;请求体最大 64 MB。官方给的 token 消耗只是粗略值,以响应 usage 为准。
  • 图片与视频输入只适用于 M3 / M3.1-Flash;平台与上游网关另有请求体大小上限,大图请先小规模实测。

缓存

证据:已实测(线上测试账号,2026-10-19):多次请求的 usage 里都出现了命中。

何时用:多轮对话、重复的系统提示或长文档。没有请求参数控制缓存,命中是自动的、不保证的。

怎么看是否命中:OpenAI 格式看 usage.prompt_tokens_details.cached_tokens,Anthropic 格式看 usage.cache_read_input_tokens。上面「关闭思考」那次请求的 usage 里 prompt_tokens 为 168,其中 cached_tokens 为 128:

{
  "usage": {
    "completion_tokens": 30,
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens": 168,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "total_characters": 0,
    "total_tokens": 198
  }
}

注意事项

  • 官方定价页有缓存命中价,平台价格表里也有缓存命中这一计价项;但平台模型库里没有缓存能力标签,命中情况只以响应的 cached_tokens 为准,没命中就按普通输入价计费,不要假设一定命中。
  • 请求里内容块上的 cache_control 标记平台会去掉,不要使用。

Anthropic 格式

证据:已实测(线上测试账号,2026-10-19),minimax-m3。

何时用:客户端是 Anthropic SDK 或 Claude Code 之类,只能说 /v1/messages;这也是 MiniMax 官方推荐的入口。调用方式与鉴权见 Messages 页(SDK 用 auth_token,不是 api_key)。

请求(不传 thinking)

from anthropic import Anthropic

client = Anthropic(base_url="https://api.modelsite.ai", auth_token="sk-ms-xxxxxxxx")

resp = client.messages.create(
    model="minimax-m3",
    max_tokens=1500,
    messages=[{"role": "user", "content": "用一句话解释量子纠缠"}],
)
for block in resp.content:
    if block.type == "thinking":
        print("思考:", block.thinking)
    elif block.type == "text":
        print("回答:", block.text)

响应:默认思考,思考以 thinking 内容块给出,usage.reasoning_tokens 是思考 token 数,usage.cache_read_input_tokens 是缓存命中。

{
  "content": [
    {
      "type": "thinking",
      "thinking": "The user is asking me to explain quantum entanglement in one sentence, in Chinese. Let me craft a concise yet accurate explanation.\n\n量子纠缠是指两个或多个粒子在相互作用后,它们的量子态会变得相互关联,即使相隔很远,测量其中一个粒子的状态会瞬间决定另一个粒子的状态。\n\nLet me make it more concise and clear as a single sentence."
    },
    {
      "type": "text",
      "text": "量子纠缠是指两个或多个粒子在相互作用后,其量子态紧密关联在一起,无论相隔多远,对其中一个粒子的测量都会瞬间决定另一个粒子的状态,这种关联不受距离限制,体现了量子世界非经典的关联性。"
    }
  ],
  "id": "msg_xxxx",
  "model": "minimax-m3",
  "output_sensitive_int": 0,
  "role": "assistant",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "cache_read_input_tokens": 128,
    "input_tokens": 53,
    "output_tokens": 119,
    "reasoning_tokens": 72,
    "total_characters": 0
  }
}

不要传 thinking: {"type": "enabled", ...}:这不在官方取值(adaptive / disabled)内。带 "thinking": {"type": "enabled", "budget_tokens": 1024} 的请求会被平台直接拒绝,返回 400(此前上游会返回 200 和空回复,现已拦截):

{"type":"error","error":{"type":"invalid_request_error","message":"thinking.type \"enabled\" is not supported for this model; use \"adaptive\" or \"disabled\"."}}

要控制思考,请不传 thinking(默认思考),或传 {"type": "disabled"} 关闭。

注意事项

  • 官方 Anthropic 兼容页:top_k、stop_sequences、mcp_servers、context_management、container 被忽略;thinking 的 adaptive 取值见思考开关的说明。
  • 多轮时官方要求把完整的 thinking、text、tool_use 内容块原样放回历史。

参数速查

参数说明
thinking只用 disabled(已实测);adaptive 依赖未发布更新;Anthropic 格式传 enabled 返回 400
reasoning_split平台默认加 true;你传的值优先
reasoning_effort、output_config.effort官方只适用于 M3.1-Flash,minimax-m3 不要使用
temperature、top_p、ntemperature [0, 2];top_p [0, 1];n 只支持 1
max_completion_tokens / max_tokens思考 token 计入;minimax-m3 无官方最大输出
presence_penalty、frequency_penalty、logit_bias被忽略
stop / stop_sequencesAnthropic 兼容页写 stop_sequences 被忽略;OpenAI 格式的 stop 官方未说明,未验证
service_tier不转发给上游,传了不生效
tool_choice、function_calltool_choice 在 OpenAI 格式下是否生效未验证;function_call 不支持
未知顶层字段、extra_body 里的键原样平铺转发
developer 角色转为 system

其他:reasoning 对象(OpenRouter 风格)由平台自己处理,其中转换出的 reasoning_effort 对 minimax-m3 不适用,建议直接用 thinking;reasoning.exclude: true 或 include_reasoning: false 会在响应里去掉思考内容,思考 token 仍计费。

官方文档

本页内容