Complete audio with timing
The synchronous endpoint accepts the ordinary TTS request fields and output formats, including sample-rate profiles such aswav_48000. Default output is MP3. Word timestamps are always included. timestamp_mode applies only to streaming. The history-item-id response header identifies the saved audio; history audio downloads contain audio bytes, not the JSON envelope.
- Python
- TypeScript
- CLI
- HTTP
Background audio with timing
Setdelivery=async to return HTTP 202 with a generation_job_id immediately. Poll GET /v1/generation-jobs/{generation_job_id} until status is ready, then read word_timestamps and download the audio from download_url. Stop polling on failed or cancelled; use a deadline. Pending jobs and ordinary audio jobs omit word_timestamps.
- Python
- TypeScript
- CLI
- HTTP
Streaming audio with timing
UsePOST /v1/text-to-speech/{voice_id}/stream/with-timestamps with a BreezeBlue TTS 2 model. It accepts the usual text, voice, model, language, and voice settings. Audio is returned as base64 inside newline-delimited JSON (NDJSON), with word/token timestamps. The ordinary /stream endpoint continues to return audio bytes.
timestamp_mode is chunk (default) or lookahead. Chunk mode sends boundaries as audio is generated; the same word may span several updates. Lookahead mode waits for later audio to confirm a boundary, so timing can arrive after its audio. It does not promise a fixed wall-clock delay.
Consume the stream
- Python
- TypeScript
- CLI
Timing and display
A word entry has this shape:- Times refer to the complete output audio, including requested speed and pauses inserted between long-text segments. They are not offsets inside an HTTP chunk.
- Streaming audio output formats are
pcm(mono 24 kHz PCM16 little-endian),wav, andmp3; complete responses support the ordinary synchronous TTS formats. Decodeaudio_base64before playback. MP3 encoders can buffer, so a record’s bytes need not align with its word boundaries. - Preserve the authored text, punctuation, whitespace, and audio tags. Chinese and other CJK languages may return tokens containing multiple characters. This API does not provide character timestamps.
- Highlight a word using the player’s audio clock when
start <= currentTime < end. Seek to itsstartwhen the reader selects it. Do not use network arrival time as playback time. - A streaming record can have an empty
audio_base64or an emptyword_timestampsarray. HTTP transport chunks can split a JSON line or a UTF-8 character; use an incremental parser. - The final successful streaming record contains the complete merged word list and empty audio. Merge updates by
index, keeping the earlieststartand latestend, or use this final list for saved playback. - In a stream, after HTTP 200, a failure can appear as
{"error":{"code":"UPSTREAM_GENERATION_ERROR","message":"..."}}. A disconnect, parsing failure, or error record means the output is incomplete.

