Spread Codex WebSocket connections across several ChatGPT accounts.
Dead simple, one WebSocket-only proxied endpoint, 1 SQLite database.
go install github.com/supabitapp/codex-balancer@latestexport CODEX_BALANCER_KEY=$(openssl rand -hex 16)
codex-balancer server # serve the proxy with a TUIThe server runs at http://127.0.0.1:8317
/dashboard— HTML dashboard/stats— JSON stats of the server/accounts— add an account. On a real server, send this to your friends so they join the pool without exposing credentials.
There is a CLI to manage the accounts
codex-balancer accounts add # sign in through a local browser
codex-balancer accounts listState lives in ~/.codex-balancer/state.db.
SQLite stores credentials, routed turns, and events. The server fetches current limits, reset credits, current-cycle credit burn, auth state, and model lists. It derives status, totals, activity, response time, and current-month cost from those facts.
On every machine that runs Codex, save the server key at ~/.codex/balancer-api-key with mode 600:
chmod 600 ~/.codex/balancer-api-keyIn ~/.codex/config.toml:
model_provider = "balancer"
[model_providers.balancer]
name = "OpenAI" # must be exactly this for server-side compaction to work
base_url = "http://127.0.0.1:8317/v1"
supports_websockets = true
[model_providers.balancer.auth]
command = "/bin/sh"
args = ["-c", "exec /bin/cat \"$HOME/.codex/balancer-api-key\""]Routing logic is in ROUTING.md, keep that up to date and simple, human readable