Skip to main content

Quick start

Supported text-to-speech models include tts-1, tts-1-hd, gpt-4o-mini-tts, doubao-tts, and seed-tts-1.1. Send text in the input field:
Doubao speech synthesis supports Chinese and English only. For other languages, use an OpenAI speech model.

Voices

OpenAI supports the following values for voice:
  • alloy
  • ash
  • ballad
  • coral
  • echo
  • fable
  • onyx
  • nova
  • sage
  • shimmer
Set voice to the name of the voice you want. Doubao has a larger voice catalog. Choose a voice_type from Volcengine’s speech synthesis voice list and pass it as voice.

Audio formats

Set response_format to one of these OpenAI output formats:
  • mp3
  • opus
  • wav
  • flac
  • pcm
  • aac
The default format is mp3. Doubao supports mp3, wav, pcm, and ogg_opus only.

Streaming output

By default, the response is a binary audio file. To play audio as it arrives, set stream_format to sse. Streaming is supported by gpt-4o-mini-tts, doubao-tts, and seed-tts-1.1:
For low-latency playback, use pcm. Doubao does not support streaming in wav format.
The server streams Base64-encoded audio in chunks using server-sent events. Read each event until you receive [DONE]. The format is compatible with OpenAI streaming speech synthesis. An event with type set to speech.audio.delta contains a Base64-encoded audio fragment in audio. Decode and concatenate the fragments to save the file, or play them as you decode them:
An event with type set to speech.audio.done marks the end of the audio. You can then close the event stream:
For additional speech synthesis parameters, see the API reference.