CLI Proxy API Setup
CLI Proxy API Setup
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:
1 | rsync -avzP --exclude='logs/*' ~/.cli-proxy-api/ root@198.51.100.20:~/.cli-proxy-api/ |
Lock down the config directory:
1 | chmod 700 ~/.cli-proxy-api |
Install
1 | curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash |
Then enter the install directory:
1 | cd /root/cliproxyapi |
Login Providers
Run only the login flows you need:
1 | ./cli-proxy-api --login # Gemini |
These login artifacts are credentials. Keep the auth directory private.
config.yaml
Example config:
1 | host: "0.0.0.0" |
Service Management
Console mode:
1 | ./cli-proxy-api |
User systemd service:
1 | systemctl --user enable cliproxyapi.service |
Restart after config changes:
1 | systemctl --user restart cliproxyapi.service |
Access
1 | Management Center: https://cpa.example.com:8317/management.html |
Test:
1 | curl https://cpa.example.com:8317/v1/models \ |
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.