# CLIProxyAPI — Local Proxy for AI Coding CLIs > CLIProxyAPI runs a local proxy that exposes OpenAI/Gemini/Claude/Codex-compatible endpoints for CLI tools. Configure YAML, then start with docker compose. ## Install Save as a script file and run: ## Quick Use 1. Install the verified entrypoint: ```bash git clone https://github.com/router-for-me/CLIProxyAPI && cd CLIProxyAPI && cp config.example.yaml config.yaml ``` 2. Run a first local check: ```bash docker compose up -d --build ``` 3. Add a repeatable verification step: ```bash curl -s http://127.0.0.1:8317/v1/models | head ``` --- ## Intro CLIProxyAPI is a verified GitHub-backed asset sourced from `router-for-me/CLIProxyAPI` with 32,053 stars and a MIT license snapshot. Best for: power users who want one local API surface to route multiple CLI-backed accounts/providers into SDKs and tools. Works with: Docker + docker compose; exposes OpenAI/Gemini/Claude/Codex-compatible endpoints (per repo). Setup time: 15 minutes. ### Quantitative notes - Default service port 8317 (repo config) - Docker compose exposes multiple ports (repo docker-compose.yml) --- ## Deep Dive ### What it solves Use this when you need a **repeatable, team-shareable workflow** instead of one-off agent prompts. The goal is to make installation, first-run validation, and rollback **predictable**. ### Minimal mental model - Treat the GitHub repo as the source of truth: install instructions, configs, and upgrade paths live there. - Keep your first run small: one command, one verification, one rollback plan. - Capture a baseline: setup time, first successful run, and one real task completed end-to-end. ### Safe rollout checklist 1. **Verify source**: confirm repo URL, stars, and license match what you expect. 2. **Install** using the Quick Use commands above. 3. **Prove it works** with the verification command; save the output in a note or issue. 4. **Operationalize**: document owner, upgrade command, and rollback command. ### Troubleshooting (common) - **Install succeeds but nothing shows up** - Likely cause: the tool needs a restart/reload (CLI/IDE) or a config file in the right path. - Fix: restart the client, then re-run the verification step. - **Works on one machine, fails on another** - Likely cause: Node/Python/Docker versions differ or missing system dependencies. - Fix: pin versions (Node/Python), and copy a minimal known-good config. - **Token cost or latency is worse than expected** - Likely cause: tool schemas or verbose outputs get injected into context. - Fix: prefer smaller steps, cache results, and keep tool responses concise when possible. --- ### FAQ **Q: Is it safe to expose publicly?** A: The repo config supports binding host; keep it on localhost unless you fully understand auth keys and firewalling. **Q: How do I add credentials?** A: Use the repo's YAML config (api-keys + provider sections) and keep secrets outside git. **Q: How do I debug routing issues?** A: Check container logs, then validate `/v1/models` and one minimal request before integrating a full client. --- ## Source & Thanks > GitHub: https://github.com/router-for-me/CLIProxyAPI > Owner avatar: https://avatars.githubusercontent.com/u/233033915?v=4 > License (SPDX): MIT > Stars (verified via `api.github.com/repos/router-for-me/CLIProxyAPI`): 32,053 --- # CLIProxyAPI——AI 编程 CLI 的本地代理 > CLIProxyAPI 在本地启动代理服务,为 CLI 工具提供 OpenAI/Gemini/Claude/Codex 兼容接口与路由。按示例创建 config.yaml,并用 docker compose 启动容器,即可在 8317 等端口提供服务。 ## 快速使用 1. 安装(以仓库为准): ```bash git clone https://github.com/router-for-me/CLIProxyAPI && cd CLIProxyAPI && cp config.example.yaml config.yaml ``` 2. 首次运行/检查: ```bash docker compose up -d --build ``` 3. 可重复验证: ```bash curl -s http://127.0.0.1:8317/v1/models | head ``` --- ## 简介 CLIProxyAPI 已核验来源于 `router-for-me/CLIProxyAPI`(32,053 stars,许可证 MIT)。适合:想把多账号/多 provider 的 CLI 能力统一成一个本地 API 面的重度用户与团队。兼容:Docker + docker compose;对外暴露 OpenAI/Gemini/Claude/Codex 兼容接口(见仓库说明)。装机时间:15 分钟。 ### 量化信息 - 默认端口 8317(仓库配置) - docker-compose.yml 暴露多个端口(仓库) --- ## 深度说明 ### 解决什么问题 把“找到项目 → 安装 → 首次验证 → 回滚/升级”变成可复用流程,避免只靠一次性提示词或截图操作。 ### 最小心智模型 - GitHub 仓库是事实来源:安装、配置、升级、已知问题都以它为准。 - 第一次只做最小闭环:一个命令安装、一个命令验证、一个可回滚方案。 - 记录基线:装机耗时、首次成功输出、完成 1 个真实任务的证据。 ### 安全推广清单 1. **核验来源**:确认仓库 URL / stars / license 与预期一致。 2. 按“快速使用”完成安装与首次检查。 3. 跑通“验证命令”,把输出留档。 4. 标注 owner,并写清升级/回滚步骤。 ### 常见排障 - **装了但看不到效果** - 常见原因:需要重启 CLI/IDE 或配置文件路径不对。 - 处理:重启后再跑一遍“验证命令”。 - **一台机器能跑,另一台不行** - 常见原因:Node/Python/Docker 版本差异或缺少系统依赖。 - 处理:固定版本,并拷贝最小可用配置。 - **token 成本/延迟超预期** - 常见原因:工具 schema 或输出过长被塞进上下文。 - 处理:拆小步骤、缓存结果、尽量让工具输出更短。 --- ### FAQ **Q: 能直接公网暴露吗?** A: 配置支持绑定 host;除非你完全理解认证与网络边界,否则只建议跑在 localhost。 **Q: 怎么添加凭据?** A: 按仓库 YAML 配置填 api-keys 与各 provider 段,密钥不要提交到 git。 **Q: 路由不对怎么排查?** A: 先看容器日志,再用 `/v1/models` 做最小验证,最后再接入完整客户端/SDK。 --- ## 来源与感谢 > GitHub:https://github.com/router-for-me/CLIProxyAPI > Owner avatar:https://avatars.githubusercontent.com/u/233033915?v=4 > 许可证(SPDX):MIT > GitHub stars(已通过 `api.github.com/repos/router-for-me/CLIProxyAPI` 核验):32,053 --- Source: https://tokrepo.com/en/workflows/cliproxyapi-local-proxy-for-ai-coding-clis Author: Script Depot