High-Level Flow
An end-to-end walkthrough of a Blynt API session with manual turn-taking and turn-level contextual biasing.
This section describes the high-level flow for using the Blynt API in its current production form: real-time French transcription with manual turn-taking and turn-level contextual biasing.
Prefer to run something first? Jump to the Stream a local audio file quickstart for a copy-paste client, then come back here for the message-by-message details.
The lifecycle of a session is:
- Open the WebSocket connection and send
start_session. - For each user turn: send
start_turn(optionally with biasing context), stream the audio, then sendend_turn. - Receive
turn_started,turn_partial, andturn_endedevents from the server for that turn. - Repeat step 2 for every subsequent turn on the same connection.
Starting a session
Start by opening the WebSocket with your API key for authentication (see the Connection and Authentication section for the endpoint and headers), then send a message to start the session:
{
"type": "start_session",
"language": "fr",
"turn_taking_mode": "manual"
}language: the language spoken by the user. The current API supportsfr(French).turn_taking_mode:manual, where the client explicitly marks the start and end of every turn.
See the start_session reference for the full message schema, and the server's session_started acknowledgement.
Starting a turn
Before the user speaks, send a start_turn message. From this point on, the engine transcribes the incoming audio for this turn.
You can attach a turnContext to bias recognition toward what you expect the user to say. This is the core contextualization feature, and it helps most in elicitation settings, where the answer is short and drawn from a finite, known set of values (the user is picking from a preset list). It is especially valuable for niche or specific vocabulary (brand names, product codes, proper nouns, domain jargon) that a general model may mis-transcribe.
{
"type": "start_turn",
"turnContext": {
"hints": [
{
"type": "values",
"name": "brand",
"values": ["Renault", "Peugeot", "Citroën", "Toyota", "Volkswagen"]
}
]
}
}When you have no idea what the user will say, omit turnContext entirely and the turn runs unbiased:
{
"type": "start_turn"
}See the start_turn reference for the full turnContext schema.
Streaming audio
Once the turn has started, stream the user's audio as binary WebSocket frames. Audio must be 16 kHz mono int16 PCM. All other protocol messages (such as start_turn / end_turn) are sent as JSON text frames. See the audio bytes reference for the format and chunking details.
Audio bytes sent before start_turn are not transcribed. Always send start_turn first, then begin streaming audio.
Receiving turn events
When the turn begins, you receive a turn_started message:
{
"type": "turn_started",
"turnId": "123"
}As the engine decodes audio, you receive incremental turn_partial events (the turn partials from the terminology):
{
"type": "turn_partial",
"turnId": "123",
"transcript": "oui c'est bien",
"turnAudioDuration": 2.3
}Ending a turn
When the user is done speaking, send end_turn:
{
"type": "end_turn"
}The server finalizes the transcription of the audio received so far and replies with a turn_ended event containing the final transcript:
{
"type": "turn_ended",
"turnId": "123",
"kind": "end_of_utterance",
"transcript": "oui c'est bien ça",
"turnAudioDuration": 4.7
}From here, repeat the start_turn → stream audio → end_turn cycle for every subsequent turn on the same connection.
For a complete, runnable client that puts this all together, see the Stream a local audio file quickstart.