1.8 KiB
1.8 KiB
Codex Account Switcher - Setup Instructions
Prerequisites
Required Software
- Python 3 — For running the account switcher script
- Codex CLI — OpenAI Codex command-line client must be installed and configured
- The skill manages
~/.codex/auth.jsontokens - Requires
codexbinary in PATH for theaddcommand (usescodex logout && codex login)
- The skill manages
No additional Python packages required. The skill uses only Python standard library modules.
File Permissions
⚠️ Sensitive: This skill reads and writes authentication tokens:
~/.codex/auth.json— Active Codex session~/.codex/accounts/*.json— Saved account tokens
Ensure these files have appropriate permissions:
chmod 600 ~/.codex/auth.json
chmod 700 ~/.codex/accounts
chmod 600 ~/.codex/accounts/*.json
Configuration
Directory Structure
The skill automatically creates:
~/.codex/
├── auth.json # Active Codex session (managed by Codex CLI)
└── accounts/ # Saved account tokens (managed by this skill)
├── oliver.json
├── work.json
└── ...
Installation (Optional)
For easier access, add the script to your PATH:
ln -s ~/Developer/Skills/codex-account-switcher/codex-accounts.py ~/bin/codex-accounts
Then you can run:
codex-accounts list
codex-accounts use work
How It Works
- Account Identification: Decodes the JWT
id_tokento extract the email address - Switching: Overwrites
~/.codex/auth.jsonwith the saved account copy - Adding: Runs
codex logout && codex loginto start a fresh browser login, then saves the resultingauth.json - Auto-Switch: Queries quota for all saved accounts and switches to the one with the most available weekly quota