Skip to navigation

tts

Real-time text-to-speech synthesis channel.

Handshake

WSS
wss://tts.api.kotobatech.ai/v2/tts/ws

Authentication

AuthorizationBearer

Bearer-token authentication. Send the API key in the Authorization: Bearer <api_key> header during the WebSocket handshake.

Send

clientOpenSessionobjectRequired
First frame after the WebSocket handshake. Selects the language and speaker for all responses sent on this connection.
OR
clientCreateResponseobjectRequired
Send the full text in a single frame. The server streams audio chunks back until it emits `audio.chunk` with `isFinal=true` followed by `response.done`. Only one response can be active at a time per connection.
OR
clientCancelResponseobjectRequired
Aborts the currently active response. The server replies with `response.done` carrying `status: "cancelled"`.

Receive

serverReceiveEventsobjectRequired
Receives session creation, response lifecycle markers, audio chunks, and terminal status frames.
OR
serverReceiveEventsobjectRequired
Receives session creation, response lifecycle markers, audio chunks, and terminal status frames.
OR
serverReceiveEventsobjectRequired
Receives session creation, response lifecycle markers, audio chunks, and terminal status frames.
OR
serverReceiveEventsobjectRequired
Receives session creation, response lifecycle markers, audio chunks, and terminal status frames.
OR
serverReceiveEventsobjectRequired
Receives session creation, response lifecycle markers, audio chunks, and terminal status frames.
OR
serverReceiveEventsobjectRequired
Receives session creation, response lifecycle markers, audio chunks, and terminal status frames.