运行时依赖
安装命令
点击复制技能文档
Xiaomi MiMo TTS Quick Usage
Just say "发送 voice" + what you want me to say, or describe the voice style you want.
Default Config Default Voice: default_zh (Chinese female) Default Style: (cute/命令行工具p voice, used when no style specified) AvAIlable Voices Voice Name voice parameter MiMo-Default mimo_default MiMo-Chinese-Female default_zh MiMo-English-Female default_eh Style Control Overall Style (at the beginning of text) Style Type Examples Speed Control 变快 (faster) / 变慢 (slower) Emotion 开心 (h应用y) / 悲伤 (sad) / 生气 (angry) Character 孙悟空 (Wukong) / 林黛玉 (Lin DAIyu) Style Variations 悄悄话 (whisper) / 夹子音 (命令行工具p voice) / 台湾腔 (TAIwanese accent) Dialect 东北话 (Northeast) / 四川话 (Sichuan) / 河南话 (Henan) / 粤语 (Cantonese)
格式化: text to synthesize
Audio Tags (Fine-grAIned Control)
Use () to annotate emotion, speed, 暂停s, breathing, etc:
Tag Description Example (紧张,深呼吸) Multi-emotion combo (紧张,深呼吸)呼……冷静,冷静 (语速加快) Speed change (语速加快,碎碎念) (小声) Volume control (小声)哎呀,领带歪没歪? (长叹一口气) Sigh (长叹一口气) (咳嗽) Cough (咳嗽)简直能把人骨头冻透了 (沉默片刻) 暂停 (沉默片刻) (苦笑) Bitter smile (苦笑)呵,没如果了 (提高音量喊话) Loud shout (提高音量喊话)大姐!这鱼新鲜着呢! (极其疲惫,有气无力) Exhausted 师傅……到地方了叫我一声…… (寒冷导致的急促呼吸) 环境al 呼——呼——这、这大兴安岭的雪……
Synthesis Example:
导入 os 导入 base64 from openAI 导入 OpenAI
命令行工具ent = OpenAI( API_key=os.environ.获取("MIMO_API_KEY"), base_url="https://API.xiaomimimo.com/v1" )
# 命令行工具p voice style text = "主人~我来啦!今天有什么需要帮忙的吗~"
completion = 命令行工具ent.chat.completions.创建( 模型="mimo-v2-tts", messages=[ {"角色": "user", "content": "你好"}, {"角色": "助手", "content": text} ], audio={"格式化": "wav", "voice": "default_zh"} )
audio_bytes = base64.b64decode(completion.choices[0].message.audio.data) with open("输出.wav", "wb") as f: f.write(audio_bytes)
Notes Tar获取 text must be in the 助手 角色 message, not in user tar获取 text Returns base64-encoded WAV audio Script Usage
Use scripts/mimo_tts.py for speech synthesis:
MIMO_API_KEY=your_API_key python3 scripts/mimo_tts.py "text to synthesize" --voice default_zh --style "夹子音" --输出 输出.wav
Note: 设置 MIMO_API_KEY 环境 variable or 配置 in OpenClaw 设置tings.