Named profiles for your pile of Codex logins
A tiny Python CLI that turns juggling multiple Codex accounts into save, switch, and check-usage — with the official CLI still doing all the actual logging in.
What it does
codex-account keeps named local profiles of your Codex logins (ChatGPT OAuth or API key), so you can save main, add work, and use work instead of re-authenticating every time. It also queries real-time usage — the 5-hour and 7-day windows, remaining percentages, reset times — for one or all accounts. Everything stays on your machine; the official codex CLI handles browser auth, device codes, and token refresh.
The interesting bit
Usage queries go through the official codex app-server, so checking quotas doesn’t create a conversation or burn a model request. Switching is atomic with a backup of your previous login, and new accounts log in inside a throwaway temp CODEX_HOME so a failed attempt never clobbers your current session.
Key highlights
- Zero third-party Python dependencies at runtime; macOS/Linux, Python 3.11+
- Export/import archives for moving accounts between your own machines, with conflict checks and newer-credential resolution
- Scriptable: JSON output, per-account timeouts, explicit exit codes, batch queries that continue past failures
- Credentials stored with directory
700/ file600permissions; emails masked by default - Honest display rules: unknown plan types shown as
unknown, missing windows as “not provided” — never faked as 0% or unlimited
Caveats
filecredential storage only — no Windows, keyring, enterprise tokens, or custom providers- Export files are plaintext credentials; the README rightly tells you to treat them like passwords
- No hot-switching: you must quit Codex CLI and the desktop app first, and the tool blocks if it detects them running
Verdict
Worth a look if you genuinely run multiple Codex accounts and are tired of the login dance. If you have one account, this solves a problem you don’t have.
Frequently asked
- What is shx2005/codex-account-switcher?
- A tiny Python CLI that turns juggling multiple Codex accounts into save, switch, and check-usage — with the official CLI still doing all the actual logging in.
- Is codex-account-switcher open source?
- Yes — shx2005/codex-account-switcher is open source, released under the MIT license.
- What language is codex-account-switcher written in?
- shx2005/codex-account-switcher is primarily written in Python.
- How popular is codex-account-switcher?
- shx2005/codex-account-switcher has 560 stars on GitHub.
- Where can I find codex-account-switcher?
- shx2005/codex-account-switcher is on GitHub at https://github.com/shx2005/codex-account-switcher.