> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream Ambient Audio - Overview

> Overview: Stream Ambient audio over WebSocket on GET /ws/stream, then retrieve final results with REST APIs

This guide explains how to stream live audio to <Badge color="blue" size="sm">GET /ws/stream</Badge> after creating an ambient session.
The WebSocket is responsible only for streaming audio and receiving control messages. Use the ambient REST APIs to:

* End the session after streaming
* Poll session status and retrieve transcripts, notes, and structured data

For related guides:

<Accordion title="Click Each Button to Learn More" defaultOpen={true}>
  <div className="doc-guide-btn-row">
    <a href="/api-reference/ambient-sessions/audio-stream" className="doc-guide-btn">
      Audio Streaming API
    </a>

    <a href="/documentation/how-to/audio-streaming/audio-stream" className="doc-guide-btn">
      Streaming Comparison
    </a>

    <a href="/documentation/how-to/audio-streaming/streaming-architecture" className="doc-guide-btn">
      Architecture Diagram
    </a>
  </div>
</Accordion>

## How Ambient streaming works

Suki for Partners ambient streaming works as follows:

1. Create an [Ambient session](/api-reference/ambient-sessions/create) and [Seed session context](/api-reference/ambient-sessions/context).
2. Open a WebSocket connection to **`GET /ws/stream`**.
3. Send one **`START_TIME`** message for the stream segment.
4. Send one JSON message per audio chunk.
5. Optionally send **`EVENT`** messages, such as **`PAUSE`**, **`RESUME`**, or **`KEEP_ALIVE`**, when control is needed.
6. Send the ambient end marker as the final **`AUDIO`** message.
7. Close the socket, then use [End ambient session](/api-reference/ambient-sessions/end) to end the session and retrieve results.

<Warning>
  Ambient streaming uses JSON text frames. Do not send raw binary audio frames to this endpoint.
</Warning>

## 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 **`send`** should contain **one logical message**.
* Audio bytes go inside a **JSON string field**, not in a binary WebSocket frame.

<Warning>
  Do not:

  * Send binary WebSocket frames.
  * Send multiple JSON objects in one frame.
  * Stream raw audio through HTTP, for example with **`Content-Type: application/json`**.

  <Note>
    If the server receives non-JSON payloads, it returns parsing errors, such as invalid character or null byte errors.
  </Note>
</Warning>

## Audio streaming recommendations

<CardGroup cols={2}>
  <Card title="Sample Rate of 16 kHz" icon="waveform">
    Suki streams audio at **16 kHz**, which captures the full range of clinical speech.
  </Card>

  <Card title="Mono Channel" icon="microphone">
    Send a **single mono channel** of audio, not stereo or multi-channel.
  </Card>

  <Card title="LINEAR16 Encoding" icon="file-audio">
    Encode as **LINEAR16** (PCM signed 16-bit little-endian). Remove WAV headers or decode to raw PCM before you send.
  </Card>

  <Card title="Audio Chunk Size of 100 ms" icon="clock">
    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.
  </Card>
</CardGroup>

<Card title="Stream at Real-Time Speed" icon="gauge">
  Pace audio chunks to match their actual duration and stream at or near real time, rather than sending buffered audio as fast as possible.
</Card>

For encoding steps and the message order, see [WebSocket streaming wire format](/documentation/how-to/audio-streaming/websocket-streaming-wire-format#audio-format-and-chunking). For capture guidance before you open the socket, see [Audio capture best practices](/documentation/how-to/audio-streaming/audio-capture-best-practices).

## References

<CardGroup cols={2}>
  <Card title="Wire Format" icon="code" href="/documentation/how-to/audio-streaming/websocket-streaming-wire-format" arrow={true}>
    Ambient message types (`START_TIME`, `AUDIO`, `EVENT`, `RU9G`), required order, example flow, and audio format and chunking.
  </Card>

  <Card title="Audio Capture Best Practices" icon="microphone" href="/documentation/how-to/audio-streaming/audio-capture-best-practices" arrow={true}>
    Capture format, environment, gain, and network readiness before you stream.
  </Card>

  <Card title="Complete the Session" icon="circle-check" href="/documentation/how-to/audio-streaming/websocket-streaming-complete-session" arrow={true}>
    Close the socket, end the session with REST, fetch results, and use the streaming error reference.
  </Card>

  <Card title="Ambient Client Code Example" icon="terminal" href="/documentation/tutorials/ambient-websocket-code-example" arrow={true}>
    End-to-end Python, TypeScript, and Go example: login, create session, seed context, stream, and handle errors.
  </Card>

  <Card title="Audio Streaming API" icon="book" href="/api-reference/ambient-sessions/audio-stream" arrow={true}>
    Endpoint reference, handshake details, and API code samples for `GET /ws/stream`.
  </Card>
</CardGroup>

## Available tutorials

<div className="hp-io-method-grid tut-hub-card-grid">
  <a className="hp-io-method-card tut-hub-method-card" href="/documentation/tutorials/ambient-websocket-code-example">
    <div className="tut-hub-card-media" aria-hidden="true" />

    <div className="hp-io-method-card-body">
      <span className="hp-wn-badge hp-wn-badge-new">Ambient</span>
      <h3 className="hp-io-method-card-title">Build an Ambient Streaming Client</h3>

      <p className="hp-io-method-card-desc">
        Authenticate, create a session, stream PCM audio over WebSocket, and retrieve clinical note results.
      </p>

      <div className="hp-io-method-card-meta tut-hub-card-foot" aria-label="20 min, Intermediate">
        <div className="tut-hub-card-foot-meta">
          <span className="hp-io-method-card-meta-time">20 min</span>
          <span className="tut-hub-level">Intermediate</span>
        </div>
      </div>
    </div>
  </a>
</div>

## Next steps

<Icon icon="file-lines" iconType="solid" /> Open the ambient tab in [WebSocket streaming wire format](/documentation/how-to/audio-streaming/websocket-streaming-wire-format)

<Icon icon="file-lines" iconType="solid" /> Follow [Complete the session after streaming](/documentation/how-to/audio-streaming/websocket-streaming-complete-session)

<Icon icon="file-lines" iconType="solid" /> Copy the [Ambient WebSocket client code example](/documentation/tutorials/ambient-websocket-code-example)
