py-xiaozhi
py-xiaozhi is a lightweight, cross-platform multi-modal AI interaction framework built on Python’s async architecture.
- Hardware:
- PC or Raspberry Pi, mic/speaker
- Difficulty:
- Beginner · Our suggestion
- License:
- MIT
- Creator:
- huangjunsen0406
Python XiaoZhi client for Windows, macOS, Linux and ARM boards

- Posted
What it does
py-xiaozhi is a lightweight, cross-platform multi-modal AI interaction framework built on Python’s async architecture. It supports real-time voice streaming, vision-language tasks and IoT device control, on Windows, macOS and Linux desktops and ARM embedded platforms (Raspberry Pi, Horizon Robotics RDK, Jetson Nano).
- Real-time voice AI: Opus codec with auto frame detection, async streaming, sub-20ms latency.
- Camera capture plus vision-language model integration for image understanding and scene perception.
- A modular JSON-RPC 2.0 MCP tool server: music player, camera, screenshot, app management, weather, volume control.
- Offline wake word: Sherpa-ONNX on-device keyword spotting with custom wake word support.
- A GPIO interface for robotics control, hardware actuation and sensor integration.
What you need
- Difficulty
- Beginner · Our suggestion
- License
- MIT (source)
Parts
- Computer: Windows 10+ / macOS 10.15+ / Linux (x86_64 & ARM)
- Microphone and speaker devices
- Camera device [optional]
- AI model or service
- Sherpa-ONNX offline wake word, vision-language model integration, MCP tool server
Prices, notes and sources: Parts and requirements
Parts and requirements
| Part | Spec / notes | Needed | Price |
|---|---|---|---|
| Computer: Windows 10+ / macOS 10.15+ / Linux (x86_64 & ARM) | Optimized for Raspberry Pi and edge boards | Required | |
| Microphone and speaker devices | Required | ||
| Camera device | For camera features, with OpenCV support | Optional |
- Computer for setup: Python 3.10 - 3.12 on Windows 10+, macOS 10.15+ or Linux; at least 4GB RAM (8GB+ recommended)
- A stable internet connection (for AI services and online features)
Steps
- Difficulty
- Beginner · Our suggestion
- Clone the project
- uv sync (add --extra gui for the GUI)
- python main.py, or python main.py --mode cli
Full instructions: View original
How it works
A Python app in GUI, CLI or GPIO mode handles real-time voice with the Opus codec, talks over WebSocket or MQTT, spots an offline wake word with Sherpa-ONNX and exposes MCP tools through a JSON-RPC 2.0 tool server.
| Layer | Component | Runs on |
|---|---|---|
| Client | py-xiaozhi (PySide6 + QML GUI / CLI / GPIO) | Windows, macOS, Linux desktops, and ARM embedded platforms (Raspberry Pi, Horizon Robotics RDK, Jetson Nano) |
| Wake word | Sherpa-ONNX keyword spotting | On-device |
Setup effort
Clone the repo, install with uv (or pip), then run main.py in GUI or CLI mode.
Limits and caveats
- Needs a stable internet connection (for AI services and online features).
- Manually reinstall pip dependencies after each update to get new dependencies.
Like this build? Get the weekly builds
Every Thursday: the 5 best gadget hacks you can copy. Free.
Built something? Submit a build
The creator's config
Copied word for word from the creator's repository, at the commit linked in each source.
Run modes and protocol
# Run program - GUI mode (default; requires gui extra) python main.py # Run program - CLI mode (base install is enough) python main.py --mode cli # Specify communication protocol python main.py --protocol websocket # WebSocket (default) python main.py --protocol mqtt # MQTT protocol
Use-case ideas
- Robotics control, hardware actuation and sensor integration over GPIO.
Why it's interesting
py-xiaozhi is a lightweight, cross-platform multi-modal AI interaction framework built on Python’s async architecture, and it evolved from the xiaozhi-esp32 firmware project. The README says it is deployable across Windows, macOS and Linux desktops and ARM embedded platforms such as the Raspberry Pi, Horizon Robotics RDK and Jetson Nano. Voice uses the Opus codec with async streaming, a camera can feed a vision-language model for image understanding, and a modular JSON-RPC 2.0 MCP tool server covers a music player, camera, screenshots, app management, weather and volume control. It runs as a PySide6 + QML GUI, a CLI or a GPIO interface, with Sherpa-ONNX on-device keyword spotting for an offline wake word. D-Robotics (xiaozhi-in-rdk) officially adopted it as an upstream dependency, and there is a separate Electron desktop client, xiaozhi-desktop, with AEC echo cancellation. The original XiaoZhi ESP32 firmware is also on HardwareLab.
Hardware
- PC or Raspberry Pi
- mic/speaker
Credits and links
- huangjunsen0406: Creator
- Xiaoxia (78): xiaozhi-esp32, which py-xiaozhi evolved from
- License: MIT (source)
This page is a short summary written by HardwareLab. Build steps, code and photos belong to the creator; follow “View original” for the full project.
Featured? Add this badge
Built this? Paste the badge into your README. It links back to this page.
Markdown
[](https://hardwarelab.dev/projects/py-xiaozhi/?utm_source=badge&utm_medium=referral&utm_campaign=launch_2w)HTML
<a href="https://hardwarelab.dev/projects/py-xiaozhi/?utm_source=badge&utm_medium=referral&utm_campaign=launch_2w"><img src="https://hardwarelab.dev/badge.svg" alt="Featured on HardwareLab" width="188" height="20"></a>Related builds
All 44 in Voice Assistants & Companions
Whisplay offline voice assistant
A battery-powered Pi 5 voice assistant that works offline.
- Raspberry Pi 5 8GB
- PiSugar Whisplay HAT (LCD/mics/speaker/button)
- PiSugar 3 Plus 5000mAh
- +1 more
Beginner533Bring-your-own-key smart speaker
A Pi smart speaker where nothing leaves your network unless you say so.
- Raspberry Pi
- mic
- speaker
BeginnerPrivate offline Pi voice assistant
Whisper + a small LLM + Piper, all on a Pi.
- Raspberry Pi
- mic
- speaker
Beginner
LilL3x
A modular Pi desk sidekick that starts the conversation when it sees you.
- Raspberry Pi 4 Model B
- Seeed ReSpeaker 2-Mics Pi HAT
- Pi Camera
- +2 more
Beginner7
AImy
Offline vision-enabled voice assistant on a Pi 5 with an LLM accelerator.
- Raspberry Pi 5
- LLM-8850 accelerator
- camera
Advanced23
Sources
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L72
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L73
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L74
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L77
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L78
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L197-L205
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L75
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L88
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L101
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L86-L93
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L56
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L178-L201
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L89
- github.com/huangjunsen0406/py-xiaozhi/blob/9bfc807d368cccac71af8d9f7042ab6b5af92030/README.md?plain=1#L106