验证 Chat Completions / Responses / Messages 三种 LLM API 的兼容性。面向 OpenAI 官方、DeepSeek 官方、vLLM 私有化部署、Anthropic 官方等服务端,快速验证协议连通性、流式输出、思维链与工具调用等高级特性。
- 预设配置:内置 DeepSeek Official / DeepSeek Anthropic 两条预设;可新建、原地编辑保存、切换、删除任意 API 配置(Name / Base URL / API Key / Model)。
- 三种协议:单选卡片切换 Chat Completions、Responses API、Anthropic Messages API,表单随协议动态变化。
- Chat Completions:system / messages / temperature / stream / tools (Function Calling)
- Responses API:instructions / input / reasoning.effort / web_search / custom tool
- Messages API:独立 system / user 与 assistant messages / thinking / anthropic-version 头
- 实时测试:流式(SSE)打字机输出,高亮 Reasoning Delta / Output Delta / Tool Call 事件;非流式一键发送并计算 TTFT 与总耗时。
- 思维链面板:自动提取 CoT 内容,可折叠独立展示。
- 原始报文 Inspector:Request / Response 双 Tab,展示完整 HTTP Header 与 JSON Body,API Key 支持打码。
- 一键兼容性诊断:主动发送针对性请求,逐项探测文本生成、SSE 流式、思维链、工具调用是否支持(✅ 探测到 /
⚠️ 未观察到 / ❌ 请求失败),而非被动观察任意响应。
| 能力 | Chat Completions | Responses API | Messages API |
|---|---|---|---|
| 基础文本生成 | ✅ | ✅ | ✅ |
| SSE 流式 | ✅ delta.content |
✅ response.output_text.delta |
✅ text_delta |
| 思维链解析 | ✅ reasoning_content |
✅ response.reasoning_text.delta |
✅ thinking_delta |
| 工具/函数调用 | ✅ tool_calls |
✅ function_call / web_search |
✅ tool_use |
- 框架: WXT — 下一代浏览器扩展开发框架
- 前端: React 18 + TypeScript
- 样式: Tailwind CSS 3
- 图标: Lucide 图标库
- 测试: Vitest
- CI/CD: GitHub Actions
- Node.js >= 20
# 安装依赖
npm install
# 启动开发模式(Chrome)
npm run dev
# 启动开发模式(Firefox)
npm run dev:firefox- 打开
chrome://extensions/ - 开启「开发者模式」
- 点击「加载已解压的扩展程序」
- 选择
dist/poly-api-tester目录 - 点击工具栏图标 → popup 中的「打开侧边栏测试器」,或直接在浏览器侧边栏中选择本扩展
⚠️ 该扩展声明了<all_urls>host 权限,以便请求任意的 Base URL(如http://localhost:8000)。这是开发者工具类插件的常见做法,安装时会显示「读取和更改您在所有网站上的数据」的宽泛提示。
# 生产构建
npm run build
# 打包为 .zip
npm run zip项目已包含根据插件功能自动生成的图标,无需额外配置。
如需修改图标,编辑 public/icons/icon.svg 后运行:
npm run generate-icons该脚本会自动生成 16×16、48×48、128×128 三种 PNG。
npm run type-check # TypeScript 类型检查
npm run lint # ESLint 检查
npm run format # Prettier 格式化
npm run test # 运行测试- 切换到 main 分支并拉取最新代码
- 打 tag:
git tag v1.0.0 - 推送 tag:
git push --follow-tags - GitHub Actions 自动构建并发布到 Release
Tag 版本即为扩展版本号,无需手动修改
package.json或wxt.config.ts。
public/
│ └── icons/ # 插件图标
│ ├── icon.svg # 图标源文件(修改后运行 generate-icons)
│ ├── icon-16.png
│ ├── icon-48.png
│ └── icon-128.png
scripts/
│ └── generate-icons.mjs # SVG → PNG 图标生成脚本
src/
├── entrypoints/ # WXT 入口
│ ├── popup/ # Popup 页面
│ │ ├── App.tsx
│ │ ├── main.tsx
│ │ └── index.html
│ └── background.ts # Background Script
├── components/ # React 组件
├── assets/ # 静态资源
├── lib/ # 工具函数
└── styles/ # 全局样式
└── globals.css