Codex with Multiple ChatGPT Accounts: Strategies That Work
The Codex CLI signs in one ChatGPT account at a time. The workarounds that exist: separate CODEX_HOME directories, re-login juggling, and gateway fallback lanes.
The Codex CLI holds one ChatGPT sign-in at a time, and there is no built-in account switcher. Two strategies work around that today: keep a separate CODEX_HOME directory per account so each stays signed in, or put a gateway in front that treats your accounts as ordered fallback lanes. Both are only worth doing with accounts you own and pay for yourself, because account sharing is the thing OpenAI’s terms actually prohibit.
Why one login at a time hurts
Codex usage is limited per account, over an hours-scale window plus a weekly cap on paid plans. Heavy users burn through the weekly cap days before it resets, buy a second Plus or Pro subscription, and then discover the CLI gives them no way to use it without logging the first account out. The second subscription idles at exactly the moment it was supposed to help.
This is the loudest recurring complaint in Codex community threads, and it is structural: credentials live in a single auth.json, and the CLI reads exactly one. We cover how limits behave when they hit and the weekly cap mechanics separately. This article is about getting a second account into the rotation.
The prize is simple: limits are enforced per account, so two accounts mean two independent usage windows.
Workaround 1: one CODEX_HOME per account
The CLI stores credentials and config under CODEX_HOME, which defaults to ~/.codex. Point it somewhere else and you get a fully independent login:
# Account A lives in the default location
codex login
# Account B gets its own home
mkdir -p ~/.codex-b
CODEX_HOME=~/.codex-b codex login
# Aliases make switching a habit
alias codex-a='CODEX_HOME=~/.codex codex'
alias codex-b='CODEX_HOME=~/.codex-b codex'
Multi-account Codex at the CLI level is really multi-directory Codex: one CODEX_HOME per login. Both accounts stay signed in, and the pattern carries into scripts, so CODEX_HOME=~/.codex-b codex exec "run the nightly review" works in cron the same way it works in your terminal.
What it does not do is fail over. When account A’s window exhausts halfway through a job, you read the error, kill the run, and rerun on codex-b. A person at a keyboard can do that. A scheduled job at 3 a.m. cannot.
One clarification, because the word “profiles” causes confusion here: profiles in config.toml (selected with --profile) switch models and provider settings, not your ChatGPT identity. Identity lives in auth.json, and there is one per CODEX_HOME.
Workaround 2: re-login juggling
The cruder version: codex logout, codex login, pick the other account in the browser, several times a week. Some people script it further by swapping auth.json files in and out of ~/.codex.
It works, with two honest caveats. Token refreshes can invalidate a copy you swapped out, so the stashed file goes stale at random. And auth.json is a live credential: keep it at 600 permissions, never commit it, never sync it to a shared drive. If shuffling a file that sensitive between directories sounds fragile, that instinct is correct, and the CODEX_HOME approach above is strictly better.
The gateway approach: lanes instead of switching
Codex Hosted was built around this exact gap. Each ChatGPT account you connect signs in through OpenAI’s device-code flow into its own isolated container, never shared, never pooled. We hold no password; the sign-in happens between you and OpenAI. The gateway then orders your accounts as lanes: when account A’s window is exhausted, the next request runs on account B, and your own API key can sit last as metered overflow. The request log names the lane that served every call, so failovers are visible the moment they happen.
Sizing, using our planning estimates (estimates, never guarantees):
| Setup | Subscriptions | API-equivalent capacity (estimate) |
|---|---|---|
| Plus + Plus | $40/mo | ~$1,400 across two windows |
| Pro 5x + Plus | $120/mo | ~$4,200 |
| Pro 5x + Pro 5x | $200/mo | ~$7,000 |
ProxyLLM adds a flat $129/month on top, with no per-token markup. The sizing rule that falls out of the math: when your overflow regularly costs more than a subscription would at API rates, the next account pays for itself. The fallback-lane deep dive covers lane ordering and per-lane logs in detail.
The account rules, stated plainly
Every account in the rotation must be yours: your name, your payment method, your workloads. What OpenAI’s Terms of Use prohibit is sharing credentials or making your account available to someone else. Two subscriptions you own are two subscriptions used as intended; one subscription split between two people is the violation. OpenAI retains discretion over its services regardless, which is why our reading of the terms promises nothing the documents do not support.
The test is ownership. Adding a coworker’s idle account to your rotation fails it. Two accounts on your own card passes it.
Which strategy fits you
Separate CODEX_HOME directories cost nothing and suit interactive work, where you are present to notice a limit and switch by hand. Re-login juggling is the same idea with more ways to break; skip it. The gateway earns its keep when the workload is unattended: agents, cron jobs, CI, anything where a stalled run matters more than a $129 line item.
If you are still deciding whether a second subscription pays for itself, the calculator maps your current API spend to plan tiers in about thirty seconds.
Frequently asked questions
Can the Codex CLI sign in to two ChatGPT accounts at once?
No. The CLI keeps one set of credentials per CODEX_HOME directory (default ~/.codex), so one install holds one signed-in account at a time. Pointing CODEX_HOME at a second directory keeps a second account signed in side by side, but switching between them is manual.
Is using two ChatGPT accounts with Codex against OpenAI's terms?
Owning two accounts is not what the terms prohibit. OpenAI's account clause bans sharing credentials or making your account available to anyone else. Two subscriptions you pay for, each used for your own workloads, is two accounts used as intended. OpenAI keeps discretion over its services either way.
How do I switch ChatGPT accounts in Codex without logging out?
Set CODEX_HOME to a different directory before launching. Each directory holds its own auth.json, so CODEX_HOME=~/.codex-b codex runs the second account while ~/.codex keeps the first signed in. Shell aliases make the switch a two-keystroke habit.
Can Codex fail over to a second account automatically?
Not at the CLI level; the CLI has no concept of a backup account. A gateway can. ProxyLLM runs each connected account in its own isolated container and routes a request to the next account in your order when one hits its limit, then to your own API key.