Spread Codex turns across several ChatGPT accounts.
Dead simple, one proxied endpoint, 1 SQLite database.
go install github.com/supabitapp/codex-balancer@latestcodex-balancer accounts add # sign in through a local browser
codex-balancer accounts listOr open /accounts in a browser to do it on the web.
State lives in ~/.codex-balancer/state.db.
SQLite stores credentials, affinity owners, routed turns, and events. The server fetches current limits, reset credits, auth state, and model lists. It derives status, totals, activity, response time, and current-month cost from those facts.
export CODEX_BALANCER_KEY=$(openssl rand -hex 16)
codex-balancer server # serve the proxyThe usage poll redeems the earliest available rate-limit reset credit once it is within five minutes of expiry.
GET /stats returns the same live account status as public JSON. Account emails
hide their domain and all but the first and last local-part characters, such as
k***i@***.com. The dashboard stores and shows only a short ID keyed by a
server-only secret; source IPs never enter saved state.
Open /dashboard and enter the server key for the live web dashboard. It
streams the TUI account, total, thread, and event data over WebSocket.
curl http://127.0.0.1:8317/statsIn ~/.codex/config.toml:
model_provider = "balancer"
[model_providers.balancer]
name = "OpenAI"
base_url = "http://127.0.0.1:8317/v1"
requires_openai_auth = true
env_key = "CODEX_BALANCER_KEY"
supports_websockets = truename must be exactly OpenAI: Codex compares it verbatim to decide whether a
provider supports remote compaction and whether to keep encrypted tool
arguments intact.
env_key reads the key from the environment, so every shell running codex
must export it. To bake the key into ~/.codex/auth.json instead, drop the line
and log in once:
printenv CODEX_BALANCER_KEY | codex login --with-api-key