Text-to-Speech (TTS) Endpoints

OpenAI-compatible text-to-speech endpoint: POST /v1/audio/speech.

[!NOTE] Example model IDs are for reference only; use actual IDs from the Model Marketplace.

1. Speech Synthesis

  • Path: /v1/audio/speech
  • Request Method: POST
  • Authentication: Authorization: Bearer sk-your_token

Request Parameters

ParameterTypeRequiredDescription
modelstringYesTTS model name, e.g. tts-1, tts-1-hd, gpt-4o-mini-tts (also compatible with platform-integrated vendor audio models)
inputstringYesThe text to be synthesized into speech; maximum length depends on the model specification
voicestringYesVoice identifier: standard OpenAI voices (alloy, echo, fable, onyx, nova, shimmer, ash, coral, sage), or the corresponding vendor voice ID for non-OpenAI models
response_formatstringNoAudio output format: mp3 (default), opus, aac, flac, wav, pcm
speednumberNoSpeech speed multiplier (OpenAI standard range 0.25–4.0, default 1.0)
instructionsstringNoOptional natural-language voice style/tone instructions (for supported models such as gpt-4o-mini-tts)

Calling Example

curl -X POST https://www.roookey.com/v1/audio/speech \
  -H "Authorization: Bearer sk-your_token" \
  -H "Content-Type: application/json" \
  -o output.mp3 \
  -d '{
    "model": "tts-1",
    "input": "Hello, welcome to the unified text-to-speech service.",
    "voice": "alloy",
    "response_format": "mp3",
    "speed": 1.0
  }'

[!NOTE] This endpoint returns a raw binary audio stream (HTTP binary response with Content-Type set to audio/mpeg or the matching format MIME type) that can be saved directly as an audio file.

[!TIP] For Doubao audio models (doubao-seed-audio-1-5-261128, doubao-seed-tts-3.0, seed-tts-2.0, seed-audio-1.0), see Doubao Audio & TTS. For Alibaba Qwen audio models (qwen-audio-3.1-tts-flash, plus, next), see Qwen Audio & TTS.

Raw Markdown (.md) · llms.txt