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

@bsbofmusic/cdper-plugin-chatgpt

v1.1.1

Published

ChatGPT runtime plugin for cdper — requires cdp-bridge + Tailscale

Readme

@bsbofmusic/cdper-plugin-chatgpt

CDP-controlled ChatGPT for AI agents — through a remote Chrome browser via cdp-bridge + Tailscale.

⚠️ FOR LEARNING PURPOSES ONLY | 仅供学习研究使用 使用本工具即表示您同意自行承担所有合规风险。


工作原理

你的 Agent
  ↓ CDP_WS (Tailscale 内网)
  ↓ 远程 Chrome(已登录 ChatGPT)
  ↓ CDP Protocol
  ↓ AI 回复内容
你的 Agent
  • 无需 ChatGPT API Key
  • 通过 CDP 控制真实浏览器,获取与网页版完全一致的回复
  • 适用于需要 ChatGPT Plus 功能(Thinking 模式、Plugins 等)的场景

前置要求

| 要求 | 说明 | |------|------| | cdp-bridge | CDP 桥接服务,必须已在远程机器上运行 | | Tailscale | 两台机器必须在同一 Tailscale 网络下 | | Node.js >= 18 | 运行环境 | | ChatGPT 已登录 | ⚠️ 远程 Chrome 必须已登录 ChatGPT 账号(CDP 能控制的前提是浏览器处于已登录状态) |


安装

npm install @bsbofmusic/cdper-plugin-chatgpt

安装后自动运行环境预检(npm run postinstall),看到 ✅ 环境就绪 即可使用。


配置

第一步:获取 CDP WebSocket 地址

在运行 cdp-bridge 的远程机器上,启动浏览器后获取 WS 地址,例如:

ws://<Tailscale_IP>:<端口>/devtools/browser?token=<你的token>

详细步骤参考 cdp-bridge 文档

第二步:配置连接信息

支持两种方式,优先级:CDP_WS 环境变量 > tools/cdp-auth.json

export CDP_WS="ws://<Tailscale_IP>:<端口>/devtools/browser?token=<你的token>"

或在当前项目写入 tools/cdp-auth.json

{ "ws_url": "ws://<Tailscale_IP>:<端口>/devtools/browser?token=<你的token>" }

永久生效(Linux/macOS):

echo 'export CDP_WS="ws://<Tailscale_IP>:<端口>/devtools/browser?token=<你的token>"' >> ~/.bashrc
source ~/.bashrc

快速开始

预检环境

cdp-chatgpt check

输出示例:

🔍 cdp-chatgpt 环境检测

✅ Node.js >= 18            v22.2.1
✅ CDP_WS 环境变量已设置      ws://<Tailscale_IP>:<端口>/devtools/...
✅ CDP Bridge 网络可达        200 OK
✅ CDP Browser 运行中         running
✅ 系统平台兼容               linux x64

✅ 环境就绪!

查询 ChatGPT

# 默认 Thinking 模式(推荐)
cdp-chatgpt query "解释一下什么是 RAG"

# 指定模式:instant / thinking / pro
cdp-chatgpt query "解释一下什么是 RAG" --mode instant

# 日志控制
cdp-chatgpt query "解释一下什么是 RAG" --quiet
cdp-chatgpt query "解释一下什么是 RAG" --debug

会话多轮(实验性)

# 建立会话上下文
cdp-chatgpt query "我想学习机器学习" --session ml-study

# 复用同一会话,自动携带上下文
cdp-chatgpt query "推荐哪些课程" --session ml-study
cdp-chatgpt query "需要什么数学基础" --session ml-study

会话管理

# 列出所有活跃会话
cdp-chatgpt session

当前 CLI 仅支持查看活跃会话;过期会话会自动清理。


环境变量

| 变量 | 必填 | 默认值 | 说明 | |------|------|--------|------| | CDP_WS | ✅ | — | CDP WebSocket 地址 | | LOG_LEVEL | ❌ | info | 日志级别:error warn info debug | | QUIET | ❌ | 0 | 设为 1 仅保留错误输出 | | DEBUG | ❌ | 0 | 设为 1 打开调试日志 |


Agent 集成

OpenClaw

安装后在 ~/.openclaw/openclaw.json 添加:

{
  "skills": {
    "entries": {
      "cdp-chatgpt": {
        "env": {
          "CDP_WS": "ws://<Tailscale_IP>:<端口>/devtools/browser?token=<你的token>"
        }
      }
    }
  }
}

重启 gateway 后,Agent 自动识别触发词:CDP GPTCDP ChatGPT和 ChatGPT 说 等。

其他 MCP Agent

通过 CLI 调用或直接 import:

const { queryChatGPT } = require('@bsbofmusic/cdp-chatgpt/src/chatgpt');
const result = await queryChatGPT('你的问题', { mode: 'thinking' });
console.log(result.content);

故障排除

cdp-chatgpt check 显示 CDP_WS 未设置

export CDP_WS="ws://<Tailscale_IP>:<端口>/devtools/browser?token=<token>"

Connection refused / ECONNREFUSED

  1. 确认 cdp-bridge 服务正在运行
  2. 确认 Tailscale 已连接且两台机器可以互通
  3. 检查防火墙是否放行了对应端口

页面变成手机模式

通常是 CDP session 残留 viewport 导致,重启 cdp-bridge 的浏览器实例:

curl -X POST "http://<CDP_IP>:<PORT>/control/start?token=<TOKEN>&mode=advanced&profile=Default"

ChatGPT 返回空内容或重复问题

检查操作顺序:新建对话 → 切换模式 → 输入问题。顺序错了会导致模式被刷新重置。


风控命中处理(硬规则)

  • 若出现 Cloudflare challenge、验证码、人机验证、登录异常、访问频率限制、账号风控提示,立即停止本次自动化。
  • 禁止将此类情况视为可重试错误;禁止并发追加请求、禁止新开 session、禁止切换其他网页 AI 平台继续冲。
  • 此时应由人工接管处理验证/登录/解封,自动化仅可在人工确认恢复后继续。
  • 在 Agent 或脚本返回中,需输出 需要人工接管 与具体风控信号。

模式说明

| 模式 | 说明 | 推荐场景 | |------|------|---------| | instant | 快速回答 | 简单问答 | | thinking | 推理过程(默认) | 复杂问题、分析 | | pro | 研究级 | ⚠️ 响应慢,不推荐 |


已知限制

  • ⚠️ 远程 Chrome 必须已登录 ChatGPT(未登录时 CDP 能连接但无法操作对话界面)
  • Windows 暂不支持
  • 需要稳定的 Tailscale 网络连接

链接


免责声明

⚠️ 使用本工具即表示您同意自行承担所有合规风险及后果。

  1. ChatGPT 使用限制:本工具通过 CDP 控制 ChatGPT 网页界面,明确违反 OpenAI 服务条款 关于自动化访问的规定。
  2. 账号风险:使用本工具可能导致 OpenAI 账号被限制或封禁,风险完全由使用者承担。
  3. 测试后处理:使用完毕后请关闭 cdp-bridge 的浏览器实例并清除登录状态,防止未授权访问。
  4. 仅供学习:本工具仅用于技术研究和个人学习,不得用于商业目的或任何批量自动化行为。

作者不对任何使用后果负责,包括但不限于账号封禁、服务限制、数据泄露。

许可证

MIT License