Skip to main content
Generate speech with word/token timestamps using a BreezeBlue TTS 2 model. Choose a complete response, a background job, or a stream. Times are in seconds relative to the delivered audio; character alignment is not provided.

Complete audio with timing

The synchronous endpoint accepts the ordinary TTS request fields and output formats, including sample-rate profiles such as wav_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.

Background audio with timing

Set delivery=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.

Streaming audio with timing

Use POST /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

SDK iterators raise on stream errors and close the connection when iteration stops. In Python, use the context manager to close even when leaving early. Each call consumes the same speech-generation credits as ordinary TTS.

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, and mp3; complete responses support the ordinary synchronous TTS formats. Decode audio_base64 before 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 its start when the reader selects it. Do not use network arrival time as playback time.
  • A streaming record can have an empty audio_base64 or an empty word_timestamps array. 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 earliest start and latest end, 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.
The API follows the normal authentication, voice visibility, generation concurrency, history, and billing rules. Old history audio is not retroactively aligned.