Quick summary
Streaming sends live visit audio to Suki over WebSocket after you create a session and seed context. The WebSocket carries JSON text frames for audio and control messages. Final notes, form fields, transcripts, and structured data come from the matching product REST APIs after you end the session.
GET /ws/stream after you create an ambient session and seed context. The WebSocket is used only to send audio and exchange control messages. Use other Ambient REST APIs to end the session, check processing status, and retrieve transcripts, notes, and structured data.
Form filling sessions use the same Partner WebSocket and the same ambient message protocol. If you are building clinical documentation workflows, including note sections, review experiences, and EHR handoff, start with Ambient clinical documentation.
Streaming audio with the Ambient APIs lets you:
- Capture audio from your own backend, mobile app, or custom client.
- Stream visit audio in small chunks while the encounter is in progress.
- Pause, resume, or keep a paused stream alive by sending
EVENTmessages. - Complete the stream and retrieve results through the Ambient REST APIs.
Before you begin
To stream audio successfully, your application must:- Authenticate and obtain an
sdp_suki_token. - Create an ambient session and seed context before opening the WebSocket connection.
- Capture mono LINEAR16 PCM audio at 16 kHz, split it into chunks, Base64 encode each chunk, and send each message as a JSON text frame.
- Close the WebSocket when streaming is complete, call End ambient session, and retrieve transcripts, notes, and structured data using the Ambient REST APIs.
-
Both Form filling and Ambient clinical note sessions use the parameter name
ambient_session_idin the API reference. Those identifiers refer to different sessions. -
Use only the ID returned from Form filling Create Form filling session for Form filling REST calls and for
/ws/stream. Refer to Form filling basic usage.
When to use Ambient or Form filling streaming vs Dictation streaming
Ambient or Form filling streaming and Dictation streaming solve different problems.- Use Ambient or Form filling streaming (
GET /ws/stream) when you want to push visit audio into an ambient or Form filling session for note generation or form output. You retrieve results mainly with REST after you end the session. - Use Dictation streaming (
GET /ws/transcribe) when the provider needs real-time transcript text in your application. Refer to Stream Dictation audio.
Decide before you build your streaming client
Before you implement production streaming, align on a few engineering decisions. Agree on who owns capture, what the WebSocket owns versus REST, when you may open or reconnect the socket, how you handle pause and keep-alive, and which audio format you will send. Those choices shape handshake behavior, reconnect logic, and how you retrieve results. Use the following sections to align your team.Who Owns Capture and the WebSocket Client
Who Owns Capture and the WebSocket Client
This guide is for Ambient APIs. Your application owns the microphone or media pipeline, PCM chunking, Base64 encoding, the WebSocket client, and the session lifecycle on
GET /ws/stream.If you do not want to own that streaming stack, choose a different capture path:- Web SDK: Suki provides browser capture and review UI. Your application supplies encounter context and handles note handoff after submit.
- Headless Web SDK: Your React application owns recording controls, status, and review UI through SDK hooks, not the Partner WebSocket wire format in this guide.
What the WebSocket Owns vs What REST Owns
What the WebSocket Owns vs What REST Owns
/ws/stream streams audio and accepts control messages such as PAUSE, RESUME, CANCEL, and KEEP_ALIVE. It does not replace session create, end session, or result retrieval.After you send the ambient end marker and close the socket:- End the session with End ambient session.
- Poll status and fetch transcript, note content, and structured data with ambient content REST APIs.
Session Readiness and Reconnect Rules
Session Readiness and Reconnect Rules
Create the ambient session and seed context before you open
/ws/stream.You can reconnect to /ws/stream using the same ambient_session_id only while the session status is CREATED. Otherwise the handshake returns FailedPrecondition. Refer to Audio capture best practices and Complete the session after streaming.Pause, Keep-Alive, and Idle Timeouts
Pause, Keep-Alive, and Idle Timeouts
While audio is flowing, send audio at least once every 25 seconds, or Suki disconnects the stream.While the stream is paused, send a
KEEP_ALIVE event at least every 5 seconds. An ambient session can remain paused for up to 30 minutes when keep-alives are maintained.Refer to Audio capture best practices and Streaming architecture.Audio Format and Session Length
Audio Format and Session Length
Capture mono LINEAR16 (PCM signed 16-bit little-endian) at 16 kHz. Stream about 100 ms chunks. At that rate, each chunk is about 3200 bytes of raw PCM. Base64 encode the bytes in the Refer to Audio capture best practices and WebSocket streaming wire format.
data field and stream at or near real-time speed. Strip WAV headers before you encode.Sessions shorter than 1 minute may not contain enough audio for note generation and can be marked as
skipped.How Ambient or Form filling streaming works
1
Create Session and Seed Context
Create an Ambient session and Seed session context.
2
Open the WebSocket
Open a WebSocket connection to
GET /ws/stream.3
Send START_TIME
Send one
START_TIME message for the stream segment.4
Stream Audio Chunks
Send one JSON message per audio chunk.
5
Send Optional EVENT Messages
Optionally send
EVENT messages, such as PAUSE, RESUME, or KEEP_ALIVE, when control is needed.6
Send the Ambient End Marker
Send the ambient end marker as the final
AUDIO message with data: RU9G.7
Close the Socket and Finish with REST
Close the socket, then use End ambient session to end the session and retrieve results.
Verify your first Ambient stream
Before you design the full production streaming client, confirm that your staging integration can complete the core path:- Authenticate successfully and use the returned
sdp_suki_tokenin follow-up REST and WebSocket requests. - Create an ambient session, seed context, and store the returned
ambient_session_id. - Open
/ws/stream, sendSTART_TIME, stream mono PCM chunks, sendRU9G, and close the socket. - End the session and confirm that you can retrieve transcript or note content with REST.
Send JSON text frames
Every message you send on/ws/stream must be a UTF-8 JSON text frame.
- Each WebSocket frame must contain exactly one JSON object.
- Each client
sendshould contain one logical message. - Audio bytes go inside a JSON string field, not in a binary WebSocket frame.
Audio streaming recommendations
Sample Rate of 16 kHz
Suki streams audio at 16 kHz, which captures the full range of clinical speech.
Mono Channel
Send a single mono channel of audio, not stereo or multi-channel.
LINEAR16 Encoding
Encode as LINEAR16 (PCM signed 16-bit little-endian). Remove WAV headers or decode to raw PCM before you send.
Audio Chunk Size of 100 ms
Suki supports 100 ms chunks to balance recognition quality, latency, and efficiency. At 16 kHz mono 16-bit, that is about 3200 bytes of raw PCM per chunk.
Stream at Real-Time Speed
Pace audio chunks to match their actual duration and stream at or near real time, rather than sending buffered audio as fast as possible.