Skip to main content

client.tts.connect()

Opens a persistent WebSocket connection for low-latency, real-time TTS streaming. Supports multiplexed concurrent streams over a single connection. Use one connection per conversation/user session. Defaults to PCM_22050_16 output format.

Connection Setup

Single Stream

Real-time Voice Agent Pattern

Pipe LLM output sentence-by-sentence into the WebSocket for continuous speech:
We will be building a context-aware streaming solution in the future, so you don’t have to worry about tokenization and sentence breaking. Stay tuned!

Concurrent Streams

Send multiple requests over the same connection — they are multiplexed and processed concurrently.

Cancel / Barge-in

Cancel in-flight streams when the user interrupts mid-response:

Stream Events

WebSocket Properties

WebSocket Methods