合成语音
将文本合成为音频。
/model/v1/audio/speech● 支持请求体
modelstring必填Speech model id, for example `melotts` or `aura-2-en`; list candidates with listModels?type=speech. Router support (supported): Verified to take effect.
已验证生效。
inputstring可选Text to synthesize, 1 to 4096 characters. `text` and `prompt` are aliases; when several are given, `input` wins. Router support (supported): melotts supports input, lang and response_format=wav; text/prompt aliases also work.
melotts 支持 input、lang、response_format=wav;也可用 text/prompt 别名。
response_formatstring可选◐ 部分支持MeloTTS supports only wav (default); all other explicit formats return 400. When omitted the actual upstream format is returned. Aura defaults to mp3 and supports all listed formats.
melotts 仅 WAV。aura-2-en 支持 mp3/opus/flac/wav/pcm;aac 报错。
promptstring可选MeloTTS alias for input; input then text take precedence.
input 的别名,input 优先。
voicestring | object可选◐ 部分支持Aura speaker name. Custom voice objects and selectable MeloTTS voices return 400.
仅 aura-2-en 支持原生说话人名,如 thalia/apollo/orion/luna/zeus;不支持 alloy 或对象。melotts 必须省略。
▸ 展开子字段(1)
idstring必填Id of a custom voice. Custom voice objects are not supported by these models and answer 400; use the string form of `voice` with an Aura speaker name.
instructionsstring可选○ 未支持Accepted by the protocol; these Cloudflare models reject it with 400.
melotts、aura-2-en 均返回 400。
speednumber可选◐ 部分支持Only 1 is representable by these Cloudflare models.
只接受默认值 1;非默认速度不支持,返回错误。
stream_formatstring可选◐ 部分支持Only audio is supported; the response is buffered binary audio.
audio 生效;sse 返回 400。
textstring可选Native alias for input; input wins.
input 的别名,input 优先。
speakerstring可选◐ 部分支持Aura alias for voice; voice wins.
aura-2-en 支持原生说话人名;melotts 返回 400。
▸ 更多参数(5)
langstring可选◐ 部分支持MeloTTS language; defaults to en. Use this field to select language; voice is not supported by MeloTTS.
melotts 支持 en/fr/es/zh;ja/ko 报错。aura-2-en 不支持 lang。
encodingstring可选◐ 部分支持Aura native encoding; response_format wins; mulaw/alaw return 400.
melotts 仅 linear16;aura-2-en 支持 linear16/flac 等已测编码,mulaw 返回 400;response_format 优先。
containerstring可选◐ 部分支持Aura container; response_format wins.
aura-2-en 支持 opus+ogg、linear16+none;container=wav 返回 400。melotts 不支持此字段。
sample_rateinteger可选◐ 部分支持Aura WAV supports 8000/16000/24000/32000/48000; FLAC supports 8000/16000/22050/32000/48000; PCM requires 24000; other formats reject this control.
仅 aura-2-en;wav 已测 8000/16000、pcm 已测 24000;44100 或 mp3 自定义采样率报错。melotts 不支持。
bit_rateinteger可选◐ 部分支持Aura MP3 supports 32000/48000; Opus 4000–650000; AAC 4000–192000. Other formats reject this control.
仅 aura-2-en:mp3 已测 32000/48000、opus 已测 64000;mp3=64000 报错。melotts 不支持。
返回
200
melotts 输出 WAV,只支持 input(含 text/prompt 别名)、lang 和默认音频选项;aura-2-en 使用原生 speaker 名称。逐字段限制见参数表。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
响应
HTTP 200
Audio bytes in the requested format.
audio/mpeg
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/ogg
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/aac
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/flac
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/wav
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/pcm
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
响应体为音频字节;右侧描述对象仅记录实采的 Content-Type 和字节数。