This note records a CLI Proxy API setup.
Example values:
- config directory:
/root/.cli-proxy-api - install directory:
/root/cliproxyapi - public domain:
cpa.example.com - HTTPS port:
8317 - management URL:
https://cpa.example.com:8317/management.html - API endpoint:
https://cpa.example.com:8317/v1 - API key:
sk-example-cpa-key-please-change - remote management secret:
example_remote_management_secret_change_me
All secrets above are fake.
Sync Config
If you prepare config locally and sync it to the server:
rsync -avzP --exclude='logs/*' ~/.cli-proxy-api/ root@198.51.100.20:~/.cli-proxy-api/Lock down the config directory:
chmod 700 ~/.cli-proxy-apichmod 600 ~/.cli-proxy-api/config/config.yamlchmod 600 ~/.cli-proxy-api/*.jsonInstall
curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bashThen enter the install directory:
cd /root/cliproxyapiLogin Providers
Run only the login flows you need:
./cli-proxy-api --login # Gemini./cli-proxy-api --codex-login # OpenAI./cli-proxy-api --claude-login # Claude./cli-proxy-api --qwen-login # Qwen./cli-proxy-api --iflow-login # iFlowThese login artifacts are credentials. Keep the auth directory private.
config.yaml
Example config:
host: "0.0.0.0"port: 8317
tls: enable: true cert: "/root/.cli-proxy-api/config/certs/fullchain.pem" key: "/root/.cli-proxy-api/config/certs/privkey.pem"
remote-management: allow-remote: true secret-key: "example_remote_management_secret_change_me" disable-control-panel: false disable-auto-update-panel: true panel-github-repository: "https://github.com/router-for-me/Cli-Proxy-API-Management-Center"
auth-dir: "/root/.cli-proxy-api"
api-keys: - "sk-example-cpa-key-please-change"
19 collapsed lines
debug: falsepprof: enable: false addr: "127.0.0.1:8316"
commercial-mode: truelogging-to-file: truelogs-max-total-size-mb: 0error-logs-max-files: 10usage-statistics-enabled: trueproxy-url: ""force-model-prefix: falsepassthrough-headers: falserequest-retry: 3max-retry-credentials: 2max-retry-interval: 30disable-cooling: falseauth-auto-refresh-workers: 2
routing: strategy: "round-robin" session-affinity: false session-affinity-ttl: "1h"
ws-auth: falseenable-gemini-cli-endpoint: falsenonstream-keepalive-interval: 0Service Management
Console mode:
./cli-proxy-apiUser systemd service:
systemctl --user enable cliproxyapi.servicesystemctl --user start cliproxyapi.servicesystemctl --user status cliproxyapi.serviceRestart after config changes:
systemctl --user restart cliproxyapi.serviceAccess
Management Center: https://cpa.example.com:8317/management.htmlAPI Endpoint: https://cpa.example.com:8317/v1Test:
curl https://cpa.example.com:8317/v1/models \ -H "Authorization: Bearer sk-example-cpa-key-please-change"Notes
api-keys, login files, and provider refresh tokens are secrets.- If TLS is handled inside CLI Proxy API, renew and deploy certificate files consistently.
- If Caddy handles TLS instead, bind CLI Proxy API to localhost and disable internal TLS.
- Keep pprof on
127.0.0.1only.