Skip to content

jojo23333/Codex-Account-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Codex Account Manager

Manage multiple Codex CLI accounts with ease.

codex-accounts swaps ~/.codex/auth.json and the account-specific parts of ~/.codex/config.toml. Local project trust settings under [projects."<path>"] stay on your machine.

codex-accounts-demo.mp4

Install

Interactive install:

curl -fsSL https://jojoml.github.io/tools/codex-accounts.sh | bash

The installer will:

  • download the latest codex-accounts
  • install it to ~/.local/bin/codex-accounts
  • create ~/.local/bin if needed
  • make it executable
  • ask whether to add ~/.local/bin to bash or zsh

Non-interactive install:

curl -fsSL https://jojoml.github.io/tools/codex-accounts.sh | bash -s -- --shell zsh
curl -fsSL https://jojoml.github.io/tools/codex-accounts.sh | bash -s -- --shell bash

Quick Start

# Save the account you are currently using
codex login
codex-accounts save personal

# If this account needs a custom provider/model, set ~/.codex/config.toml first
# then save it so those settings travel with the account

# Add another account
codex-accounts add work
codex login
codex-accounts save work

# Switch any time
codex-accounts switch personal
codex-accounts switch work

# See usage for all saved accounts
codex-accounts usage

Why Use It

  • keep your local Codex history and state
  • switch accounts by name instead of logging in from scratch each time
  • see per-account Codex usage snapshots in one place

Commands

codex-accounts list
codex-accounts current
codex-accounts save <name>
codex-accounts add <name>
codex-accounts switch <name>
codex-accounts usage

Important: File-Based Auth

This tool manages ~/.codex/auth.json and account-scoped config snapshots.

If Codex is using the OS keychain/keyring, there may be no auth.json file to switch. In that case, set Codex to file-based credentials:

# ~/.codex/config.toml
cli_auth_credentials_store = "file"

Then run:

codex login

What It Changes

When you switch accounts, it updates:

  • ~/.codex/auth.json
  • ~/.codex/config.toml except local [projects."<path>"] sections
  • ~/.codex-switch/state

Everything else under ~/.codex stays where it is, including:

  • history.jsonl
  • sessions/
  • log/
  • memories/

Requirements

  • macOS or Linux
  • Codex CLI installed
  • jq for codex-accounts usage

If you do not have Codex CLI yet:

brew install codex

Notes

  • saved accounts are stored as plain auth.json copies under ~/codex-data
  • saved config snapshots are stored under ~/codex-data/<name>.config.toml
  • [projects."<path>"] trust settings stay local and are merged back in on switch
  • protect ~/codex-data like any other credential store
  • if a saved account shows an expired token in usage, log into that account again and run codex-accounts save <name>

About

Codex Account Manager is a lightweight multi-account switcher for Codex CLI that preserves your local `~/.codex` history and state.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages