Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
W

wechat-chatGPT

> 编程语言
Open source

实现微信公众号被动返回接口的ChatGPT

377 stars0 likes0 views
WebsiteGitHub

About

实现微信公众号被动返回接口的ChatGPT

WeChat-chatGPT

具有微信公众号被动回复用户消息功能的 ChatGPTBot 实现

食用指南

  1. 编译项目,注意在编译时将 $(Token) 替换为你的微信公众号 Token
  2. 通过 关于如何在服务器上获取 cf_clearance 获取 config.json
  3. 在 config.json 文件中填入chat.openai.com 里 Cookie 中的 __Secure-next-auth.session-token
  4. 部署到服务器中 默认监听本机 127.0.0.1:7458, 请自行通过 Nginx 或 Caddy 等反向代理工具进行转发
  5. 在微信公众平台中设置服务器地址为你的反向代理地址或域名地址,与微信公众号绑定的路由为 /weChatGPT

编译命令

bash
GOOS=linux GOARCH=amd64 GOARM= GOMIPS= \
CGO_ENABLED=0 \                                                   
go build -trimpath -o ./dist/weChatGPT \                          
-ldflags "-X 'main.wxToken=$(Token)' -w -s -buildid="

注意事项

  1. config.json 文件请放置与可执行文件同一目录下
  2. cf_clearance 可用于绕过 Cloudflare 的防火墙,但请保证获取 cf_clearance 时的 UA 与 IP 与项目实际运行时一致
  3. 由于 chatGPT 接口时常变动, 部署前请先在 config.json 中填入本机访问 chat.openai.com 时的 session-token、UA 与 cf_clearance,运行后通过 curl 127.0.0.1:7458/healthCheck 进行可用性检查

效果图

关于如何在服务器上获取 cf_clearance

  1. 在服务器上安装vvanglro/cf-clearance

    bash
    pip install --upgrade cf-clearance

    该项目需要playwright的支持,最新版Ubuntu镜像貌似是自带的(较老的Ubuntu版本需要自行安装),但还需要装一些依赖内容:

    bash
    playwright install
    sudo apt-get install libatk1.0-0 libatk-bridge2.0-0 libcups2 libatspi2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libxkbcommon0 libpango-1.0-0 libcairo2 libasound2
  2. 安装xvfb

    bash
    sudo apt-get install xvfb
  3. 然后在服务器上创建一个get_cf.py脚本,内容如下:

…
  1. 在 get_cf.py 所在目录下执行

    bash
    xvfb-run python3 get_cf.py > config.json
  2. 将 get_cf.py 所在目录下的 config.json 文件复制至项目所在目录下

其他

这其实是一篇没什么用的README

由于微信公众号的 5s限制 ,虽然本项目已经通过技术将这个限制提升至了 15s, 但绝大多数情况下通过逆向得到的ChatGPT接口的相应速率都超过了这个时间限制。

故本 Bot 几乎无法正常工作,可能以后等 ChatGPT 的正式接口出来,会重构本项目的代码。

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Go

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言