wechat-pi-acp
v1.4.0
Published
WeChat-to-Pi ACP bridge — connect WeChat to Pi agent via QR login
Maintainers
Readme
wechat-pi-acp
WeChat-to-Pi ACP bridge — connects WeChat to Pi via QR code login.
Architecture
WeChat (Weixin) ←── HTTP long-poll ──→ wechat-pi-acp ←── ACP stdio ──→ pi-acp- Receives WeChat messages via
getUpdateslong-poll - Routes text messages to Pi ACP agent for processing
- Downloads any media (images, files, videos) from WeChat CDN, decrypts, and passes file paths to the agent
- Agent responses are streamed in real-time to WeChat — replies, thoughts, and tool-call notices arrive as they're generated
- Files generated by the agent are uploaded to WeChat CDN and delivered
- Custom slash commands (
/new,/cancel,/status,/think,/msg-start,/help) are intercepted before routing
Quick Start
npx wechat-pi-acp # First run: QR login + start bridge
npx wechat-pi-acp --login # Force re-login
npx wechat-pi-acp --verbose # Verbose loggingQR Login
On first run, wechat-pi-acp fetches a QR code from WeChat's API and displays it in your terminal. Scan it with your phone to authenticate. The token is saved to ~/.wechat-pi-acp/config.json.
Configuration
~/.wechat-pi-acp/config.json:
{
"token": "",
"baseUrl": "https://ilinkai.weixin.qq.com",
"cdnBaseUrl": "https://novac2c.cdn.weixin.qq.com/c2c",
"acpCommand": "npx pi-acp",
"idleTimeoutMs": 600000,
"mediaTempDir": "/tmp/wechat-pi-acp",
"fileTtlMs": 3600000,
"botAgent": "WeChat-Pi-ACP/1.0.0"
}Commands
Send these as WeChat messages:
| Command | Action |
|---------|--------|
| /new | Start a new session (closes current one) |
| /cancel | Cancel the current agent request |
| /status | Show session info (mode, model, config options) |
| /think <level> | Set thinking level: off, minimal, low, medium, high, xhigh |
| /msg-start | Start message compose mode — collect text + files |
| /msg-end | Submit collected content as a single prompt |
| /msg-cancel | Discard collected compose content |
| /file-send <path> [caption] | Send a file to the WeChat user |
| /file-list | List temporary files in current session |
| /file-clear | Remove temporary downloaded files |
| /file-upload-start | Start file upload mode — all subsequent files are saved |
| /file-upload-end | End file upload mode, show collected files |
| /help | Show available commands |
Session Model
Each WeChat user gets an isolated Pi ACP session. Sessions persist across restarts via Pi's built-in session storage. The agent process is killed after 10 minutes of inactivity (configurable) and resumed via loadSession on the next message.
Agent output is streamed in real-time: message chunks are sent as they arrive, thinking blocks are wrapped in code fences, and tool-call titles are shown as brief notices.
Requirements
- Node.js 22+
- Pi ACP agent installed (default:
npx pi-acp)
License
MIT
