WebSocket Endpoints
Media Studio WebSocket Endpoint Catalog¶
This document lists WebSocket endpoints exposed by Media Studio. It mirrors the structure of the HTTP endpoint catalog, but is limited to WebSocket routes.
Text-To-Speech¶
/api/v1/elevenlabs/audio/stream¶
Method: WebSocket
Description: Bidirectional WebSocket endpoint for real-time text-to-speech streaming. Receives JSON payloads and streams back audio chunks.
Message Format (JSON):
- text or text_url (one required): Text to synthesize or URL to text input.
- voice_id (required): ElevenLabs voice ID.
- model_id (required): ElevenLabs model ID.
- language_code (optional language hint): Hint for the input text language.
- stability (optional, default 0.5): Must be one of 0.0, 0.5, 1.0.
- similarity_boost (optional, default 0.7): Float in 0.0–1.0.
- output_format (optional, default "pcm_16000"): Output format string.
Validation Notes:
- text/text_url: one required, and cannot be empty.
- text_url must be a valid http(s) URL.
- voice_id cannot be empty.
- model_id must be a supported ElevenLabs model ID.
- stability must be one of 0.0, 0.5, 1.0.
- language_code does not translate text. Provide target-language text for non-English audio.
Examples (JSON message payloads):
1) Minimal (defaults for optional fields)
2) Text URL input
{
"text_url": "https://example-files.online-convert.com/document/txt/example.txt",
"voice_id": "CwhRBWXzGAHq8TQ4Fs17",
"model_id": "eleven_turbo_v2_5"
}
3) Natural stability with higher similarity
{
"text": "A calm and steady delivery.",
"voice_id": "CwhRBWXzGAHq8TQ4Fs17",
"model_id": "eleven_multilingual_v2",
"stability": 0.5,
"similarity_boost": 0.9
}
4) Creative style (lower stability)
{
"text": "Add a bit more expressiveness.",
"voice_id": "CwhRBWXzGAHq8TQ4Fs17",
"model_id": "eleven_flash_v2_5",
"stability": 0.0,
"similarity_boost": 0.6
}
5) Robust stability (more consistent)
{
"text": "Maintain a consistent tone.",
"voice_id": "CwhRBWXzGAHq8TQ4Fs17",
"model_id": "eleven_turbo_v2_5",
"stability": 1.0,
"similarity_boost": 0.7
}
6) Different output format
{
"text": "Stream this as ulaw.",
"voice_id": "CwhRBWXzGAHq8TQ4Fs17",
"model_id": "eleven_multilingual_v2",
"output_format": "ulaw_8000"
}
Behavior:
- The server streams audio chunks back over the same WebSocket.
- A final JSON message is sent with { "event": "completed" } when done.
Postman (WebSocket) Quick Start:
- URL:
ws://localhost:8527/api/v1/elevenlabs/audio/stream - Headers:
X-API-Key:<your-api-key>- Message (JSON):