Skip to main content
This guide explains how to stream live audio to GET /ws/transcribe after creating a Dictation session. The WebSocket is responsible only for streaming audio and receiving real-time transcript frames. Use the Dictation REST APIs to:
  • Create a Dictation session before streaming.
  • End the session after streaming.
Read partial and final transcript frames from the socket. End Dictation session returns an empty body. Keep the text from frames where is_final is true. For related guides:

Click Each Button to Learn More

How Dictation streaming works

Suki for Partners Dictation streaming works as follows:
  1. Create or reuse a Dictation session.
  2. Open a WebSocket connection to GET /ws/transcribe.
  3. Send one JSON message per audio chunk.
  4. Send an explicit end-of-audio message when the user stops speaking.
  5. Read partial and final transcript messages from the socket.
  6. Close the socket, then use End Dictation session to end the Dictation session. End does not return the transcript.
Dictation streaming uses JSON text frames. Do not send raw binary audio frames to this endpoint.

Before you connect

  • Create the Dictation session first, then open GET /ws/transcribe. One speech stream can be open on that transcription_session_id at a time.
  • There is no partner status API for Dictation (READY, IDLE, RUNNING). Do not poll those states. If another speech stream on the same session is still finishing, the handshake fails with FailedPrecondition (for example transcript session is not accepting new speech sessions).
  • After you send AUDIO_END and receive EOF, wait about 5 seconds before you open the next WebSocket on the same session. Use that wait for push-to-talk and for reconnect after a drop.

Send JSON text frames

Every message you send on /ws/transcribe must be a UTF-8 JSON text frame.
  • Each WebSocket frame must contain exactly one JSON object.
  • Each client send should contain one logical message.
  • Audio bytes go inside a JSON string field, not in a binary WebSocket frame.
Do not:
  • Send binary WebSocket frames for audio data on this JSON-based protocol.
  • Send more than one JSON object in a single frame.
  • Use HTTP endpoints to stream raw audio.
If the server receives a non-JSON payload where JSON is expected, parsing can fail with errors such as invalid character or null byte errors.

Audio streaming recommendations

Sample Rate of 16 kHz

Stream Dictation audio at 16 kHz, which matches the capture rate used in the Dictation streaming examples.

Mono Channel

Send a single mono channel of audio, not stereo or multi-channel.

PCM_S16LE Encoding

Encode as PCM_S16LE (PCM signed 16-bit little-endian). Remove WAV headers or decode to raw PCM before you send.

About 100 ms per Chunk

For 16 kHz, mono, 16-bit audio, about 3200 bytes per chunk is about 100 ms of audio. Size chunks to your capture pipeline if your encoder differs.

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.
For encoding steps and message order, see WebSocket streaming wire format. For capture guidance before you open the socket, see Audio capture best practices.

References

Wire Format

Message types, send order, example flow, and how to format and chunk audio.

Audio Capture Best Practices

Capture format, environment, gain, and network readiness before you stream.

Dictation Transcript Frames

Partial and final transcript messages, interim vs final commit, and insertion spacing.

Complete the Session

End the session after you finish reading WebSocket frames. End returns an empty body.

Dictation Streaming API

Endpoint details, handshake steps, and code samples for the Dictation WebSocket.

Available cookbooks

DictationAPI

End Dictation with AUDIO_END

Use AUDIO_END, not ambient RU9G.

5 min

Available tutorials

Dictation

Build a Dictation Streaming Client

Create a transcription session, stream audio, read partial frames, and print the final transcript.

15 minIntermediate

Next steps

Continue in this order: Open Dictation streaming wire format for message types, send order, and audio chunking. Read Dictation transcript frames to handle partial and final transcript messages in your UI. Follow Complete the session after streaming to close the socket and end the session. Keep is_final transcript frames from the WebSocket.
Last modified on August 20, 2026