https://github.com/denysdovhan/codex-account
A simple utility to switch Codex accounts
https://github.com/denysdovhan/codex-account
agentic-coding ai-agents codex codex-app codex-cli openai
Last synced: about 1 month ago
JSON representation
A simple utility to switch Codex accounts
- Host: GitHub
- URL: https://github.com/denysdovhan/codex-account
- Owner: denysdovhan
- License: mit
- Created: 2026-03-17T15:53:47.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-03-24T13:38:05.000Z (about 2 months ago)
- Last Synced: 2026-04-04T10:55:39.668Z (about 1 month ago)
- Topics: agentic-coding, ai-agents, codex, codex-app, codex-cli, openai
- Language: Shell
- Homepage:
- Size: 283 KB
- Stars: 19
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://stand-with-ukraine.pp.ua/)
# codex-account
[![GitHub Actions][gh-actions-image]][gh-actions-url]
[![GitHub Sponsors][gh-sponsors-image]][gh-sponsors-url]
[![Buy Me A Coffee][buymeacoffee-image]][buymeacoffee-url]
[![X.com][x-image]][x-url]
> [!NOTE]
> A small CLI for switching Codex auth accounts by swapping `~/.codex/auth.json`.
Codex currently does not provide a UI for switching between saved profiles. If you use separate work and personal accounts, moving between them usually means re-authenticating or manually replacing `auth.json`.
This utility keeps named snapshots of authenticated accounts so you can move between them without logging in again each time.
## Installation
```sh
# Clone the repository into Codex's config area
git clone https://github.com/denysdovhan/codex-account ~/.codex/.codex-account
# Expose the script as a runnable command from your local bin directory
ln -sfn ~/.codex/.codex-account/codex-account.sh ~/.local/bin/codex-account
```
> [!IMPORTANT]
> Make sure `~/.local/bin` is on your `PATH`.
> Otherwise, the `codex-account` command will not be available after creating the
> symlink.
## Quick Start
```sh
# Log into one Codex account first, then save it
codex-account save personal
# Logout and login into another Codex account, then save that one too
codex-account save work
# See saved accounts and the current match
codex-account list
# Switch back to a saved account
codex-account switch personal
# Show the active account
codex-account current
```
## Commands
### `codex-account help`
Show the built-in help text.
### `codex-account list`
List saved accounts. `*` marks the account whose saved snapshot matches the live
`auth.json`. `~` marks the recorded current account when the live auth differs
from every saved snapshot.
### `codex-account current`
Print the active account name when it can be matched. If the live auth does not
match a saved snapshot, it reports the recorded account when available.
### `codex-account save `
Save the current `~/.codex/auth.json` as `.auth.json` and mark that
account as current.
### `codex-account switch `
Back up the current auth as `-backup.auth.json` when the current auth
can be associated with a saved account, then restore the requested saved
account into `~/.codex/auth.json`.
> [!IMPORTANT]
> Restart Codex after switching if it is already running.
### `codex-account `
Shorthand for `codex-account switch `.
## Notes
- This tool only swaps `auth.json`. It does not change the rest of `~/.codex`.
- Saved accounts live in `~/.codex/.codex-account/accounts`.
- Named backups are stored alongside saved accounts as `*-backup.auth.json`.
- To add a new account, log into it with Codex first, then run
`codex-account save `.
- Restart Codex after switching if it is already running.
## Contributing
Install the local Git hooks after cloning:
```sh
# Install the Git hooks managed by pre-commit
pre-commit install
```
## License
MIT © [Denys Dovhan](https://denysdovhan.com)
[buymeacoffee-image]: https://img.shields.io/badge/support-buymeacoffee-222222.svg?style=flat-square
[buymeacoffee-url]: https://patreon.com/denysdovhan
[gh-actions-image]: https://img.shields.io/github/actions/workflow/status/denysdovhan/codex-account/ci.yml?style=flat-square&branch=main
[gh-actions-url]: https://github.com/denysdovhan/codex-account/actions/workflows/ci.yml
[gh-sponsors-image]: https://img.shields.io/github/sponsors/denysdovhan?style=flat-square
[gh-sponsors-url]: https://github.com/sponsors/denysdovhan
[x-image]: https://img.shields.io/badge/follow-%40denysdovhan-000000.svg?style=flat-square
[x-url]: https://x.com/denysdovhan