CLIProxyAPI + OpenCode

张开发
2026/4/19 10:46:34 15 分钟阅读

分享文章

CLIProxyAPI + OpenCode
LIProxyAPI一键安装,# https://help.router-for.me/cn/introduction/quick-start.html curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bashGo 代码 有环境直接源码编译再systemd管理服务。配置使用$ cd ~/cliproxyapi/ # 使用配置 # auth-dir 指定凭证目录用于多账户 # remote-management 管理页面设定密钥加一下 $ nano config.yaml # Codex OAuth 登录 $ ./cli-proxy-api --codex-login ... Codex authentication successful Saving credentials to /home/john/.cli-proxy-api/codex-*.json Authentication saved to /home/john/.cli-proxy-api/codex-*.json Codex authentication successful! # 启动服务 $ ./cli-proxy-api ... API server started successfully on: :8317 # 常驻服务 $ systemctl --user start cliproxyapi.service # 访问服务 $ curl http://localhost:8317/ {endpoints:[POST /v1/chat/completions,POST /v1/completions,GET /v1/models],message:CLI Proxy API Server} # 管理界面 $ open http://localhost:8317/management.html管理界面OpenCode一键安装,# https://opencode.ai/docs/zh-cn/ curl -fsSL https://opencode.ai/install | bash # or npm i -g opencode-ailatest$ opencode -v 1.2.24配置使用# 设置环境变量快速开始 cat -EOF ~/.bashrc # openai export OPENAI_BASE_URLhttp://localhost:8317/v1 export OPENAI_API_KEYsk-gocoding EOF printenv | grep OPENAI # 使用全局配置规范方式 nano ~/.config/opencode/opencode.json # 启动 OpenCode opencode # 启动 OpenCode指定工程目录 mkdir -p ~/Codes/hello-code opencode ~/Codes/hello-code运行界面编写代码

更多文章