WeChat <-> Claude Code bridge via iLink Bot API
Project description
WeChat Bridge
在微信中使用 Claude Code — 通过 iLink Bot API 将微信消息桥接到 Claude Code CLI,支持文本、语音(ASR 转文字)、图片(CDN 下载 + AES 解密 + 视觉理解)。
它能做什么
"帮我分析这段代码的问题" → Claude Code 读代码、给反馈
[发送一张截图] → CDN 下载 → AES 解密 → Claude 视觉分析
[发送一条语音] → ASR 转文字 → Claude 理解并回复
"/status" → 查看 context 用量、token 费用
"/compact" → 压缩上下文,延长会话寿命
核心特性
多模态消息
- 文本 — 直接发送,Claude Code 处理并回复
- 语音 — 自动提取微信 ASR 转写文字,无需额外模型
- 图片 — CDN 下载 + AES-128-ECB 解密 + Claude 视觉理解
Bridge 命令
| 命令 | 说明 |
|---|---|
/new |
重置会话(清除上下文,开始新对话) |
/stop |
停止当前正在运行的任务 |
/compact |
压缩上下文(释放 token 空间) |
/status |
查看会话状态(context 用量 / 费用 / 模型) |
/help |
显示帮助 |
上下文管理
- 跨消息维持完整上下文,bridge 重启自动恢复会话
- Context 用量监控(70% / 85% 阈值),自动在回复末尾提示
/compact压缩上下文,/new重置会话
多用户支持
- 每用户独立会话与任务队列
- 主用户 / 访客用户权限分离,访客独立费用上限
- 多用户工作区隔离(可选)
CLI 工具
wechat-cli 提供消息发送和用户管理命令,可用于通知推送等场景:
wechat-cli send-message --user-id <id> --text "部署完成"
wechat-cli send-message --broadcast --text "系统维护通知"
wechat-cli list-users
快速开始
1. 获取 iLink Bot 凭证
通过微信 OpenClaw 平台创建 iLink Bot,获取 bot_token 和 base_url。
2. 安装
pipx install wechat-bridge # 推荐(隔离环境)
# 或从源码
git clone https://github.com/feir/wechat-bridge.git
cd wechat-bridge && pip install -e '.[dev]'
升级
# PyPI 安装
pipx upgrade wechat-bridge
# 源码安装
cd wechat-bridge && git pull
pip install -e '.[dev]' # 仅依赖变更时需要
3. 认证
python -m wechat_bridge.ilink_auth
# 交互式输入 bot_token 和 base_url
# → 凭证写入 ~/.config/wechat-bridge/credentials.json
4. 配置
创建 .env 文件(参考 .env.example):
WECHAT_ALLOWED_USERS=user_id_1,user_id_2
CLAUDE_MODEL=sonnet
CLAUDE_TIMEOUT=300
WECHAT_MAX_CONCURRENT=3
5. 运行
wechat-bridge
部署
# systemd(Linux)
cp wechat-bridge.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now wechat-bridge
开发
pip install -e '.[dev]'
pytest tests/ -v
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wechat_bridge-2026.4.11.tar.gz.
File metadata
- Download URL: wechat_bridge-2026.4.11.tar.gz
- Upload date:
- Size: 39.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6593e5be4a6d456766863b3cec11f1e685103e0b5fb749401832c830fa97a8c
|
|
| MD5 |
ae551aa26e01f616e5ed220dcda42873
|
|
| BLAKE2b-256 |
fbc63ca8cb6f3da29f221cbf59b1be2e2c738267a5cb82330070d1716dbeedc3
|
Provenance
The following attestation bundles were made for wechat_bridge-2026.4.11.tar.gz:
Publisher:
publish.yml on feir/wechat-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wechat_bridge-2026.4.11.tar.gz -
Subject digest:
e6593e5be4a6d456766863b3cec11f1e685103e0b5fb749401832c830fa97a8c - Sigstore transparency entry: 1278083292
- Sigstore integration time:
-
Permalink:
feir/wechat-bridge@1f57eac09c5e7ef345f60bb64a4a46822bf58f44 -
Branch / Tag:
refs/tags/v2026.4.11 - Owner: https://github.com/feir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f57eac09c5e7ef345f60bb64a4a46822bf58f44 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wechat_bridge-2026.4.11-py3-none-any.whl.
File metadata
- Download URL: wechat_bridge-2026.4.11-py3-none-any.whl
- Upload date:
- Size: 44.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d419495a8af2d633e0dcc35f3aeff6514677e8296d06c5c36394c079fd2e3d
|
|
| MD5 |
db138907b285f8bec83ff7ea43c8b667
|
|
| BLAKE2b-256 |
bc3c78c4e1c4e87b2221e4ad3828773acc6a7133f69f0a99f33a9b643b496377
|
Provenance
The following attestation bundles were made for wechat_bridge-2026.4.11-py3-none-any.whl:
Publisher:
publish.yml on feir/wechat-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wechat_bridge-2026.4.11-py3-none-any.whl -
Subject digest:
b9d419495a8af2d633e0dcc35f3aeff6514677e8296d06c5c36394c079fd2e3d - Sigstore transparency entry: 1278083323
- Sigstore integration time:
-
Permalink:
feir/wechat-bridge@1f57eac09c5e7ef345f60bb64a4a46822bf58f44 -
Branch / Tag:
refs/tags/v2026.4.11 - Owner: https://github.com/feir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f57eac09c5e7ef345f60bb64a4a46822bf58f44 -
Trigger Event:
push
-
Statement type: