npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

weiclaw

v1.0.13

Published

一条命令,把微信变成任何 AI Agent 的入口

Downloads

1,490

Readme

⭐ 如果这个项目对你有帮助,请给个 Star!

全网首个支持微信与任何 AI Agent 全模态双向通信的开源项目 —— 文本、图片、语音、视频、文件,发送和接收全覆盖。

特性

  • 🔌 零依赖接入npx 一条命令,无需 clone、无需配置
  • 🧠 Agent 无关 — 支持任何 OpenAI 兼容 API(Codex / Gemini / Claude / OpenCode / 自建)
  • 📡 全模态 — 文本、图片、语音、视频、文件,双向全覆盖
  • 🤖 多 Agent — 同时接入多个 Agent,@ 路由切换
  • ⌨️ 打字指示器 — Agent 思考时显示"对方正在输入"
  • 📤 主动发送 API — Agent 可推送多条消息,模拟真人打字节奏

全模态支持矩阵

| 模态 | 微信 → Agent | Agent → 微信 | |------|:---:|:---:| | 📝 文本 | ✅ | ✅ | | 📷 图片 | ✅ 自动识别 | ✅ HD 原图 | | 🎤 语音 | ✅ 语音转文字 | ✅ 语音气泡 | | 🎬 视频 | ✅ 自动接收 | ✅ 带缩略图 | | 📄 文件 | ✅ 提取内容 | ✅ 可下载 | | 💬 引用消息 | ✅ 自动提取引用媒体 | — |

已支持的 Agent / 工具

| Agent | 接入方式 | 安装 | |-------|---------|------| | ⌬ OpenCode | --opencode | npm i -g opencode-ai | | 🤖 OpenAI Codex | --codex | npm i -g @openai/codex | | 💎 Google Gemini | --gemini | npm i -g @google/gemini-cli | | 🧬 Claude Code | --claude | npm i -g @anthropic-ai/claude-code | | 🐾 OpenClaw | --openclaw | npm i -g openclaw | | 🔗 任何 OpenAI 兼容 API | 直接传 URL | — | | 📡 ACP 协议 Agent | --agent name=acp://... | — |

首次使用各 CLI Agent 前需完成认证:

  • Claudeclaude 登录你的 Anthropic 账号
  • Gemini:运行一次 gemini,浏览器弹出 Google OAuth 授权,完成后 token 会缓存到本地,之后 --gemini 模式即可正常使用
  • Codex:运行一次 codex,完成 OpenAI OAuth 授权
  • OpenCode:运行一次 opencode,完成 AI provider 授权(opencode providers login

快速开始

# 选你喜欢的 Agent:
npx weiclaw --codex      # OpenAI Codex
npx weiclaw --gemini     # Google Gemini
npx weiclaw --claude     # Claude Code
npx weiclaw --opencode   # OpenCode(含免费模型)
npx weiclaw --openclaw   # OpenClaw

# 或直接传 URL:
npx weiclaw http://your-agent:8000/v1

首次使用:终端弹出二维码 → 微信扫码 → 完成。之后自动复用登录。

环境依赖

# 1. Node.js >= 22
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
nvm install 22

# 2. Python 3 + pip
brew install python3       # macOS
apt install python3 python3-pip  # Linux

# 3. ffmpeg
brew install ffmpeg        # macOS
apt install ffmpeg         # Linux

# 4. pilk
pip install pilk

原理

微信用户 ←→ 腾讯 ilinkai API ←→ weiclaw ←→ 你的 Agent (HTTP)

直接调用腾讯 ilinkai 接口收发微信消息,无中间层、无逆向、无网页版。Agent 只需暴露一个 OpenAI 兼容的 HTTP 接口。

接入自己的 Agent

任何语言,暴露 POST /v1/chat/completions 即可:

@app.post("/v1/chat/completions")
def chat(request):
    message = request.json["messages"][-1]["content"]
    reply = your_agent(message)
    return {"choices": [{"message": {"role": "assistant", "content": reply}}]}

然后:npx weiclaw http://your-agent:8000/v1

多媒体协议

Agent 回复中包含特定格式即可自动发送多媒体:

| 类型 | Agent 回复格式 | 说明 | |------|--------------|------| | 图片 | ![描述](URL或路径) | 支持 URL、本地路径、data URI | | 语音 | [audio:路径或URL] | MP3/WAV/OGG,需 ffmpeg + pilk | | 视频 | [video:路径或URL] | 需 ffmpeg | | 文件 | [file:路径或URL] | 任意文件类型 |

图片接收(微信 → Agent)遵循 OpenAI Vision API

{
  "messages": [{
    "role": "user",
    "content": [
      { "type": "text", "text": "这是什么?" },
      { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,..." } }
    ]
  }]
}

示例:image-test.mjs · voice-test.mjs · video-test-local.mjs · file-test.mjs

Agent 模板:claude-code · opencode · openai

多 Agent 模式

同时接入多个 Agent,@ 前缀路由。支持 OpenAI 格式和 ACP 协议

npx weiclaw \
  --agent codex=http://localhost:3001/v1 \
  --agent gemini=http://localhost:3002/v1 \
  --agent bee=acp://localhost:8000/chat \
  --default codex

| 微信消息 | 效果 | |---|---| | 你好 | 发给默认 Agent | | @codex 写个排序 | 路由到 Codex | | @gemini 审查代码 | 路由到 Gemini | | @list | 查看所有 Agent | | @切换 gemini | 切换默认 |

主动发送 API

Bridge 启动时会在 localhost:9099 暴露 HTTP API,Agent 可主动推送多条消息(模拟真人打字节奏):

curl -X POST http://localhost:9099/api/send \
  -H "Content-Type: application/json" \
  -d '{"to": "user_id", "content": "嗯……"}'
  • to — 微信用户 ID(bridge 调 agent 时通过 user 字段传入)
  • content — 支持和 Agent 回复相同的格式(纯文本、![](url)[audio:path] 等)
  • --port PORT 自定义端口

用途:Agent 对一条消息可分多段回复,控制发送间隔:

import requests, time
def send(to, text):
    requests.post("http://localhost:9099/api/send", json={"to": to, "content": text})

send(user_id, "嗯……")
time.sleep(1.5)
send(user_id, "让我想想")
time.sleep(2)
# 最后一段作为正常 response 返回

凭证

登录凭证保存在 ~/.weiclaw/credentials.json,删除即可重新登录。

Star History

如果这个项目帮到了你,请给个 ⭐ Star,这是对我们最大的支持!

License

MIT