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

# Real-Time Audio Streaming

> Stream audio bytes from your Omi device to any backend service in real time.

## Overview

Omi streams raw audio bytes from your device to any webhook endpoint you configure. Use this to build custom audio processing, live transcription, or recording workflows.

<CardGroup cols={3}>
  <Card title="Any Backend" icon="server">
    Stream to your own server, cloud function, or local dev environment
  </Card>

  <Card title="Configurable Interval" icon="clock">
    Choose how often you receive audio chunks (e.g. every 5, 10, or 30 seconds)
  </Card>

  <Card title="Raw Audio" icon="waveform">
    Receive raw PCM bytes — add a WAV header to save as audio files
  </Card>
</CardGroup>

***

## Setup

<Steps>
  <Step title="Create a Webhook Endpoint" icon="webhook">
    Build an endpoint that accepts POST requests with raw audio bytes.

    Omi sends requests in this format:

    ```
    POST /your-endpoint?sample_rate=16000&uid=user123
    Content-Type: application/octet-stream

    [raw audio bytes]
    ```

    | Parameter     | Description                                      |
    | ------------- | ------------------------------------------------ |
    | `sample_rate` | Audio samples per second (see table below)       |
    | `uid`         | The user's unique ID in Omi                      |
    | Body          | Raw PCM audio bytes (`application/octet-stream`) |

    <Accordion title="Sample Rates by Device" icon="microchip">
      | Device             | Sample Rate |
      | ------------------ | ----------- |
      | Omi (consumer)     | 16,000 Hz   |
      | DevKit 2           | 16,000 Hz   |
      | DevKit 1 (v1.0.4+) | 16,000 Hz   |
      | DevKit 1 (v1.0.2)  | 8,000 Hz    |
    </Accordion>
  </Step>

  <Step title="Configure in the Omi App" icon="mobile">
    1. Open the Omi app
    2. Go to **Settings → Developer Mode**
    3. Scroll to **Realtime audio bytes**
    4. Enter your webhook URL
    5. Set the interval (e.g. `10` for every 10 seconds)
  </Step>

  <Step title="Verify" icon="check">
    Audio bytes should start arriving at your endpoint. The data is raw PCM — to save as a playable audio file, prepend a WAV header to the accumulated bytes.
  </Step>
</Steps>

***

## Example: Save to Google Cloud Storage

A complete example that saves audio chunks as WAV files in GCS.

<Steps>
  <Step title="Set Up GCS" icon="cloud">
    Follow the [Cloud Audio Storage](/doc/developer/savingaudio) guide to create a bucket and get credentials.
  </Step>

  <Step title="Deploy the Example" icon="rocket">
    1. Fork [github.com/mdmohsin7/omi-audio-streaming](https://github.com/mdmohsin7/omi-audio-streaming)
    2. Clone and deploy to any cloud provider (GCP, AWS, DigitalOcean) or run locally with [ngrok](https://ngrok.com/)
    3. Set these environment variables:

    | Variable                              | Value                  |
    | ------------------------------------- | ---------------------- |
    | `GOOGLE_APPLICATION_CREDENTIALS_JSON` | Base64-encoded GCP key |
    | `GCS_BUCKET_NAME`                     | Your bucket name       |

    The repo includes a Dockerfile for easy deployment.
  </Step>

  <Step title="Connect" icon="link">
    Set the endpoint in the Omi app under **Realtime audio bytes** to:

    ```
    https://your-deployment.com/audio
    ```

    Audio files will appear in your GCS bucket at the configured interval.
  </Step>
</Steps>

***

## Related

<CardGroup cols={2}>
  <Card title="Cloud Audio Storage" icon="cloud-arrow-up" href="/doc/developer/savingaudio">
    Set up GCS bucket and credentials
  </Card>

  <Card title="Build Apps" icon="puzzle-piece" href="/doc/developer/apps/Introduction">
    Create Omi apps with audio capabilities
  </Card>
</CardGroup>
