Skip to content
中文

Generate speech

POST/openai/v1/audio/speech● Supported

Official OpenAI docs ↗

Request body

  • modelstringrequired

    Speech model id, for example melotts or aura-2-en; list candidates with listModels?type=speech. Router support (supported): Verified to take effect.

    Verified to take effect.

  • response_formatstringoptional◐ Partially supported

    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 supports WAV only. aura-2-en supports mp3/opus/flac/wav/pcm; aac errors.

    values mp3opusflacwavpcm
  • inputstringoptional

    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 supports input, lang and response_format=wav; text/prompt aliases also work.

  • voicestring | objectoptional◐ Partially supported

    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.

    Only aura-2-en supports native speaker names such as thalia/apollo/orion/luna/zeus; alloy and objects are unsupported. Omit on melotts.

    Expand sub-fields (1)
    • idstringrequired

      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.

  • instructionsstringoptional○ Unsupported

    Accepted by the protocol; these Cloudflare models reject it with 400.

    Both melotts and aura-2-en return 400.

  • speednumberoptional◐ Partially supported
    default 1

    Only 1 is representable by these Cloudflare models.

    Only the default value 1 is accepted; other speeds are unsupported and return errors.

  • stream_formatstringoptional◐ Partially supported
    default "audio"

    Only audio is supported; the response is buffered binary audio.

    audio works; sse returns 400.

    values audio
  • textstringoptional

    Native alias for input; input wins.

    Alias for input; input takes precedence.

  • promptstringoptional

    MeloTTS alias for input; input then text take precedence.

    Alias for input; input takes precedence.

  • speakerstringoptional◐ Partially supported

    Aura alias for voice; voice wins.

    aura-2-en supports native speaker names; melotts returns 400.

  • More parameters (5)
    • langstringoptional◐ Partially supported

      MeloTTS language; defaults to en. Use this field to select language; voice is not supported by MeloTTS.

      melotts supports en/fr/es/zh; ja/ko error. aura-2-en does not support lang.

      values enfreszhjako
    • encodingstringoptional◐ Partially supported

      Aura native encoding; response_format wins; mulaw/alaw/aac return 400 when used to select the format.

      melotts supports linear16 only; aura-2-en supports tested linear16/flac encodings while mulaw returns 400. response_format takes precedence.

      values linear16flacmulawalawmp3opusaac
    • containerstringoptional◐ Partially supported

      Aura container; response_format wins.

      aura-2-en supports opus+ogg and linear16+none; container=wav returns 400. melotts does not support this field.

      values nonewavogg
    • sample_rateintegeroptional◐ Partially supported

      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 only: tested wav at 8000/16000 and pcm at 24000. 44100 and custom mp3 rates error. Unsupported on melotts.

    • bit_rateintegeroptional◐ Partially supported

      Aura bit rate in bits per second. MP3 supports 32000/48000; Opus supports 4000–650000. Other accepted formats reject this control.

      aura-2-en only: tested mp3 at 32000/48000 and opus at 64000; mp3=64000 errors. Unsupported on melotts.

Returns

200

melotts outputs WAV and supports input (including text/prompt aliases), lang and default audio options; aura-2-en uses native speaker names. See per-field limits below.

Errors follow the OpenAI format — see error codes

Request

curl
curl https://api.deepraxis.com/openai/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/openai/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";

const client = new OpenAI({
  baseURL: "https://api.deepraxis.com/openai/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",
});
const { writeFile } = await import("node:fs/promises");
await writeFile("speech.mp3", Buffer.from(await speech.arrayBuffer()));

Response 200

{
  "content_type": "audio/mpeg",
  "bytes": 13248
}

Response

HTTP 200

Audio bytes in the requested format.

audio/mpeg

Name Type Description
$ string (binary)

audio/ogg

Name Type Description
$ string (binary)

audio/aac

Name Type Description
$ string (binary)

audio/flac

Name Type Description
$ string (binary)

audio/wav

Name Type Description
$ string (binary)

audio/pcm

Name Type Description
$ string (binary)

The response body contains audio bytes; the example descriptor records only the captured Content-Type and byte count.