| title | Python SDK |
|---|---|
| icon | snake |
| description | Connect to Omi devices over Bluetooth, decode Opus audio, and transcribe in real-time using Deepgram |
A pip-installable Python SDK for connecting to Omi wearable devices over Bluetooth, decoding Opus-encoded audio, and transcribing it in real time using Deepgram.
Connect to any Omi device Decode Opus audio to PCM Deepgram-powered STTThe SDK requires the Opus audio codec library:
```bash brew install opus ``` ```bash sudo apt-get install libopus0 libopus-dev ``` ```bash sudo yum install opus opus-devel ``` ```bash sudo dnf install opus opus-devel ``` ```bash pip install omi-sdk ``` ```bash git clone https://github.com/BasedHardware/omi.git cd omi/sdks/python pip install -e . ```Get a free API key from [Deepgram](https://deepgram.com):
```bash
export DEEPGRAM_API_KEY=your_actual_deepgram_key
```
```bash
omi-scan
```
Look for a device named "Omi" and copy its MAC address:
```
0. Omi [7F52EC55-50C9-D1B9-E8D7-19B83217C97D]
```
# Configuration
OMI_MAC = "YOUR_OMI_MAC_ADDRESS_HERE" # From omi-scan
OMI_CHAR_UUID = "19B10001-E8F2-537E-4F6C-D104768A1214" # Standard Omi audio UUID
DEEPGRAM_API_KEY = os.getenv("DEEPGRAM_API_KEY")
async def main():
audio_queue = Queue()
decoder = OmiOpusDecoder()
def handle_audio(sender, data):
pcm_data = decoder.decode_packet(data)
if pcm_data:
audio_queue.put_nowait(pcm_data)
def handle_transcript(transcript):
print(f"Transcription: {transcript}")
# Save to file, send to API, etc.
# Start transcription and device connection
await asyncio.gather(
listen_to_omi(OMI_MAC, OMI_CHAR_UUID, handle_audio),
transcribe(audio_queue, DEEPGRAM_API_KEY, on_transcript=handle_transcript)
)
if __name__ == "__main__":
asyncio.run(main())
```
The example will:
- Connect to your Omi device via Bluetooth
- Decode incoming Opus audio packets to PCM
- Transcribe audio in real-time using Deepgram
- Print transcriptions to the console
| Function | Description |
|---|---|
omi.print_devices() |
Scan for Bluetooth devices |
omi.listen_to_omi(mac, uuid, handler) |
Connect to Omi device and receive audio |
omi.OmiOpusDecoder() |
Decode Opus audio to PCM |
omi.transcribe(queue, api_key) |
Real-time transcription via Deepgram |
| Command | Description |
|---|---|
omi-scan |
Scan for nearby Bluetooth devices |
git clone https://github.com/BasedHardware/omi.git
cd omi/sdks/python
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install in editable mode
pip install -e .
# Install dev dependencies
pip install -e ".[dev]"Make sure the Opus audio codec is installed on your system. See the Prerequisites section above for installation commands. Go to **System Preferences → Privacy & Security → Bluetooth** and grant access to Terminal and Python. The SDK requires Python 3.10 or higher. Check your version with `python --version`. Make sure your Omi device is powered on and nearby. Try running `omi-scan` to verify it's discoverable. The SDK uses `websockets>=11.0`. Try upgrading: `pip install --upgrade websockets`
MIT License — built by the community.
Compare all available SDKs View source code and contribute