文字转语音 (Audio Speech)
文字转语音(TTS)接口用于将输入的文本转换为高保真的自然人声语音。支持生成多种语言和不同音色的音频。
POST /v1/audio/speech| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
model | string | ✅ | - | 调用的 TTS 模型 ID(例如 tts-1, tts-1-hd)。 |
input | string | ✅ | - | 需要转换为语音的文本。最长支持 4096 个字符。 |
voice | string | ✅ | - | 使用的音色。常用选项有:alloy, echo, fable, onyx, nova, shimmer。 |
response_format | string | ❌ | mp3 | 返回的音频格式。支持 mp3, opus, aac, flac, wav, pcm。 |
speed | number | ❌ | 1.0 | 播放语速,范围为 0.25 到 4.0。 |
cURL 请求
Section titled “cURL 请求”curl https://api.easytakeai.com/v1/audio/speech \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "tts-1", "input": "您好,欢迎使用 EasyTakeAI 文档中心!", "voice": "alloy" }' \ --output speech.mp3[!TIP] 成功调用后,接口将直接返回二进制音频数据流,可保存为指定
response_format的音频文件。