Self-Hosted Server: Connect XiaoZhi Devices to Your Own Server
A XiaoZhi device does not run a large language model itself: the device captures and plays audio, and the server handles the conversation. The firmware connects to the official server by default. If you want to choose your own language model, speech recognition and speech synthesis, or decide where conversation data is kept, you can run your own server.
This page is an overview only. It explains how the device and the server fit together, which open-source servers the community offers, and, using xiaozhi-esp32-server as an example, how to connect a device. It does not copy the full tutorials of third-party projects; follow the documentation of the project you choose for the exact steps.
1. Do You Need Your Own Server?
| Your situation | Suggestion |
|---|---|
| You just want a ready-made voice assistant | Use the default official server, see First Boot |
| You want to use language, speech recognition and speech synthesis models of your choice | Self-host a server |
| You want to decide where conversation data is stored, or add your own device control and knowledge base | Self-host a server |
| You are developing or debugging the firmware communication protocol | Self-host a server, or implement one against the WebSocket protocol |
2. How the Device Finds Your Server
After connecting to the network, the firmware sends a request to the OTA URL. The server answers with the websocket or mqtt configuration to use for conversations, and the device initializes its communication protocol from it (field descriptions are in First Boot). So a server must provide at least two parts:
- An OTA endpoint: returns the version, activation information and communication configuration;
- A conversation channel: WebSocket or MQTT + UDP, on which it does speech recognition, language model conversation and speech synthesis.
There are two ways to make a device use your OTA URL:
- The “Advanced” tab of the provisioning page: enter the OTA URL in provisioning mode and save it; no rebuild is needed;
- Build it yourself: change
Default OTA URL(CONFIG_OTA_URL) inmenuconfig.
The device sends identifiers such as Device-Id (the MAC address) and Client-Id with every request to the OTA URL, so only enter a server you trust.
3. Community Open-Source Servers
The table comes from the “related open-source projects” in the upstream firmware README and per-repository checks by this site (2026-11-08), compared by the same fields; “stated” means the project README’s own description, and this site has not deployed or tested any of these servers. unknown means no verifiable basis is available yet.
| Field | xinnan xiaozhi-esp32-server | joey-zhou server-java | hackers365 server-golang | AnimeAIChat server-go |
|---|---|---|---|---|
| Version anchor | latest v0.9.8 (2026-10-23) · main 4f6e9ec6b116 (2026-11-05) | latest v5.1.0 (2026-04-21) · main b2ff4d316ba6 (2026-09-27) | latest v0.6.5 (2026-11-04) · main 531930f9249e | latest v0.1.3 (2026-06-11) · main 0b1575cb5d43 (2026-08-27) |
| Stack | Python + Java + Vue | Java (Spring Boot) | Go | Go |
| Deployment | Docker or source; minimal (config-file storage) / full-module (database) | Stated as admin backend plus conversation service in two processes | Stated prebuilt one-click bundle and Docker | Stated for personal and home use |
| Resources | Local FunASR is memory-heavy; low with all-API mode (stated) | unknown | unknown | unknown |
| Database / deps | Minimal needs none; full-module needs a database; voiceprint needs voiceprint-api + MySQL | Stated MySQL, Redis, Qdrant | unknown | Stated local SQLite |
| Device protocols | WebSocket and MQTT + UDP (stated) | WebSocket and MQTT + UDP (stated) | WebSocket and MQTT + UDP (stated) | WebSocket (stated) |
| ASR / LLM / TTS | Multiple provider combinations; default LLM needs your own API key; default SenseVoiceSmall downloaded separately | Stated configurable, see its docs | Stated fully streaming ASR → LLM → TTS | Stated configurable, see its docs |
| MCP | Stated MCP endpoints | Stated supported | Stated MCP / Agent extensions | unknown |
| License & limits | MIT | MIT | MIT | Modified Apache-2.0: multi-tenant needs written authorization; web frontend must keep LOGO and copyright |
| Checked | 2026-11-08, latest v0.9.8 | 2026-11-08 | 2026-11-08 | 2026-11-08 |
For clients, embedded ports and other projects, see Ecosystem Projects.
4. Example: xiaozhi-esp32-server
The facts below come from that project’s pinned main commit 4f6e9ec6b116 (main after v0.9.8, 2026-11-05), docs/Deployment.md and docs/Deployment_all.md. For newer versions, rely on the main branch documentation.
Deployment Modes
| Mode | What it includes | Suited for |
|---|---|---|
| Minimal install | Intelligent conversation, a single agent; configuration lives in a file and no database is needed; runs with Docker or from source | Low-spec environments, getting it running first |
| Full-module install | Intelligent conversation, multiple users and agents, with a management console; data is kept in a database | The complete experience |
Default Addresses and Ports
Default endpoints differ between the minimal (Deployment.md, run-status section) and full-module (Deployment_all.md) installs:
| Endpoint | Minimal | Full-module |
|---|---|---|
| WebSocket | ws://<LAN IP>:8000/xiaozhi/v1/ | ws://<host IP>:8000/xiaozhi/v1/ (same) |
| OTA | http://<LAN IP>:8003/xiaozhi/ota/ | http://<host IP>:8002/xiaozhi/ota/ (different port) |
When run from source the startup log prints these (lines like OTA接口是 http://…:8003/xiaozhi/ota/ and Websocket地址是 ws://…:8000/xiaozhi/v1/, noting the WebSocket URL must not be opened in a browser); under Docker the printed addresses are not the real ones — derive them from the LAN IP. After a full-module deploy, also set server.websocket and server.ota in the admin console’s parameter management to the addresses above. The device must be able to reach them, so never use localhost or 127.0.0.1.
Configuration Notes
- Put your configuration in
data/.config.yaml, which takes precedence overconfig.yamlin thexiaozhi-serverdirectory; get a minimal configuration running first, then replace modules one by one; - It needs at least a WebSocket address the device can reach:
server:
websocket: ws://<your LAN IP>:8000/xiaozhi/v1/- The default LLM is
ChatGLMLLM(Zhipu BigModel): register an API key on its site and put it into the config before the server starts (pinned-commit deployment doc line 199); other ASR/LLM/TTS combinations follow the project’s config tutorial; - The default speech recognition model
SenseVoiceSmallis large and must be downloaded separately asmodel.pt, then placed inmodels/SenseVoiceSmall/.
Connecting the Device
- Open the OTA URL in a browser. In a full-module deployment it should show “OTA接口运行正常” (the OTA endpoint is working); if it does not, log in to the console as super administrator, set
server.websocketto your WebSocket address under “Parameter Management” (参数管理), and refresh to confirm. - Put the device into provisioning mode (see First Boot), enter the OTA URL in the “Advanced” tab of the provisioning page, save it and restart the device.
- Wake the device and check whether the server log shows conversation records.
Common Situations
- Wi-Fi works but 4G does not: the project’s FAQ explains that 4G mode needs a secure connection; one fix is to configure an SSL certificate with nginx, see its FAQ.
- Server deployment problems: start with the project’s deployment guide (minimal) and full-module deployment guide, then report to its Issues.
- Firmware and device problems: see the FAQ and Network Configuration.
Expected checks and failure recovery
Per the pinned main commit 4f6e9ec6b116 docs, the expectations and recovery points of a deploy → device → model chain. Each check proves only its own layer and never substitutes for the next:
- Probe after deployment: open the OTA URL in a browser; a full-module deployment should say the OTA API is running. If not, check the server log first, then whether
server.websocketis device-reachable (Docker’s printed address is not the real one). A passing probe proves only that the OTA service is reachable — not that WebSocket or models work. - Device online: after saving the OTA URL in provisioning and rebooting, the device fetches its transport config and shows up in the server’s connections. Staying on the activation-code screen usually means the device is connected and waiting for console binding, but binding-interface, account or server-side issues are not excluded; use the checklist in First Boot to tell device-side from server-side.
- Voice chain, layer by layer (after wake-up, each layer proves only itself):
- recognized text in the server log: proves ASR returned text only — not the model or TTS;
- a following model response entry: the LLM call succeeded; TTS still unproven;
- the server generating TTS / sending audio frames: the synthesis path has started;
- the device actually playing sound: the only criterion that the whole chain is connected — confirm next to the device. Wherever it stops: no recognized text → check audio uplink and ASR config; text but no model response → API key, chosen model, quota; response but no audio → TTS config; server all-green but device silent → back to the device side (volume/wiring, FAQ Q6/Q8).
- Rollback: fix configuration in
data/.config.yaml(it overrides the built-inconfig.yaml) and restart; to re-verify from scratch, redo the minimal setup per the project’s deployment guide rather than deleting databases or long-term data.
This site has not deployed the chain; the above is a layered reorganization of the pinned-commit documentation steps, and exact log field names follow that project’s implementation. Actual behavior follows its docs and Issues.
Environment, upgrades and operations (pinned commit 4f6e9ec6b116)
Facts below come from that project’s pinned-commit deployment guide (not tested by this site):
- Docker environment: published images are x86-only since v0.8.2; arm64 needs a self-built image per its
docker-build.md. Layoutxiaozhi-server/{data,models/SenseVoiceSmall}; start withdocker compose up -d. - Source environment: the author manages deps with conda (Python 3.10 + libopus + ffmpeg); without conda, install
libopusandffmpegyourself. - Voice data-flow precondition: the default ASR is local/offline;
SenseVoiceSmall/model.ptmust be downloaded into place, otherwise the first layer (“recognized text”) never appears. - Upgrades: back up the keys in
data/.config.yamland copy them item by item into the new config (never overwrite the whole file — new versions may add options), thendocker stop/rm/rmithe old containers/images and redeploy the same way. - Operations: the README states the project has not passed a security review and is not for production; see the security notes below for public deployments.
5. Security Warnings
The README of xiaozhi-esp32-server states in its “Warning” section:
- This is open-source software. It has no commercial relationship with any third-party API provider it connects to (speech recognition, language models, speech synthesis and so on) and gives no guarantee of their service quality or the safety of your funds. Prefer providers that hold the relevant business licenses and read their terms and privacy policies. The software does not hold account keys and takes no part in money flows.
- The project is incomplete and has not passed a network security assessment. Do not use it in production. If you deploy it on the public internet for learning, put the necessary protection in place.
Based on how the firmware behaves, a few more general practices:
- Only enter an OTA URL you trust: the device sends its identifiers to it and switches its communication configuration according to its response.
- Keep API keys in the server configuration only: do not commit them to public repositories or share them in screenshots or logs.
- Use TLS on the internet:
ws://and plain HTTP are fine inside a LAN; on the internet usewss://and HTTPS and restrict who can reach the server.
Related Documents
- First Boot: Provisioning, Activation and Binding: how a device reports to the OTA URL
- WebSocket Communication Protocol, MQTT + UDP Hybrid Protocol and MCP Protocol: the protocols a server must implement
- Ecosystem Projects: servers, clients and ports
- FAQ
Sources: main/ota.cc and main/Kconfig.projbuild of the firmware 78/xiaozhi-esp32 v2.5.2; third-party content comes from each repository’s README and docs, checked on 2026-10-23.