文档

语音合成(MiMo-TTS 系列)- OpenAI API 兼容

请求地址

https://api.xiaomimimo.com/v1/chat/completions

请求头

接口支持以下两种认证方式,请选择其中一种添加到请求头中:

api-key: $MIMO_API_KEY
Content-Type: application/json

请求体

  • messagesarray必选
    对话的消息列表。
    隐藏子属性
    由终端用户发送的消息,包含提示或额外的上下文信息。
    注意:使用 mimo-v2.5-tts-voicedesign 模型生成音频时,该消息为必填,用于指定音色设计描述文本。
    隐藏子属性
    messages.contentstring必选
    用户消息的内容。
    messages.rolestring必选
    用户消息的角色。
    可选值:user
  • modelstring必选
    用于生成响应的模型 ID。
    可选值:mimo-v2.5-ttsmimo-v2.5-tts-voicedesignmimo-v2.5-tts-voiceclone
  • audioobject
    音频输出参数。详情请参考语音合成
    注意:如果要生成音频,必须添加一条 roleassistant 的消息,该消息需指定用于音频合成的文本。此外,使用 mimo-v2.5-tts-voicedesign 模型时,roleuser 的消息为必填,若将optimize_text_preview 设置为 true,则可省略 assistant 消息。
    隐藏子属性
    audio.formatstring默认值: wav
    指定输出音频格式。默认值:wav,如果设置 stream: true 则为 pcm
    传入 pcmpcm16,均表示指定使用 pcm16 格式。
    可选值:wavmp3pcmpcm16
    audio.optimize_text_previewboolean默认值: false
    是否开启目标音频播报文本智能优化能力。
    设置为 true 时,会对传入的目标文本做智能润色;若未传入目标文本,则自动生成适配播报场景的目标文本,再将处理完成的最终文本送入模型进行合成。
    注意:该参数为 true 时,可省略传入用于指定音频合成内容的 assistant 消息。
    仅支持 mimo-v2.5-tts-voicedesign 模型。
    audio.voicestring
    预置音色的音色ID 或音频样本的 base64 编码。
    • mimo-v2.5-tts:该字段为可选,且仅支持使用预置音色,默认值为 mimo_default
    • mimo-v2.5-tts-voiceclone:该字段为必填,且仅支持传入音频样本的 base64 编码,仅支持传入 mp3wav 格式的音频样本文件
    • mimo-v2.5-tts-voicedesign:不支持该字段
    可选值:
    • mimo-v2.5-ttsmimo_default冰糖茉莉苏打白桦MiaChloeMiloDean
  • streamboolean默认值: false
    如果设置为 true,模型的响应数据会在生成过程中通过SSE(server-sent events)的形式流式传输到客户端。

Chat 响应对象(非流式输出)

  • choicesarray
    包含生成的回复选项列表。
    隐藏子属性
    choices.finish_reasonstring
    模型停止生成 token 的原因:
    • stop:模型到达自然结束点或触发了用户指定的停止序列
    • length:因超出模型最大生成长度而终止
    • content_filter:内容因触发过滤策略而被拦截
    choices.indexinteger
    选项列表中对应选项的索引。
    choices.messageobject
    模型生成的对话补全消息。
    隐藏子属性
    choices.message.contentstring
    消息的内容。
    choices.message.rolestring
    消息作者的角色。
    choices.message.audioobject
    如果请求输出音频,该对象将包含有关模型音频响应的数据。
    隐藏子属性
    choices.message.audio.idstring
    此音频响应的唯一标识符。
    choices.message.audio.datastring
    模型生成的 Base64 编码音频,格式为请求中指定的格式。
    choices.message.audio.expires_atnumber | null
    此音频响应过期的 Unix 时间戳(以秒为单位)。当前仅为 null
    choices.message.audio.transcriptstring | null
    模型生成的音频的文字记录。当前仅为 null
    choices.message.final_text_previewstring
    经过智能优化润色后的音频播报最终文本。仅当请求参数 optimize_text_preview 设为 true 时,该字段才会返回。
  • 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 数量,固定为 0
    usage.prompt_tokens_detailsobject
    提示中使用的 token 数量明细。
    隐藏子属性
    usage.prompt_tokens_details.cached_tokensinteger
    命中缓存的 token 数量。

Chat 响应 chunk 对象(流式输出)

  • choicesarray
    包含生成的回复选项列表。
    隐藏子属性
    choices.deltaobject
    流式模型响应生成的对话补全增量。
    隐藏子属性
    choices.delta.contentstring
    数据块消息的内容。
    choices.delta.rolestring
    消息作者的角色。
    choices.delta.audioobject | null
    如果请求输出音频,该对象将包含有关模型音频响应的数据。
    隐藏子属性
    choices.delta.audio.idstring
    此音频响应的唯一标识符。
    choices.delta.audio.datastring
    模型生成的 Base64 编码音频,格式为请求中指定的格式。
    choices.delta.audio.expires_atnumber | null
    此音频响应过期的 Unix 时间戳(以秒为单位)。当前仅为 null
    choices.delta.audio.transcriptstring | null
    模型生成的音频的文字记录。当前仅为 null
    choices.delta.final_text_previewstring
    经过智能优化润色后的音频播报最终文本。仅当请求参数 optimize_text_preview 设为 true 时,该字段才会返回。
    choices.finish_reasonstring | null
    模型停止生成 token 的原因:
    • stop:模型到达自然结束点或触发了用户指定的停止序列
    • length:因超出模型最大生成长度而终止
    • content_filter:内容因触发过滤策略而被拦截
    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 数量,固定为 0
    usage.prompt_tokens_detailsobject
    提示中使用的 token 数量明细。
    隐藏子属性
    usage.prompt_tokens_details.cached_tokensinteger
    命中缓存的 token 数量。
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-tts",
    "messages": [
        {
            "role": "user",
            "content": "Bright, bouncy, slightly sing-song tone — like you are bursting with good news you can barely hold in. Fast pace, rising pitch at the end."
        },
        {
            "role": "assistant",
            "content": "Hey boss — guess what, guess what? I just got the results back and I actually passed! Not just passed, I got a distinction! I know, I know — you told me I was cutting it close, but hey, here we are. Drinks are on me tonight, okay?"
        }
    ],
    "audio": {
        "format": "wav",
        "voice": "mimo_default"
    }
}'
响应
{
    "id": "6ebed286b58546f6b87fa7fa9d0e806b",
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": "",
                "role": "assistant",
                "audio": {
                    "id": "979a91904f9a4143928d9e1f54837b4f",
                    "data": "base64Data",
                    "expires_at": null,
                    "transcript": null
                },
                "tool_calls": null
            }
        }
    ],
    "created": 1776954802,
    "model": "mimo-v2.5-tts",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 97,
        "prompt_tokens": 213,
        "total_tokens": 310,
        "completion_tokens_details": {
            "reasoning_tokens": 0
        },
        "prompt_tokens_details": {
            "cached_tokens": 109
        }
    }
}
更新时间 2026 年 07 月 17 日

Copyright©2026 Xiaomi. All Rights Reserved | Cookie Policy | Cookie Preferences

We use cookies and similar technologies of our own to ensure the proper functioning of the website, customize content according to user preferences and analyze users' interactions on the website, as well as their browsing habits. You can find more information in our Cookie Policy. Select an option or go to Cookie Settings to manage your preferences. Learn More.