Model

Generate speech

Synthesize audio from text.

POST /model/v1/audio/speech● Supported

Official docs ↗

Request body

  • modelstring必填

    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.

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

  • response_formatstring可选◐ 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.

    取值 mp3opusflacwavpcm
  • promptstring可选

    MeloTTS alias for input; input then text take precedence.

    Alias for input; input takes precedence.

  • voicestring | object可选◐ 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.

    ▸ 展开子字段(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可选○ Unsupported

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

    Both melotts and aura-2-en return 400.

  • speednumber可选◐ Partially supported
    默认 1

    Only 1 is representable by these Cloudflare models.

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

  • stream_formatstring可选◐ Partially supported
    默认 "audio"

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

    audio works; sse returns 400.

    取值 audio
  • textstring可选

    Native alias for input; input wins.

    Alias for input; input takes precedence.

  • speakerstring可选◐ Partially supported

    Aura alias for voice; voice wins.

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

  • ▸ 更多参数(5)
    • langstring可选◐ 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.

      取值 enfreszhjako
    • encodingstring可选◐ 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.

      取值 linear16flacmulawalawmp3opusaac
    • containerstring可选◐ 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.

      取值 nonewavogg
    • sample_rateinteger可选◐ 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_rateinteger可选◐ 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.

Platform errors (auth, rate limits, validation) and OCR errors use problem+json; other model call errors follow the endpoint's own format (OpenAI or Anthropic) — see error codes

Response

HTTP 200

Audio bytes in the requested format.

audio/mpeg

NameTypeDescription
$string (binary)

audio/ogg

NameTypeDescription
$string (binary)

audio/aac

NameTypeDescription
$string (binary)

audio/flac

NameTypeDescription
$string (binary)

audio/wav

NameTypeDescription
$string (binary)

audio/pcm

NameTypeDescription
$string (binary)

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