| name | codex-auth-account-manager |
| description | CLI tool to switch and manage multiple Codex accounts seamlessly |
| triggers | ["how do I switch between Codex accounts","manage multiple Codex logins","codex-auth account switching","list my Codex accounts and usage","import Codex auth tokens","switch active Codex account","export Codex account credentials","remove old Codex accounts"] |
Codex Auth Account Manager
Skill by ara.so — Codex Skills collection.
codex-auth is a command-line tool for switching between multiple Codex accounts. It works with Codex CLI, VS Code extension, and Codex App. This skill covers installation, account management, import/export workflows, and API vs local-only modes.
What It Does
- Account switching: Seamlessly switch between multiple Codex accounts stored locally
- Usage tracking: View token usage and limits for each account (API-backed or local-only)
- Import/Export: Batch import auth files or export for backup
- Multi-client support: Works with Codex CLI, VS Code extension, and Codex App
Important: After switching accounts with Codex CLI or Codex App, you must restart the client for changes to take effect. For seamless switching without restarts, use the forked codext CLI.
Installation
Install globally via npm:
npm install -g @loongphy/codex-auth
Or run without installing:
npx @loongphy/codex-auth list
Supported platforms: Linux (x64, arm64), macOS (x64, arm64), Windows (x64, arm64).
Uninstall
npm uninstall -g @loongphy/codex-auth
Account Management Commands
List Accounts
View all stored accounts with usage information:
codex-auth list
codex-auth list --live
codex-auth list --active
codex-auth list --skip-api
Usage Data Modes:
- Default (API): Makes HTTPS requests to OpenAI endpoints using access tokens for accurate usage/limit data
- Local-only (
--skip-api): Reads ~/.codex/sessions/**/rollout-*.jsonl files; may show stale data (hours old) due to rate_limits: null in recent Codex builds
Add Accounts
Login and add a new account:
codex-auth login
codex-auth login --device-auth
This runs codex login internally, then stores the account in codex-auth's registry.
Switch Accounts
Interactive account picker:
codex-auth switch
codex-auth switch --live
codex-auth switch --skip-api
Direct selection by row number or query:
codex-auth switch 02
codex-auth switch work
codex-auth switch personal@example.com
Remove Accounts
Interactive removal:
codex-auth remove
codex-auth remove --skip-api
Direct removal by query:
codex-auth remove work personal@example.com 03
codex-auth remove --all
Import and Export
Import Accounts
Import a single auth file:
codex-auth import /path/to/auth.json
codex-auth import /path/to/auth.json --alias work-account
Batch import from a folder:
codex-auth import /path/to/auth-folder
Import CLIProxyAPI token JSON:
codex-auth import --cpa
codex-auth import --cpa /path/to/token.json
Rebuild registry from existing auth files:
codex-auth import --purge
codex-auth import --purge /custom/auth/dir
Export Accounts
Export all managed auth files:
codex-auth export
codex-auth export /backup/codex-auth
codex-auth export --cpa
codex-auth export --cpa /backup/tokens
Maintenance
Clean Stale Files
Remove managed backup and stale account files:
codex-auth clean
This deletes:
- Managed backup files created during account switches
- Stale account auth files no longer in the registry
Configuration
Live TUI Refresh Interval
Configure auto-refresh interval for --live mode:
codex-auth config live --interval 10
codex-auth config live --interval 30
Common Workflows
Daily Account Switching
codex-auth list
codex-auth switch work
codex-auth switch personal
Batch Account Setup
codex-auth import ~/codex-backups/auth-files
codex-auth list
codex-auth switch 01
Usage Monitoring
codex-auth list --active
codex-auth list --live
codex-auth list --skip-api
Cleanup and Backup
codex-auth export ~/codex-backup-$(date +%Y%m%d)
codex-auth remove old-work abandoned-test
codex-auth clean
Troubleshooting
Usage Limits Not Refreshing
Symptom: Usage data appears hours out of date.
Cause: When using --skip-api, local rollout-*.jsonl files may contain rate_limits: null (Codex issue #14880).
Solution: Use API-backed refresh (default):
codex-auth list
codex exec "say hello"
Account Switch Not Taking Effect
Symptom: After switching accounts, Codex still uses old account.
Solution: Restart Codex CLI or Codex App after switching. Or use codext for seamless switching:
npm install -g @loongphy/codext
codext
Import Fails
Symptom: codex-auth import doesn't find auth files.
Solution: Ensure you're importing valid auth.json files from ~/.codex/ or exported backups:
cat /path/to/auth.json | jq .
codex-auth import /absolute/path/to/auth.json
API Calls vs Privacy
Concern: Don't want to send tokens to OpenAI endpoints.
Solution: Use --skip-api for all commands:
codex-auth list --skip-api
codex-auth switch --skip-api
codex-auth remove --skip-api
Note: Team names won't refresh and usage data may be stale, but no API calls are made.
Security Notes
- API Mode: Sends access tokens to
chatgpt.com/backend-api/wham/usage and chatgpt.com/backend-api/accounts/check/v4-2023-04-27. May violate OpenAI ToS.
- Local Mode: Reads local files only, safer but less accurate.
- Auth Storage: All auth files stored in
~/.codex-auth/ (platform-specific). Keep this directory secure.
Platform-Specific Paths
Auth files are stored in:
- Linux/macOS:
~/.codex-auth/
- Windows:
%USERPROFILE%\.codex-auth\
Original Codex auth:
- All platforms:
~/.codex/auth.json
Session rollout files:
- All platforms:
~/.codex/sessions/**/rollout-*.jsonl