Skip to main content
Audixa provides a WebSocket endpoint for real-time text-to-speech streaming, allowing you to play audio as it is being generated.
Compatible with wav and mp3 output formats.

Connection

Endpoint

Authentication

Pass your API key as a query parameter:

Protocol

1. Send Request

Once connected, send a JSON payload with your generation details:

2. Receive Messages

The server will send a mix of JSON control messages and binary audio data. A. Started Message (JSON) Sent when processing begins.
B. Audio Chunks (Binary) Raw binary audio data streams immediately after the “started” message. See Audio Format below for decoding details. Append these chunks to your audio buffer or play them directly. C. Completion (JSON) Sent when the stream ends.
D. Error (JSON)

Audio Format

All binary audio chunks are streamed in a standardized format, consistent across all models (base, advanced, turbo):
The streamed chunks are raw PCM float32 — not WAV or MP3. Each sample is a 4-byte IEEE 754 float, typically in the range [-1.0, 1.0]. You must decode them as float32, not int16, or the audio will sound like static noise.
The completed message includes an audio_url pointing to the fully encoded file (WAV/MP3) on the CDN. You can use this as a fallback or for saving a complete copy.

Examples

Real-Time Playback

Play audio chunks as they arrive for the lowest perceived latency.

Save to File

Collect all audio chunks and save a complete file when the stream ends.

Other Languages & CLI

WebSocket is a bidirectional protocol — standard HTTP tools like cURL cannot be used for streaming. For CLI testing, you can use websocat, though binary audio handling is limited in terminal tools.For any language with a WebSocket client, the decoding rules are the same:
  • Connect to wss://api.audixa.ai/v3/tts/stream?api_key=YOUR_KEY
  • Send a JSON request, then listen for messages
  • Text messages → JSON control events (started, completed, error)
  • Binary messages → Raw PCM audio: float32, little-endian, 24 kHz, mono (4 bytes per sample)

WebSocket Close Codes

The server received data it cannot accept (e.g., malformed JSON, missing fields, or validation errors).
Authentication failed (e.g., invalid or missing API key).
An unexpected condition prevented the server from fulfilling the request (e.g., database or Redis connection failure).