whatisgithub

What is xiaozhi-pi-mochi?

hoorayman/xiaozhi-pi-mochi — explained in plain English

Analysis updated 2026-05-18

25CAudience · developerComplexity · 4/5Setup · moderate

In one sentence

A backend server that turns an ESP32 microcontroller into a voice chat robot by handling speech-to-text, an AI reply, and text-to-speech in one loop.

Mindmap

mindmap
  root((xiaozhi-pi-mochi))
    What it does
      Voice chat backend
      ESP32 robot server
      Animated face display
    Pipeline
      Opus audio in
      Google speech recognition
      pi-ai LLM reply
      edge-tts speech out
    Tech stack
      TypeScript
      Python
      ffmpeg
    Use cases
      DIY voice robot
      Custom personality device
      Multi provider LLM chat
    Audience
      Hobbyist makers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a physical ESP32 voice assistant that talks back using any of 30-plus supported LLM providers.

USE CASE 2

Give each connected device its own personality by setting a custom system prompt per device.

USE CASE 3

Add an animated emotional face on an OLED screen to a DIY voice robot project.

What is it built with?

TypeScriptPythonWebSocketffmpeg

How does it compare?

hoorayman/xiaozhi-pi-mochidivision-36/z-jailnogamble/rvos
Stars252525
LanguageCCC
Setup difficultymoderatemoderatehard
Complexity4/53/54/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires Node.js 18+, Python 3.10+, ffmpeg, and a pi-agent installation plus a physical ESP32 device.

So what is it?

xiaozhi-pi-mochi is a backend server for the xiaozhi-esp32 project, which turns an ESP32 microcontroller (a small, inexpensive chip used in DIY electronics) into a voice chat robot. The server receives audio from the physical device over WebSocket, transcribes the speech, generates a reply with a language model, converts the reply back to audio, and sends it back to the device to play, completing the loop in a few seconds. The processing pipeline works as follows: the ESP32 records your voice and streams compressed Opus audio to the server. Google Speech Recognition transcribes the audio to text for free, without requiring an API key. A large language model connected through the pi-ai framework (which supports more than 30 providers including DeepSeek, OpenAI, and Claude) generates a reply. Microsoft's edge-tts converts the reply to speech using neural voices. Then ffmpeg converts the audio back to the Opus format the device expects, and the server sends it over WebSocket for playback. The "mochi" feature refers to an animated face displayed on a small OLED screen attached to the ESP32. The face cycles through eight emotional expressions based on the conversation state, giving the robot a visual personality alongside its voice. Each physical device connected to the server can have its own independent personality, set as a custom system prompt through the command interface. You could configure one device to respond warmly and another to be more blunt, and change these settings at runtime without restarting the server. The server is written in TypeScript and Python, with no compilation step required, and starts with a single command. It requires Node.js 18 or newer, Python 3.10 or newer, ffmpeg, and a pi-agent installation.

Copy-paste prompts

Prompt 1
Set up xiaozhi-pi-mochi as the backend server for my ESP32 voice robot using the free Google speech recognition option.
Prompt 2
Configure xiaozhi-pi-mochi to use Claude through the pi-ai framework for generating voice replies.
Prompt 3
Show me how to give two different xiaozhi-pi-mochi devices different personalities using the command interface.
Prompt 4
Walk me through installing Node.js, Python, ffmpeg, and pi-agent so xiaozhi-pi-mochi runs on my machine.

Frequently asked questions

What is xiaozhi-pi-mochi?

A backend server that turns an ESP32 microcontroller into a voice chat robot by handling speech-to-text, an AI reply, and text-to-speech in one loop.

What language is xiaozhi-pi-mochi written in?

Mainly C. The stack also includes TypeScript, Python, WebSocket.

How hard is xiaozhi-pi-mochi to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is xiaozhi-pi-mochi for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.