Skip to main content
POST /v1/audio/speech 发送 JSON,提供 model、input、voice。通常返回音频二进制,Content-Type 和编码随 response_format 变化。不要把成功响应按 JSON 读取;错误响应仍可能是 JSON。 音色、语速和风格指令由模型决定。stream_format: sse 只有渠道支持时可用,不能因为 HTTP 分块传输就按 SSE 解析。 完整接入指南与可执行示例 Read in English

授权

Authorization
string
header
必填

模型调用 API Key,不是控制台登录凭据 / Model API key, not console login credentials

请求体

application/json
model
string
必填

当前密钥可用且支持此接口的模型 ID / Model ID available to the key and supporting this endpoint

示例:

"YOUR_MODEL_ID"

input
string
必填

待合成文本 / Text to speak

voice
string
必填

模型支持的音色标识 / Voice ID supported by the model

response_format
string

常见 mp3、wav、opus、aac、flac、pcm;支持情况由模型决定 / Common formats include mp3, wav, opus, aac, flac, pcm; support depends on model

instructions
string

可选风格指令,非所有模型支持 / Optional style instructions; not supported by every model

speed
number

语速;范围由模型决定 / Speed; accepted range depends on the model

stream_format
string

audio 或 sse 需渠道支持;本指南使用音频字节 / audio or sse requires channel support; this guide uses audio bytes

响应

音频字节;不能按 JSON 解析 / Audio bytes; do not parse as JSON

The response is of type file.