Skip to content

Repository files navigation

codex-balancer

image

Spread Codex turns across several ChatGPT accounts.

Dead simple, one proxied endpoint, no database.

Install

go install github.com/supabitapp/codex-balancer@latest

Add accounts

codex-balancer accounts add                 # sign in through a local browser
codex-balancer accounts list

Or open /accounts in a browser to do it on the web.

Accounts live in ~/.codex-balancer/accounts.json

Serve

export CODEX_BALANCER_KEY=$(openssl rand -hex 16)
codex-balancer server           # serve the proxy

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.

curl http://127.0.0.1:8317/stats

Point Codex at it

In ~/.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 = true

name 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

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages