Free & Open Source

Manage Multiple Codex Accounts
on One Machine

Save multiple OpenAI Codex login sessions and switch between them instantly with a single command — no re-login required.
Supports Windows, Linux, and macOS.

PowerShell
PS> irm https://raw.githubusercontent.com/yazelin/codex-auth-switcher/main/install-oneliner.ps1 | iex
bash / zsh
$ bash <(curl -fsSL https://raw.githubusercontent.com/yazelin/codex-auth-switcher/main/install-oneliner.sh)

Git is required. No Git? See how to install it here

Solve the Multi-Account Pain Points of Codex
Store

Multiple Account Sessions

Each Codex account's auth token is saved as its own isolated profile — they never interfere with each other.

Switch

Instant Switching with One Command

cx switch opens an interactive menu. Pick an account, press Enter, and Codex restarts under the new profile automatically.

Track

Automatic Usage Limit Tracking

After each Codex session ends, usage limits are scanned automatically. See at a glance which accounts are capped and when they reset.

Share

Config & History Fully Shared

Config, hooks, and session history are shared across all profiles. Only the auth token changes — everything else stays untouched.

What actually gets swapped on a switch?
ItemLocationSwitched / Shared
Account auth token~/.codex/auth.jsonswitched per profile
Config, hooks~/.codex/config.toml, hooks.jsonshared
Sessions, /resume history, sqlite state~/.codex/shared
skills, plugins~/.codex/shared
Only auth.json (the account token) is switched; everything else is shared. Launching through the codex wrapper runs against the normal ~/.codex, so conversations, /resume and config stay shared across accounts.
Adding an account is safe: cx login signs in inside an isolated temporary home and never touches your other saved accounts — so multiple accounts (including several workspaces under one ChatGPT account) coexist without logging each other out.
From Installation to Your First Switch
1

Open PowerShell and paste the install command

Press Win + X, choose "Windows PowerShell" or "Terminal", then paste the full command below (Ctrl+V) and press Enter.

PowerShell
PS> irm https://raw.githubusercontent.com/yazelin/codex-auth-switcher/main/install-oneliner.ps1 | iex

Once installation completes, the terminal will print next-step instructions automatically.

2

Save your current Codex account

If you are already logged in to Codex, run this command to save the existing session as a profile named "main":

PowerShell
PS> cx import main

"main" is just a name — feel free to use your own name or any nickname you prefer.

3

Add a second account

Run cx login followed by the profile name you want. The Codex login window will open:

PowerShell
PS> cx login work # After login completes, the "work" profile is saved
4

List all account statuses

PowerShell
PS> cx list CURRENT PROFILE LOGIN EMAIL PLAN LIMIT * main ok ma***@gmail.com plus - work ok wo***@company.com team -

* marks the currently active account.

5

Switch accounts with the interactive menu

This is the recommended way to switch — it automatically closes any running Codex before switching:

PowerShell
PS> cx switch
Controls: Up/Down to navigate   Enter to confirm   Esc to cancel
6

Launch Codex

PowerShell
PS> codex

Always launch via codex (not the original codex.exe directly) so that account switching takes effect.

1

Open a terminal and paste the install command

bash / zsh
$ bash <(curl -fsSL https://raw.githubusercontent.com/yazelin/codex-auth-switcher/main/install-oneliner.sh)
2

Reload your shell (or open a new terminal)

bash
$ source ~/.bashrc # zsh users: run source ~/.zshrc instead
3

Save your current account and add more

bash
$ cx import main # save existing account $ cx login work # add a second account
4

Switch accounts

bash
$ cx use work # switch to the work account $ codex # launch Codex
cx switch Menu Preview
PowerShell / bash — cx switch
Codex Profile Switcher (Up/Down: navigate | Enter: switch | Esc: cancel) ───────────────────────────────────────────────────────────── * main ok 5h 97% left @06:15 | W 48% left @Sun 05:45 (4m) work ok 5h 22% left @03:59 | W 59% left @Sun 10:06 (2h) !hit until 2026-05-27 09:00 personal ok

Blue highlight = currently selected account  /  * = currently active  /  !hit = usage limit reached

All cx Commands
CommandDescription
cx switch [--live]NEWInteractive menu to switch accounts; automatically closes Codex first. --live refreshes usage before displaying.
cx killNEWImmediately terminate all running Codex processes
cx import <name>Save the current login session as a named profile
cx login <name>Open the Codex login flow and save credentials as a new profile
cx use <name>Switch the shared active profile
cx list [--live]List all profiles and their status. --live refreshes usage first.
cx usage [name|--all]Fetch live usage; updates all profiles when called without arguments
cx info [name]Show detailed information for a single profile
cx currentPrint the name of the currently active profile
cx remove <name>Delete a profile
cx psShow currently detected Codex processes
cx doctorDiagnostic tool: shows paths, process status, and profile overview
cx export profiles.tgzBack up all profiles to a compressed archive
cx restore profiles.tgzRestore profiles from a compressed archive
cx ok <name>Manually clear the usage-limit flag for a profile
cx helpShow built-in command reference
codexLaunch Codex under the currently active profile
FAQ
Git is not installed. What do I do?

Windows: Run this in PowerShell:

winget install --id Git.Git -e --source winget

Close and reopen PowerShell after installation — git will then be available.

Linux (Ubuntu/Debian):

sudo apt install git

macOS: Type git in the terminal — macOS will automatically prompt you to install Xcode Command Line Tools.

I get an "execution policy" error when running the install command.

Windows sometimes blocks PowerShell scripts from running. Run this line first to lift the restriction, then re-paste the install command:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
The cx or codex command is not recognized in a new PowerShell window.

The installer adds the configuration to your PowerShell profile, but a new PowerShell window is needed for the change to take effect. If it still does not work, verify that your profile file contains the correct line:

notepad $PROFILE

It should contain a line like . "C:\Users\YourName\codex-auth-switcher\shell\powershell.ps1". If it is missing, add it manually, save the file, and reopen PowerShell.

cx switch shows "cannot find console" or the display is garbled.

cx switch requires an interactive terminal window (Windows Terminal, PowerShell window, etc.). It cannot run inside VS Code's Output panel or a CI environment.

Alternative: use cx use <name> to switch directly without the interactive menu.

Can I have two accounts running Codex at the same time?

Yes. When launched via the codex wrapper, Codex uses the standard ~/.codex directory, so you can open two or three windows under the same active profile and they will share the /resume history. Commands that modify auth.json — such as cx use and cx login — are blocked while Codex is running to prevent mid-session account changes.

Are auth tokens safe? Are they uploaded anywhere?

No. All auth tokens are stored only in the ~/.codex_auth_profiles/ folder on your own machine and are never sent to any server. This tool runs entirely locally.

Do not commit the ~/.codex_auth_profiles/ folder to any Git repository.

What does "hit until ..." in the LIMIT column mean?

The account has reached Codex's usage limit. The displayed time is when the limit resets. After the reset, cx list will clear the flag automatically.

If the limit has already reset but the flag persists, clear it manually: cx ok <name>