Codex CLI · Tested with aisw v0.3.8 · Desktop v0.2.0 · Updated July 17, 2026
How to Switch Codex CLI Accounts
Save each Codex CLI account as an aisw profile, then run aisw use codex <profile> to switch. aisw writes the profile's credentials to the same auth.json or keyring entry Codex CLI already uses, so there's no manual file copying involved.
Codex CLI keeps one active account in auth.json or a system keyring, with no built-in concept of saved, named accounts. Switching normally means manually backing up and restoring that file. aisw wraps that process in a single command.
Before you start
Install aisw if you haven’t already:
brew tap burakdede/tap && brew install aiswCLI method
1. Capture the account you’re currently signed into.
aisw initIf Codex CLI is already signed in when you run this, init detects it and offers to import it as a named profile right in the prompt — accept it and skip the next command. Otherwise, or if you already ran init on this machine before, capture it explicitly:
aisw add codex work --from-liveRe-running aisw init later is safe; it just re-detects live accounts and reports current state without touching profiles you’ve already saved. For a durable Codex profile that survives future ChatGPT-managed token refreshes cleanly, sign in directly into the named profile instead of relying on --from-live long-term — see the next step.
2. Add a second account.
Interactively, using Codex CLI’s own OAuth flow:
aisw add codex personalOr from an API key already in your environment:
aisw add codex ci --from-env3. Switch between them.
aisw use codex workaisw use codex personal4. Confirm which account is active.
aisw statusDesktop method
AI Switcher Desktop v0.2.0 is publicly available, and the current release assets cover macOS, Windows x64, and Linux x64. Download the matching build from /download/, then follow the same switch flow below.
Screenshot placeholder
AI Switcher Desktop Overview screen with the Codex CLI column showing two saved profiles and an active-state badge
- Open AI Switcher Desktop and go to Overview.
- In the Codex CLI column, select the profile you want active and click Activate.
- Or press ⌘K for Quick Switch and type the profile name.
Common problems
If aisw add codex <name> --from-live fails to read the current credentials, Codex CLI may be using a keyring backend aisw doesn’t have permission to read yet — re-run the command after granting keyring access when your OS prompts for it. For anything else, aisw doctor diagnoses common environment issues.
If add fails with an error naming a different existing profile, that Codex account is already saved under that name — aisw checks the underlying OpenAI identity, not just the profile name, and won’t create a duplicate. Use the existing profile or remove it first if you actually want to re-add it under a new name.
If add fails with “profile already exists” instead, that’s a name collision rather than an account duplicate — pick a different name, or re-run with --yes to overwrite the existing profile’s stored credential.
Frequently asked questions
Where does Codex CLI store credentials that aisw manages?
Depending on your install, Codex CLI stores credentials in auth.json or in a system keyring. aisw detects which one your install uses and writes profiles to that same location.
Can aisw import a Codex CLI account I'm already signed into?
Yes, where the credential file is readable. Use aisw add codex <name> --from-live to capture the account that's currently active.