Use this guide when you already have an Ambient session and need to stream live audio toDocumentation Index
Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
Use this file to discover all available pages before exploring further.
GET /ws/stream.
The WebSocket is only for sending live audio and control messages for the active stream. After streaming, use the Ambient REST APIs to end the session, poll status, and retrieve transcripts, notes, and structured data.
For endpoint details and code examples, refer to the Audio streaming API.
How Ambient streaming works
Suki for Partners Ambient streaming works as follows:- Create an Ambient session
- Open a WebSocket connection to
GET /ws/stream. - Send one
START_TIMEmessage for the stream segment. - Send one JSON message per audio chunk.
- Optionally send
EVENTmessages, such asPAUSE,RESUME, orKEEP_ALIVE, when control is needed. - Send the ambient end marker as the final
AUDIOmessage. - Close the socket, then use End Ambient session to end the session and retrieve results.
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.
Message format
Each outbound message is a JSON object with atype field. For messages that carry a payload, use the data field.
The data value must be:
- Standard Base64 (RFC 4648)
- An encoding of the raw bytes you intend to send
- Sent as a JSON string, regardless of the programming language you use
Start the stream segment
Send oneSTART_TIME message before the audio chunks for a stream segment:
data: Base64 of UTF-8 bytes of an RFC 3339 timestamp- Example timestamp:
2026-04-25T12:34:56Z
Send audio chunks
Send audio withtype set to AUDIO:
data: Base64 of raw PCM audio bytes
Send control events
Send control events withtype set to EVENT:
event field, not data. Supported values are PAUSE, RESUME, KEEP_ALIVE, CANCEL, and ABORT.
Common use cases:
- Pause or resume audio.
- Keep the connection alive.
- Cancel or abort a stream.
EVENT messages can appear at any point in the stream where control is needed.
End the stream segment
Send the finalAUDIO message with data set to RU9G:
RU9G is Base64 for ASCII EOF (0x45 0x4F 0x46).Required message order
For each stream segment:- Send one
START_TIMEmessage. - Send one or more
AUDIOmessages with Base64 PCM audio. - Send any
EVENTmessages when control is needed. - Send a final
AUDIOmessage withdataset toRU9G.
Complete the session after streaming
After sending the finalRU9G message, close the WebSocket connection and complete the ambient session with REST.
Close the WebSocket Connection
Close the WebSocket connection from the client when you are done sending audio for that segment.
End the Session Using REST
End the session using End ambient session.
Retrieve Results Using REST
Poll session status and fetch transcript and structured data using these REST APIs:
Final transcripts and notes are not guaranteed to arrive over WebSocket. Treat REST APIs as the source of truth.
Audio format and chunking
Use raw PCM audio chunks in eachdata message after Base64 decode.
PCM vs WAV
Raw PCM is audio data without a file container..wav is a container format and includes headers.
If your source is WAV, remove the 44-byte RIFF header, or decode the file to raw PCM before sending. Sending WAV headers as PCM reduces recognition quality and makes debugging harder.
Recommended audio format
- Encoding: LINEAR16, PCM signed 16-bit little-endian
- Channels: Mono
- Sample rate: 16 kHz
Chunk size
Send audio in small chunks during streaming. For 16 kHz, mono, 16-bit audio, about 3200 bytes per chunk is a common choice. For optimal performance, chunk the audio into 100 ms packets.Encode each chunk
For everyAUDIO message:
- Take raw PCM bytes.
- Encode the bytes using standard Base64 (RFC 4648).
- Send the encoded string as
data.
Example flow
This example shows the outbound message sequence for one ambient stream segment: oneSTART_TIME message, multiple AUDIO chunks, an optional EVENT, and the final RU9G end marker.
Troubleshooting
Sending WAV instead of PCM
Sending WAV instead of PCM
Symptom: Poor transcription or failuresFix: Strip the WAV header or decode to raw PCM.
Incorrect Base64 encoding
Incorrect Base64 encoding
Symptom: Server parse errorsFix: Use standard Base64 (RFC 4648), not URL-safe Base64 or hex.
Sending multiple JSON objects in one frame
Sending multiple JSON objects in one frame
Symptom: Server parse errorsFix: Send one JSON object per WebSocket frame.
Missing or incorrect EOF marker
Missing or incorrect EOF marker
Symptom: Stream does not finalizeFix: Send
RU9G as the final AUDIO message.Using data for EVENT messages
Using data for EVENT messages
Symptom: Ignored or invalid control messagesFix: Use the
event field.Skipping REST after streaming
Skipping REST after streaming
Symptom: Missing final transcriptFix: Always fetch results through REST APIs.