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
  • Complete the session after streaming
  • Retrieve the final or cumulative transcription results
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 and retrieve results.
Dictation streaming uses JSON text frames. Do not send raw binary audio frames to this endpoint.
Before you connect - Open GET /ws/transcribe only when the Dictation session is READY or IDLE. If the session is RUNNING because another audio stream is active, COMPLETED, or in another state that cannot accept speech, the WebSocket handshake fails. The server returns FailedPrecondition with a message such as transcript session is not accepting new speech sessions.
One Dictation session can support multiple speech sessions over time, such as push-to-talk. After you send AUDIO_END and the server finishes processing that stream, wait until the session returns to READY or IDLE before opening another WebSocket for the next utterance.

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

Close the socket, end the session, fetch results, and use the streaming error reference.

Dictation Streaming API

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

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 the Dictation tab in WebSocket 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, end the session, and fetch results.
Last modified on July 24, 2026