CLIProxyAPI
$ cliproxyapi 社区开源 中风险CLIProxyAPI 可将本地 AI CLI 订阅(Claude Code、Codex、Gemini CLI 等)转换为兼容 OpenAI、Anthropic 与 Gemini 协议的 HTTP API 服务,并支持多账号负载均衡。通过 --config <config.yaml> 配置运行,配合 --codex-login、--codex-device-login 等 OAuth 登录参数完成授权。
brew install cliproxyapi cliproxyapi 作为常驻 HTTP API 代理守护进程对外提供 /v1/chat/completions 与 /v1/messages 接口,而非交互式 CLI 或 MCP 服务。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
可通过 --config <config.yaml> 稳定启动,但属于长驻 HTTP 代理守护进程,且首次需通过交互式浏览器或设备码完成 OAuth 登录。
cliproxyapi --config <config.yaml>,--codex-login,--codex-device-login
支持在 config.yaml 中配置本地 API Key 与回环绑定,但将消费级 CLI 订阅封装为 HTTP API 存在服务条款合规与本地令牌暴露风险。
- OAuth token files in
~/.cli-proxy-api/and provider subscription wrapping
单一 Go 二进制,支持 brew install cliproxyapi、Docker、AUR 与 GitHub Releases 覆盖 macOS、Linux、Windows。
- Homebrew formula
cliproxyapi, Docker, and release binaries
将多套编码 CLI 后端统一收拢到标准 HTTP 接口,并提供多账号轮询与故障转移。
- Unified local API endpoint with multi-account load balancing
社区维护活跃的 MIT 开源 Go 项目(router-for-me/CLIProxyAPI)。
router-for-me/CLIProxyAPIMIT repository
help.router-for-me.com 与 GitHub README 覆盖了 YAML 配置与 OAuth 登录流程。
- Docs site
help.router-for-me.comand GitHub README
安全边界、鉴权与放权指南
在 ~/.cli-proxy-api/ 存储上游 OAuth 令牌,并从 config.yaml(或 /opt/homebrew/etc/cliproxyapi.conf)读取网关配置与 API Key。
MIT 开源免费代理;请求消耗你已有的 AI CLI 或 API 订阅额度。
# CLIProxyAPI Agent Rules - Run `cliproxyapi` as a background service (`brew services start cliproxyapi`) rather than blocking an agent shell turn. - Restrict `config.yaml` bind address to `127.0.0.1` and protect local `api-keys`.
Agent 高频安全命令配方
只读查询(安全推荐)
cliproxyapi --help
打印 --config 与各提供商 OAuth 登录参数,不启动 HTTP 服务。
受控写入与预演
cliproxyapi --config ~/.cli-proxy-api/config.yaml
按显式路由与鉴权配置启动本地 OpenAI/Claude/Gemini 兼容 API 网关。
核心优势
- + 将 Codex、Claude 与 Gemini CLI 后端统一暴露为标准 OpenAI/Anthropic/Gemini HTTP API。
- + 除桌面浏览器 OAuth 外,还支持无头环境的
--codex-device-login。
注意事项与踩坑点
- ! 将个人 CLI 订阅转接为 HTTP API 可能触及上游服务商的服务条款限制。
- ! 以阻塞式 HTTP 守护进程运行,不具备单次执行的
--json查询命令。