Claude
3 OAuth sessions
CENTRAL SERVER BLUEPRINT · REV 01
Centralize Claude, Grok and Codex CLI traffic without copying provider OAuth credentials into employee Linux profiles.
127.0.0.1:8317
One native systemd service
3 OAuth sessions
3 OAuth sessions
1 OAuth session
Selected for this Ubuntu host
cliproxyapi.service
One client key per SSH user
U1 … U7 → 7 unique keys
Management stays localhost-only
ssh -L 8317:127.0.0.1:8317 …
The engineer only handles SSH and their local CLI. Provider OAuth stays inside the service account's protected auth directory.
Engineer enters their own Linux profile on the central server.
$ ssh user@serverThe profile config points Claude or Codex at the local gateway.
http://127.0.0.1:8317A unique proxy key authenticates the inbound client request.
principal: user_03A healthy matching credential is selected; an existing session can stay sticky.
strategy: round-robinThe gateway translates the protocol and relays the response to the CLI.
response: streamingService and request metadata support troubleshooting and capacity checks.
status · latency · routeThe request stays bound to one credential for the session. If that credential becomes unavailable, the router can fail over and rebind.
| Area | Linux profile | CLIProxyAPI | OAuth vault | Provider |
|---|---|---|---|---|
| Identity | Owns SSH access and one client key | Validates key and resolves principal | Not exposed | Recognizes selected OAuth account |
| Credentials | No provider token stored | Reads protected auth files | Stores and refreshes OAuth state | Issues and validates tokens |
| Routing | Sends to local endpoint | Selects, binds, cools down, fails over | Provides eligible sessions | Enforces upstream availability |
| Logs | Shell/CLI logs in own home | System and request diagnostics | Refresh/auth events | Upstream response and limits |
Employees can call the localhost endpoint, but ordinary profiles cannot read configuration, OAuth files, the management key, or another user's home.
/etc/cliproxyapi/ └── config.yaml 0640 root:cliproxyapi /var/lib/cliproxyapi/ └── auth/ 0700 cliproxyapi ├── claude-*.json ├── xai-*.json └── codex-*.json /var/log/cliproxyapi/ rotated logs /etc/systemd/system/ └── cliproxyapi.service
host: "127.0.0.1"
port: 8317
auth-dir: "/var/lib/cliproxyapi/auth"
remote-management:
allow-remote: false
secret-key: "${MANAGEMENT_SECRET}"
api-keys:
- "${USER_01_KEY}"
- "${USER_02_KEY}"
- "… one per SSH user"
routing:
strategy: "round-robin"
session-affinity: true
session-affinity-ttl: "1h"
Yes—the server must be online whenever anyone uses a proxied CLI. If the host, service, SSH path, or local listener is unavailable, all seven proxied profiles stop working together.
flowchart LR
subgraph SSH[SSH trust boundary]
U[7 isolated Linux users]
end
subgraph HOST[Central Ubuntu server]
K[Per-user API keys]
P[CLIProxyAPI\n127.0.0.1:8317]
R[Round-robin + 1h affinity]
V[(Protected OAuth vault)]
end
subgraph POOLS[Provider pools]
C[Claude × 3]
G[Grok × 3]
X[Codex × 1]
end
U --> K --> P --> R --> V
V --> C
V --> G
V --> X
Build the gateway first, add OAuth sessions second, then validate with one heavy user before pointing all seven profiles at it.
curl /v1/models → 200/management.htmlone user · real workloadseven users · one endpoint| Signal | Technical cause | Expected gateway behavior | Operator action |
|---|---|---|---|
| OAuth expiry | Access token expired and refresh failed | Credential becomes unavailable; bound sessions may rebind | Re-authenticate that provider in the tunneled UI |
| Provider limit | One account/model is temporarily limited | Cool down or fail over to another eligible credential | Confirm pool health; test the affected model explicitly |
| Gateway down | Process crash, bad config, failed update | systemd attempts restart; local calls fail meanwhile | Check systemctl status and journalctl -u |
| Session collision | Concurrent tools reuse session identity unexpectedly | Affinity can bind requests to an unintended credential | Inspect headers/IDs; shorten TTL or disable affinity for test |
| Log pressure | Verbose request logging grows on disk | Service continues until I/O or disk becomes constrained | Rotate, cap retention, alert on disk threshold |
| Client drift | Claude/Codex update changes protocol or endpoint behavior | Translation or streaming can regress | Keep a canary profile and pin/roll back versions |
The bundled control panel can refresh itself from its configured repository. The proxy binary should use a pinned release and a tested upgrade/rollback procedure.
Background panel updates are enabled by default unless disabled in configuration.
Download a known release, checksum it, stop, replace, start, validate, and retain the previous binary.
Test Claude and Codex upgrades with one canary Linux profile before the team-wide update.