CLIProxyAPI:一款强大的可以实现大模型服务API调用自由的工具
代码仓路径:https://github.com/router-for-me/CLIProxyAPI
0. 工具特点总结
- 统一Anthropic协议和OpenAI协议,不管你后端用的是什么工具(Claude Code还是Codex还是OpenCode,统一API接入,随便用)
- 支持将付费的API配置上去
- [最强大的来了],很多大模型服务商提供了网页版,通常是完全免费或额度极大(虽然不是最新款模型),这款工具支持通过网页登录认证的方式转成本地API调用的方式。
- 上述所有可用的API,如果额度用光了,这个工具可以自动切换到其他API上;如果你有多个账号,那就可以实现API自由了。
1. 工具安装
- 直接安装使用:https://help.router-for.me/cn/introduction/quick-start.html
- 自己源码编译,docker部署:https://help.router-for.me/cn/hands-on/tutorial-5.html
cd CLIProxyAPI
bash docker-build.sh
选择1 或者 docker compose up -d
2. 付费API配置
- 配置介绍-官方版:https://help.router-for.me/cn/hands-on/tutorial-0.html
- 懒人版:
git clone https://github.com/router-for-me/CLIProxyAPI.git
cd CLIProxyAPI
cp config.example.yaml config.yaml
打开config.yaml文件,找到下方关键字段配置即可:
... 省略很多 ....
# API keys for authentication
api-keys:
- "proxy_001" ##### 重点填这个:可以设置多个api-keys,这个key就用到你的claude code、opencode等工具中,配置中把这行注释删掉
# Gemini API keys
gemini-api-key: #--- 如果有谷歌的key,可以在这边配置,主要配置api_key即可;如果没有,就把整段删掉
- api-key: "AI........." ##### 重点填这个
base-url: "https://generativelanguage.googleapis.com"
headers:
X-Custom-Header: "custom-value"
models:
- name: "gemini-3-flash-preview"
alias: "gemini-3-flash"
- name: "gemini-3-pro-preview"
alias: "gemini-3"
# Claude API keys
claude-api-key: ##### 如果有自己买的z.ai的GLM4.7,可以配置在这
- api-key: "c4ba....." ##### 重点填这个
base-url: "https://open.bigmodel.cn/api/anthropic"
headers:
X-Custom-Header: "custom-value"
models:
- name: "glm-4.7" ##### 重点填这个
alias: "glm4.7" ##### 重点填这个
cloak:
mode: "auto"
strict-mode: false
sensitive-words:
- "API"
- "proxy"
# OpenAI compatibility providers
openai-compatibility:
- name: "huoshan" ##### 如果有火山引擎买的OpenAI协议的,可以在这填,主要是下方的base-url、api-key和name。
base-url: "https://ark.cn-beijing.volces.com/api/v3" ##### 重点填这个
headers:
X-Custom-Header: "custom-value"
api-key-entries:
- api-key: "db6e0ad7-6362-43e8-b246-f544e6a6a32d" ##### 重点填这个
models: # The models supported by the provider.
- name: "ep-20260212220515-6hmv6" ##### 重点填这个
alias: "hs-glm4.7" # The alias used in the API.
3. 免费网页版认证登录
推荐注册下列平台,弹出认证窗口之后,按照引导登录账号认证即可。别管他什么免费,免费多少。
- Gemini:注册Google AI Studio还可以免费用gemini 3,认证方式:
./cli-proxy-api --login - Antigravity:用谷歌账号登录(貌似可用Claude模型),认证方式:
./cli-proxy-api --antigravity-login - Codex:也就是ChatGPT,认证方式:
./cli-proxy-api --codex-login - Qwen:千问,认证方式:
./cli-proxy-api --qwen-login - Kimi:Kimi,认证方式:
./cli-proxy-api --kimi-login - Nvidia:英伟达也提供了各种免费的模型(当然限制会多一些),注册地址:https://build.nvidia.com/explore/discover
4. 集成使用
添加URL和API KEY就可以用了。
Claude Code:https://help.router-for.me/cn/agent-client/claude-code.html
其他的:就在上边的文档中,自己找
5. 效果演示
- 配置效果

- 使用效果

- 网页版效果


浙公网安备 33010602011771号