合成语音
/model/v1/audio/speech● 支持请求体
modelstring必填Speech model id, for example
melottsoraura-2-en; list candidates with listModels?type=speech. Router support (supported): Verified to take effect.已验证生效。
inputstring可选Text to synthesize, 1 to 4096 characters.
textandpromptare aliases; when several are given,inputwins. 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; aac returns 400.
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 are rejected by Aura. MeloTTS ignores voice with a warning unless provider.require_parameters is true, in which case it returns 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
voicewith 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/aac return 400 when used to select the format.
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 bit rate in bits per second. MP3 supports 32000/48000; Opus supports 4000–650000. Other accepted 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)返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/model/v1/audio/speech \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"aura-2-en","voice":"luna","input":"Hello, welcome to Praxis.","response_format":"mp3"}'Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepraxis.com/model/v1",
api_key="$PRAXIS_API_KEY",
)
speech = client.audio.speech.create(
model="aura-2-en",
voice="luna",
input="Hello, welcome to Praxis.",
response_format="mp3",
)
speech.write_to_file("speech.mp3")TypeScript
import OpenAI from "openai";
import fs from "node:fs";
const client = new OpenAI({
baseURL: "https://api.deepraxis.com/model/v1",
apiKey: "$PRAXIS_API_KEY",
});
const speech = await client.audio.speech.create({
model: "aura-2-en",
voice: "luna",
input: "Hello, welcome to Praxis.",
response_format: "mp3",
});
await fs.promises.writeFile("speech.mp3", Buffer.from(await speech.arrayBuffer()));响应示例 200
{
"content_type": "audio/mpeg",
"bytes": 13968
}响应
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 和字节数。