codex-auth-manager (cam)
A deadly simple Codex auth manager.
📥 Installation
Using binstall
cargo binstall codex-auth-manager
Downloading from Releases
Navigate to the Releases page and download respective binary for your platform. Make sure to give it execute permissions.
Compiling from Source
cargo install codex-auth-manager --features=cli
📖 Usage
cam manages named Codex auth identities. Each identity is stored under $CODEX_HOME/codex-auth-manager/, and CAM switches which identity Codex sees at $CODEX_HOME/auth.json.
cam/cam status— show the current auth statecam list— list saved identitiescam capture <identity> [--force]— save the current native Codex auth file as an identity and make it activecam use <identity> [--force]— make an existing identity activecam detach [--force]— stop using the active CAM-managed identity
Shell Completion
Completions are generated by cam and include saved identity names for commands like cam use. For Bash:
mkdir -p ~/.local/share/bash-completion/completions
echo 'source <(COMPLETE=bash cam)' > ~/.local/share/bash-completion/completions/cam
Other shells supported by clap_complete can generate their setup script with COMPLETE=<shell> cam.
💡 Examples
Say that you've logged into Codex with your personal account. Now you've got a new work account, and you want to switch between them without logging in and out every time. With cam, you can capture your auth states as identities, which can be switched back to at any time.
# Capture the current auth state as "personal" identity
cam capture personal
Now auth.json is moved to $CODEX_HOME/codex-auth-manager/personal.json, and a symlink is created at $CODEX_HOME/auth.json pointing to it. Then you detach the current identity (which basically removes the symlink) and log in to Codex with your work account:
# Detach the current identity
cam detach
# Log in to Codex with your work account as usual (e.g. via `codex login`)
You can capture the auth state again as "work" identity:
# Capture the current auth state as "work" identity
cam capture work
Now you have two identities saved. You can switch between them with cam use:
# Switch to "personal" identity
cam use personal
# Switch back to "work" identity
cam use work
To list all saved identities:
$ cam list
personal
* work
🎉 Credits
TODO