Skip to main content

Multi-context TTS WebSocket

GET 

wss://api.knoxstudio.ai/v1/text-to-speech/:voice_id/multi-stream-input

Same transport as TTS WebSocket, but each context_id keeps its own generation state. Useful for interleaved voice-agent replies. GET and POST accept the upgrade. Stream formats only. Billed per character.

Request​

Path, query, and auth match Text-to-speech WebSocket: voice_id, model_id, stream output_format, enable_logging, apply_text_normalization. Plain HTTP returns 400.

Client messages​

{
"text": "First context ",
"context_id": "agent-a",
"try_trigger_generation": true
}

Flush or close a single context independently:

{ "context_id": "agent-a", "text": "", "flush": true }
{ "context_id": "agent-a", "close_context": true }

Terminate the whole socket with close_socket: true.

Server messages​

Audio frames include contextId so you can demux concurrent generations. isFinal applies to that context.

Use this API when you need concurrent or interleaved streams. For a single sequential stream, prefer /stream-input.

Error Responses​

Validation uses HTTP 422:

{
"detail": [
{
"loc": ["body", "field"],
"msg": "…",
"type": "value_error"
}
]
}

Other errors use { "detail": "message" }.

StatusWhen
400WebSocket path called without Upgrade: websocket.
401Missing or invalid API key.
402Insufficient credits.
403Token is not allowed to use this model.
404Resource not found.
422Validation error.
429Rate limit exceeded.
500Internal server error.