xiaogpt
Play ChatGPT and other LLM with Xiaomi AI Speaker
Xiaogpt is a Python tool that connects a Xiaomi smart speaker to ChatGPT and a range of other AI chat services. Instead of only getting Xiaomi's built-in assistant responses, you can route your questions through a more capable AI and hear the answers read back to you through the speaker's text-to-speech system.
The setup requires a Xiaomi AI speaker, a working internet connection, Python 3.8 or later, and an API key from whichever AI service you want to use. You log in with your Xiaomi account credentials, retrieve a device ID for your specific speaker model, then launch the tool from the command line with flags pointing to your hardware type and chosen AI backend. Once running, you phrase questions starting with a trigger word and the speaker relays the AI's answer aloud.
The project supports a wide list of AI backends beyond ChatGPT, including Google Gemini, Moonshot, Alibaba's Tongyi Qianwen, Doubao, ChatGLM, Llama 3, and the 01 model from Lingyiwanwu. You can swap between them by passing different flags on startup. For text-to-speech output there are several options as well: the default built-in speaker voice, Microsoft Edge TTS, OpenAI TTS, Azure TTS, or Fish Audio.
There are practical options to smooth out the experience. You can mute the Xiaomi speaker's own default reply so it does not talk over the AI's answer. A streaming mode starts playing the response sooner rather than waiting for the full answer to arrive. A continuous-conversation mode keeps context across multiple exchanges. If you prefer not to use command-line flags every time, you can put all your settings into a YAML or JSON config file and point the tool at it on startup.
A Docker image is available if you do not want to install dependencies directly. The project is aimed at people who own a Xiaomi speaker and want a more capable AI assistant without buying new hardware.