WebSocket
Many streaming synthesis requests on one connection. Each request runs exactly like POST /v1/text-to-speech/stream: the same validation, billing and limits.
The WebSocket guide covers ordering, cancellation, errors, limits and close codes.
- You send: One JSON text message per synthesis request, or a cancel for a context.
- You receive: Zero or more chunks per request, then exactly one done or error; one cancelled per cancel.
Handshake
Authentication
API key for authentication. Example: raya_ABCD1234567890abcdef
Send
Stops the context’s running request and drops the ones queued behind it. Answered by exactly one cancelled; nothing sent before the cancel arrives after it.
Receive
Base64 audio of one request, in the request’s output_format.
Ends one request only; the connection and other contexts carry on. status_code is the HTTP status the same failure gets on the streaming endpoint, and the endpoint’s error fields are included. An error with neither context_id nor request_id is about a message that was not a request.

