Manage multiple Codex CLI accounts with ease.
codex-accounts swaps ~/.codex/auth.json and the account-specific parts of ~/.codex/config.toml. Local project trust settings under [projects."<path>"] stay on your machine.
codex-accounts-demo.mp4
Interactive install:
curl -fsSL https://jojoml.github.io/tools/codex-accounts.sh | bashThe installer will:
- download the latest
codex-accounts - install it to
~/.local/bin/codex-accounts - create
~/.local/binif needed - make it executable
- ask whether to add
~/.local/bintobashorzsh
Non-interactive install:
curl -fsSL https://jojoml.github.io/tools/codex-accounts.sh | bash -s -- --shell zsh
curl -fsSL https://jojoml.github.io/tools/codex-accounts.sh | bash -s -- --shell bash# Save the account you are currently using
codex login
codex-accounts save personal
# If this account needs a custom provider/model, set ~/.codex/config.toml first
# then save it so those settings travel with the account
# Add another account
codex-accounts add work
codex login
codex-accounts save work
# Switch any time
codex-accounts switch personal
codex-accounts switch work
# See usage for all saved accounts
codex-accounts usage- keep your local Codex history and state
- switch accounts by name instead of logging in from scratch each time
- see per-account Codex usage snapshots in one place
codex-accounts list
codex-accounts current
codex-accounts save <name>
codex-accounts add <name>
codex-accounts switch <name>
codex-accounts usageThis tool manages ~/.codex/auth.json and account-scoped config snapshots.
If Codex is using the OS keychain/keyring, there may be no auth.json file to switch. In that case, set Codex to file-based credentials:
# ~/.codex/config.toml
cli_auth_credentials_store = "file"Then run:
codex loginWhen you switch accounts, it updates:
~/.codex/auth.json~/.codex/config.tomlexcept local[projects."<path>"]sections~/.codex-switch/state
Everything else under ~/.codex stays where it is, including:
history.jsonlsessions/log/memories/
- macOS or Linux
- Codex CLI installed
jqforcodex-accounts usage
If you do not have Codex CLI yet:
brew install codex- saved accounts are stored as plain
auth.jsoncopies under~/codex-data - saved config snapshots are stored under
~/codex-data/<name>.config.toml [projects."<path>"]trust settings stay local and are merged back in on switch- protect
~/codex-datalike any other credential store - if a saved account shows an expired token in
usage, log into that account again and runcodex-accounts save <name>