Client Session API
Connection, authentication, start_session, and streaming audio.
These messages set up and tear down a session. For an end-to-end walkthrough, see Starting a session and Streaming audio in the High-Level Flow.
Connection and authentication
To use the Blynt API, establish a WebSocket connection to your deployment endpoint:
wss://api.blynt.ai/api/v1/deployments/{deployment_id}/wsReplace {deployment_id} with the deployment identifier provided to you.
Authentication: The API uses Bearer token authentication. Include your API key in the Authorization header when establishing the WebSocket connection:
Authorization: Bearer YOUR_API_KEYConnection requirements:
- The WebSocket connection must be established using the
wss://protocol (secure WebSocket). - All JSON messages must be sent as text WebSocket frames.
- All audio data must be sent as binary WebSocket frames.
- The first message sent after opening the connection must be
start_session.
start_session (Client to Server message)
This must be the first message sent after opening the connection. The server closes the connection if any other message is sent first. Send this message only once per session.
The start_session payload includes:
type(required): Must bestart_session.language(required): The language spoken by the user. Currently supported:fr(French).turn_taking_mode(optional): How turn boundaries are determined. Currently supported:manual, where the client explicitly signals both turn start (viastart_turn) and turn end (viaend_turn). Defaults tomanual. See Turn-taking mode.
Example:
{
"type": "start_session",
"language": "fr",
"turn_taking_mode": "manual"
}Audio bytes (Client to Server message)
Send the user's audio as binary WebSocket frames, in 16 kHz mono int16 PCM format.
There is no enforcement on the size of the audio chunks: the Blynt API takes care of splitting or merging audio chunks to the proper size for the underlying model.
Audio bytes are only transcribed within a turn. Any audio sent before a start_turn message is ignored. See start_turn.
Ending a session
There is no explicit end-session message. A session lasts for the lifetime of the WebSocket connection. To end it, simply close the connection from the client. The server then finalizes any in-progress work and releases the session.
The server acknowledges a successful start_session with a session_started event. The server may also close the connection itself when it sends an error (for example, if start_session is sent twice).