把 Anthropic 协议的 API 一键转成 OpenAI 格式。双击启动,本地运行,API Key 完全透传,不存储任何密钥。
电脑上需要装 Python 3.8+。
打开终端,输入:
python3 --version
能看到版本号即可。如果没有安装:
brew install python3
打开命令提示符,输入:
python --version
如果没有安装:去 python.org 下载安装。
下载并解压
下载 macOS 版 ZIP,解压到任意目录。
双击 start.command
首次启动会自动创建虚拟环境并安装依赖,约 10-20 秒。之后启动秒开。
start.command → 打开方式 → 终端看到如下输出即成功
[START] Launching proxy... (Ctrl+C to stop)
* Running on http://127.0.0.1:4000
停止服务
在终端窗口按 Ctrl + C。
下载并解压
下载 Windows 版 ZIP,解压到任意目录。
双击 start.bat
首次启动会自动创建虚拟环境并安装依赖,约 10-20 秒。之后启动秒开。
看到如下输出即成功
[START] Launching proxy... (Ctrl+C to stop)
* Running on http://127.0.0.1:4000
停止服务
在窗口里按 Ctrl + C,然后关闭窗口。
打开同目录下的 config.json:
{
"upstream_url": "https://aiimpl.yonyoucloud.com",
"port": 4000
}
| 字段 | 说明 | 默认值 |
|---|---|---|
upstream_url | Anthropic 协议的上游 API 地址 | https://aiimpl.yonyoucloud.com |
port | 本地监听端口 | 4000 |
{
"upstream_url": "https://api.anthropic.com",
"port": 4000
}
改完保存,重启服务生效。
打开 WorkBuddy → 设置 → 模型 → 添加自定义模型
填写以下信息:
| 字段 | 填写内容 |
|---|---|
| Base URL | http://localhost:4000/v1 |
| API Key | 你的上游 API Key |
| 模型名 | 上游支持的模型名(如 DeepSeek-V4-Pro) |
保存,选中新模型,开始对话。
启动代理后,在终端测试:
curl http://localhost:4000/health
返回 {"status":"ok"} 即正常。
curl http://localhost:4000/v1/chat/completions \
-H "Authorization: Bearer 你的KEY" \
-H "Content-Type: application/json" \
-d '{"model":"DeepSeek-V4-Pro","max_tokens":50,"messages":[{"role":"user","content":"你好"}]}'
macOS:终端运行 brew install python3
Windows:去 python.org 重新安装,勾选 "Add Python to PATH",然后重启电脑。
端口被占用了。改 config.json 里的 port,比如改成 8080。
检查 API Key 是否复制完整、有没有首尾空格。API Key 应该是上游服务的 Key。
确认代理还在运行(终端窗口没关)。确认 Base URL 是 http://localhost:4000/v1(不是 https)。
直接在 WorkBuddy 的模型名里填不同的名字就行。代理不限制模型,上游支持什么就能调什么。
是的。这个工具是前台运行的,关窗口即停。需要用的时候双击启动即可。
不会。代理从请求头中读取 Key 并直接转发给上游,不做任何存储或记录。
| 文件 | 说明 |
|---|---|
start.command | macOS 双击启动 |
start.bat | Windows 双击启动 |
config.json | 配置文件(上游地址、端口) |
claude_proxy.py | 核心代码 |
首次启动后会多一个 .venv 文件夹(Python 虚拟环境),属正常文件,不要删除。