Skip to main content
WSS /api/v1/generate/ws The WebSocket endpoint delivers generated audio as a stream of binary PCM chunks, enabling lower-latency playback compared to the HTTP endpoint. Supported models: higgs2p5, chatterbox, qwen3-tts

Protocol

The WebSocket session follows a 3-message handshake:
1

Connect

Open a WebSocket connection to wss://api-web.eigenai.com/api/v1/generate/ws.
2

Authenticate

Send a JSON auth message immediately after connecting:
3

Send TTS request

Send a JSON message with your synthesis parameters:
The server then sends:
  • Binary frames — raw PCM audio chunks (16-bit, 24 kHz, mono)
  • {"type": "complete"} — JSON frame signaling end of stream

Parameters

Parameters in the TTS request JSON match those of the HTTP endpoint for each model. See Generate Audio for the full parameter list per model.

Examples

The binary frames contain raw PCM audio: 16-bit signed integers, 24 kHz sample rate, mono channel. Use a library like soundfile (Python) or AudioContext (browser) to decode and play.