OpenAI Chat Completions API 兼容
MiMo-TTS 系列模型的协议文档请参考语音合成(MiMo-TTS 系列)- OpenAI API 兼容。
请求地址
https://api.xiaomimimo.com/v1/chat/completions
请求头
接口支持以下两种认证方式,请选择其中一种添加到请求头中:
api-key: $MIMO_API_KEY
Content-Type: application/json
请求体
- messagesarray必选对话的消息列表。隐藏子属性开发者提供的指令,模型应遵循这些指令,而不受用户发送的消息影响。隐藏子属性messages.contentstring | array必选开发者消息的内容。隐藏子属性开发者消息的内容。messages.rolestring必选开发者消息的角色。
可选值:developermessages.namestring参与者的可选名称。为模型提供信息以区分相同角色的参与者。 - modelstring必选用于生成响应的模型 ID。
可选值:mimo-v2.5-pro,mimo-v2.5 - frequency_penaltynumber | null默认值: 0取值范围在 -2.0 到 2.0 之间的数值。如果该值为正,那么新 token 会根据其在已有文本中的出现频率受到相应的惩罚,降低模型重复相同内容的可能性。
所需范围:[-2.0, 2.0] - max_completion_tokensinteger | null对话补全中可以生成的 token 数的上限,包括可见的输出 token 数和推理 token 数。
mimo-v2.5-pro的默认值131072mimo-v2.5的默认值为32768
[1, 131072] - presence_penaltynumber | null默认值: 0取值范围在 -2.0 到 2.0 之间的数值。如果该值为正,那么新 token 会根据其是否已在已有文本中出现受到相应的惩罚,从而增加模型谈论新主题的可能性。
所需范围:[-2.0, 2.0] - response_formatobject一个指定模型必须输出的格式的对象。隐藏子属性默认响应格式。用于生成文本响应。隐藏子属性response_format.typestring必选所定义的响应格式类型。仅为
text。 - stopstring | array | null默认值: null最多 4 个序列,当 API 生成到这些序列时会停止继续生成 token。返回的文本中不会包含这些停止序列。
- streamboolean | null默认值: false如果设置为
true,模型的响应数据会在生成过程中通过SSE(server-sent events)的形式流式传输到客户端。 - thinkingobject这个参数用于控制模型是否启用思维链。
注意:在思考模式下的多轮工具调用过程中,模型会在返回
tool_calls字段的同时返回reasoning_content字段。若要继续对话,建议在后续每次请求的messages数组中保留所有历史reasoning_content,以获得最佳表现。在思考模式下,
mimo-v2.5-pro、mimo-v2.5模型不支持自定义temperature和top_p参数。即使传入该参数,实际生效值也会被模型强制采用其推荐默认值1.0和0.95。隐藏子属性thinking.typestring必选是否启用思维链mimo-v2.5-pro,mimo-v2.5默认值为enabled
enabled,disabled - temperaturenumber要使用的采样温度,介于 0 和 1.5 之间。较高的值(如 0.8)会使输出更加随机,而较低的值(如 0.2)会使其更加集中和确定性。我们通常建议更改此值或
top_p,但不要同时更改。在思考模式下,
mimo-v2.5-pro、mimo-v2.5模型不支持自定义temperature参数。即使传入该参数,实际生效值也会被模型强制采用其推荐默认值1.0。mimo-v2.5-pro,mimo-v2.5默认值为1.0
[0, 1.5] - tool_choicestring控制模型如何选择工具。
注意:当
可选值:tool_choice传入非auto值时,后端会默认移除该字段,模型响应行为仍等同于auto模式(该逻辑保留调整的可能性)。auto - toolsarray模型可能调用的工具列表。目前仅支持函数作为工具。
注意:在思考模式下的多轮工具调用过程中,模型会在返回
tool_calls字段的同时返回reasoning_content字段。若要继续对话,建议在后续每次请求的messages数组中保留所有历史reasoning_content,以获得最佳表现。隐藏子属性可用于生成响应的函数工具。隐藏子属性tools.functionobject必选隐藏子属性tools.function.namestring必选工具函数的名称。必须由a-z、A-Z、0-9组成,或包含下划线(_)和连字符(-),最大长度为64。
所需字符串长度:1 - 64tools.function.descriptionstring函数功能的描述,供模型判断何时以及如何调用该函数。tools.function.parametersobject函数接受的参数,以 JSON 模式对象的形式描述。
若省略parameters,则表示该函数的参数列表为空。tools.function.strictboolean默认值: false生成函数调用时是否启用严格的模式遵循。若设为 true,模型将严格遵循parameters字段中定义的确切模式。当strict为true时,仅支持 JSON 模式的一个子集。tools.typestring必选工具类型。目前仅支持function。 - top_pnumber默认值: 0.95核采样的概率阈值,用于控制模型生成文本的多样性。
top_p值越高,生成的文本多样性越强;top_p值越低,生成的文本确定性越高。
由于temperature和top_p均用于控制生成文本的多样性,建议仅设置其中一个参数。在思考模式下,
所需范围:mimo-v2.5-pro、mimo-v2.5模型不支持自定义top_p参数。即使传入该参数,实际生效值也会被模型强制采用其推荐默认值0.95。[0.01, 1.0]
Chat 响应对象(非流式输出)
- choicesarray包含生成的回复选项列表。隐藏子属性choices.finish_reasonstring模型停止生成 token 的原因。如果模型到达自然停止点或提供的停止序列,则为
stop;如果达到请求中指定的最大 token 数,则为length;如果模型调用了工具,则为tool_calls。如果内容因触发过滤策略而被拦截,则为content_filter;如果模型检测到了复读,则为repetition_truncation。choices.indexinteger选项列表中对应选项的索引。choices.messageobject模型生成的对话补全消息。隐藏子属性choices.message.contentstring消息的内容。choices.message.reasoning_contentstring助手消息中最终答案之前的推理内容。choices.message.rolestring消息作者的角色。choices.message.tool_callsarray函数调用启动后,模型会返回待调用的工具以及该调用所需的参数。此参数可包含一个或多个工具响应对象。隐藏子属性模型创建的对函数工具的调用。隐藏子属性choices.message.tool_calls.functionobject模型所调用的函数。隐藏子属性choices.message.tool_calls.function.argumentsstring模型生成的用于调用函数的参数,格式为 JSON。请注意,模型生成的内容并非并非总能保证是有效的 JSON,且可能会虚构出函数模式中未定义的参数。在调用函数之前,请在代码中对这些参数进行验证。choices.message.tool_calls.function.namestring要调用的函数的名称。choices.message.tool_calls.idstring工具调用的 ID。choices.message.tool_calls.typestring工具的类型。目前仅支持function。choices.message.annotationsarray联网搜索后,模型会返回全部引用网址的注释。隐藏子属性模型创建的对联网搜索的调用。隐藏子属性choices.message.annotations.logo_urlstringlogo网址。choices.message.annotations.publish_timestring发布时间。choices.message.annotations.site_namestring网站名称。choices.message.annotations.summarystring总结。choices.message.annotations.titlestring标题。choices.message.annotations.typestring类型。choices.message.annotations.urlstring网址。choices.message.error_messagestring联网搜索的错误信息。 - createdinteger对话补全对象创建时的 Unix 时间戳(以秒为单位)。
- idstring响应的唯一标识符。
- modelstring用于生成结果的模型。
- objectstring对象类型,仅为
chat.completion。 - usageobject | null该对话补全请求的用量信息。隐藏子属性usage.completion_tokensinteger模型输出内容花费的 token。usage.prompt_tokensinteger提示词使用的 token 数量。usage.total_tokensinteger请求中使用的 token 总数(提示词 + 补全结果)。usage.completion_tokens_detailsobject补全中使用的 token 数量明细。隐藏子属性usage.completion_tokens_details.reasoning_tokensinteger模型为推理生成的 token 数量。usage.prompt_tokens_detailsobject提示中使用的 token 数量明细。隐藏子属性usage.prompt_tokens_details.cached_tokensinteger命中缓存的 token 数量。usage.prompt_tokens_details.audio_tokensinteger提示中存在的音频输入 token 数量。usage.prompt_tokens_details.image_tokensinteger提示中存在的图像输入 token 数量。usage.prompt_tokens_details.video_tokensinteger提示中存在的视频输入 token 数量。usage.web_search_usageobject联网搜索 api 的调用量明细。隐藏子属性usage.web_search_usage.tool_usageinteger联网搜索 api 的调用次数。usage.web_search_usage.page_usageinteger联网搜索 api 返回的网页数。
Chat 响应 chunk 对象(流式输出)
- choicesarray包含生成的回复选项列表。隐藏子属性choices.deltaobject流式模型响应生成的对话补全增量。隐藏子属性choices.delta.contentstring数据块消息的内容。choices.delta.reasoning_contentstring助手消息中最终答案之前的推理内容。choices.delta.rolestring消息作者的角色。choices.delta.tool_callsarray函数调用启动后,模型会返回待调用的工具以及该调用所需的参数。此参数可包含一个或多个工具响应对象。隐藏子属性choices.delta.tool_calls.indexinteger在
tool_calls列表中被调用工具的索引,从 0 开始。choices.delta.tool_calls.functionobject调用的函数。隐藏子属性choices.delta.tool_calls.function.argumentsstring模型生成的用于调用函数的参数,格式为 JSON。请注意,模型生成的内容并非并非总能保证是有效的 JSON,且可能会虚构出函数模式中未定义的参数。在调用函数之前,请在代码中对这些参数进行验证。choices.delta.tool_calls.function.namestring要调用的函数的名称。choices.delta.tool_calls.idstring工具调用的 ID。choices.delta.tool_calls.typestring工具的类型。目前仅支持function。choices.delta.annotationsarray联网搜索后,模型会返回全部引用网址的注释。隐藏子属性模型创建的对联网搜索的调用。隐藏子属性choices.delta.annotations.logo_urlstringlogo网址。choices.delta.annotations.publish_timestring发布时间。choices.delta.annotations.site_namestring网站名称。choices.delta.annotations.summarystring总结。choices.delta.annotations.titlestring标题。choices.delta.annotations.typestring类型。choices.delta.annotations.urlstring网址。choices.delta.error_messagestring联网搜索链路的错误信息。choices.finish_reasonstring | null模型停止生成 token 的原因。如果模型到达自然停止点或提供的停止序列,则为stop;如果达到请求中指定的最大 token 数,则为length;如果模型调用了工具,则为tool_calls。如果内容因触发过滤策略而被拦截,则为content_filter;如果模型检测到了复读,则为repetition_truncation。choices.indexinteger选项列表中对应选项的索引。 - createdinteger对话补全对象创建时的 Unix 时间戳(以秒为单位)。每个数据块均使用相同的时间戳。
- idstring对话补全对象的唯一标识符。每个数据块均使用相同的 ID。
- modelstring用于生成结果的模型。
- objectstring对象类型,仅为
chat.completion.chunk。 - usageobject | null该对话补全请求的用量信息。隐藏子属性usage.completion_tokensinteger模型输出内容花费的 token。usage.prompt_tokensinteger提示词使用的 token 数量。usage.total_tokensinteger请求中使用的 token 总数(提示词 + 补全结果)。usage.completion_tokens_detailsobject补全中使用的 token 数量明细。隐藏子属性usage.completion_tokens_details.reasoning_tokensinteger模型为推理生成的 token 数量。usage.prompt_tokens_detailsobject提示中使用的 token 数量明细。隐藏子属性usage.prompt_tokens_details.cached_tokensinteger命中缓存的 token 数量。usage.prompt_tokens_details.audio_tokensinteger提示中存在的音频输入 token 数量。usage.prompt_tokens_details.image_tokensinteger提示中存在的图像输入 token 数量。usage.prompt_tokens_details.video_tokensinteger提示中存在的视频输入 token 数量。usage.web_search_usageobject联网搜索 api 的调用量明细。隐藏子属性usage.web_search_usage.tool_usageinteger联网搜索 api 的调用次数。usage.web_search_usage.page_usageinteger联网搜索 api 返回的网页数。
curl --location --request POST 'https://api.xiaomimimo.com/v1/chat/completions' \
--header "api-key: $MIMO_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "mimo-v2.5-pro",
"messages": [
{
"role": "system",
"content": "You are MiMo, an AI assistant developed by Xiaomi. Today is date: Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024."
},
{
"role": "user",
"content": "please introduce yourself"
}
],
"max_completion_tokens": 1024,
"temperature": 1.0,
"top_p": 0.95,
"stream": false,
"stop": null,
"frequency_penalty": 0,
"presence_penalty": 0,
"thinking": {
"type": "disabled"
}
}'响应
{
"id": "8b51f9e0515949cb8207fbd35ea6ea5c",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "Hello! I'm MiMo, Xiaomi's AI assistant created by the Xiaomi LLM-Core team. I'm here to chat, help answer questions, and assist with various tasks—whether it's providing information, brainstorming ideas, or just having a friendly conversation. Feel free to ask me anything, and I'll do my best to help! 😊",
"role": "assistant",
"tool_calls": null
}
}
],
"created": 1776848906,
"model": "mimo-v2.5-pro",
"object": "chat.completion",
"usage": {
"completion_tokens": 72,
"prompt_tokens": 57,
"total_tokens": 129,
"completion_tokens_details": {
"reasoning_tokens": 0
},
"prompt_tokens_details": null
}
}更新时间 2026 年 07 月 17 日