Skip to main content

mcdx — switch between Codex auth profiles

mcdx is a small CLI for switching between saved OpenAI Codex login credentials, so you can use personal and work accounts on the same machine.

It manages only:

~/.codex/auth.json

It does not copy config.toml, sessions, history, SQLite state, plugins, skills, or temporary runtime files. Runtime state and config.toml stay owned by Codex itself.

Requirements

  • Python 3.10+
  • The codex CLI on your PATH (only needed for mcdx add)

Install

# Recommended: pipx (isolated environment, mcdx lands on your PATH)
pipx install mcdx

# Or plain pip
pip install --user mcdx

Published on PyPI.

Install from a clone

git clone https://github.com/zackaryjing/multi-account-codex
mkdir -p ~/.local/bin
ln -sf "$PWD/multi-account-codex/mcdx.py" ~/.local/bin/mcdx
chmod +x multi-account-codex/mcdx.py

Make sure ~/.local/bin is on your PATH.

Usage

mcdx save-current main   # save your current login as a profile
mcdx add alt             # log in with Codex device auth, saved as a profile
mcdx list                # list saved profiles (* marks the active one)
mcdx current             # show the active profile
mcdx switch main         # switch the active Codex auth
mcdx remove old-name     # delete a profile
mcdx rename a b          # rename a profile
mcdx doctor              # check paths and Codex binary

Where things live

Profiles are stored under:

~/.local/share/mcdx/profiles/<name>/

Each profile contains an auth.json copy and metadata.json. Credentials are not encrypted — the profiles directory is created with 0700 permissions.

Environment overrides:

Variable Default Purpose
MCDX_CODEX_HOME ~/.codex Codex home directory
MCDX_DATA_HOME ~/.local/share/mcdx mcdx data directory
MCDX_CODEX_BIN codex Codex binary for add

Behavior

  • mcdx add <name> temporarily moves the active auth aside, runs codex login --device-auth, saves the resulting auth.json, and leaves the new profile active.
  • mcdx switch <name> saves the current auth as _last before switching.
  • Duplicate credentials are detected by account_id and auth.json SHA-256.

Development

python3 tests.py    # run the test suite

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcdx-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcdx-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file mcdx-0.1.1.tar.gz.

File metadata

  • Download URL: mcdx-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.2

File hashes

Hashes for mcdx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 20ffe918dd9680a668586cdb7c2235d73202225ad662bb204b0e0ae979f7306b
MD5 a27d44b9b06de9cf31c633ddd124766b
BLAKE2b-256 d103355cc54ae9415d28c41a9df1b7b97c4550d82fe9f2d4139a9ba8ef198435

See more details on using hashes here.

File details

Details for the file mcdx-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcdx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.2

File hashes

Hashes for mcdx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c32712d024efcf4d9d5d77afad565d5f976fe22e0593f001b16985eef8df54a6
MD5 77ceb6491849f8aefb0d0827b418a832
BLAKE2b-256 8e0757a3cccc26ae2a8f10f2c5cd5fb01d2e8c6c873ae660a856e45169599ae8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page