╔════════════════════════════════════════════════════════════════╗
║ CPS - Codex Profile Switcher ║
╚════════════════════════════════════════════════════════════════╝
Version: 1.0.5
CPS is a tiny terminal tool for using official Codex auth login with gateway forwarding.
The core flow is: log in with Codex/ChatGPT auth, then route model requests through a stable gateway provider.
It keeps official auth and gateway routing separate:
Auth login -> auth.json / ChatGPT login
Gateway route -> config.toml / provider / model / base_url
Then it applies the pair without manually editing ~/.codex.
$ cps
Auth login + Gateway route -> ~/.codex
Use CPS when you want to:
- switch between personal and work Codex accounts;
- keep multiple API keys or OpenAI-compatible routes;
- use one ChatGPT login state with a different gateway route;
- avoid manually copying
auth.jsonandconfig.tomlin~/.codex; - keep project-specific Codex configs separated.
This is the fastest way if you only want to use CPS:
python3 -m pip install "git+https://github.com/ZijiYu/CPS.git"After installation, check that the command is available:
cps --helpIf your terminal says cps: command not found, your Python script directory is probably not in PATH. You can still run CPS with:
python3 -m codex_profile_switcher.cli --helpUse this method if you want to read the code, edit it, or run the latest local version.
Clone with Git:
git clone https://github.com/ZijiYu/CPS.git
cd CPS
python3 -m pip install -e .Or download it from the GitHub page:
Code -> Download ZIP -> unzip it -> open the extracted folder in Terminal
Then install from the extracted folder:
cd CPS
python3 -m pip install -e .The project exposes these commands after installation:
cps
codex-profiles
cps is the recommended command.
If you use pipx:
pipx install "git+https://github.com/ZijiYu/CPS.git"Open the TUI:
cpsMain flow:
1. Choose one Auth login
2. Choose one Gateway route
3. Press Enter to review the draft pair, then confirm to apply
4. Press R to Restart Codex
Create profiles from the TUI:
O Menu -> New Auth Login
O Menu -> New Gateway Route
cps init auth personal
cps init route work
cps mix personal work
cps doctor
cps restartCustom API route:
cps route custom \
--base-url https://your-endpoint.example.com/v1 \
--model gpt-5.5 \
--api-key sk-...Restore official route:
cps route official --model gpt-5.5~/.codex active Codex config
~/.codex-profiles saved CPS profiles
~/.codex-profiles/.cps.lock serializes CPS writes
~/.codex-profiles/<profile>/profile.json non-secret profile metadata
~/.codex-profiles/deleted reversible deletes
~/.codex-profiles/backups switch-time backups
cps doctordoctor checks for common switch-time problems: missing Codex CLI, reserved
provider overrides such as [model_providers.OpenAI], stale last-mix pointers,
missing auth files, and custom routes that may need a Codex restart before the
model picker refreshes.
Try:
python3 -m codex_profile_switcher.cli --helpIf that works, the package is installed but your Python scripts directory is not in PATH.
Make sure you are inside the repository root. You should see pyproject.toml in the current folder:
lsExpected files include:
pyproject.toml
README.md
src/
GitHub ZIP downloads may extract to a folder such as:
CPS-main
Use the actual extracted folder name:
cd CPS-main
python3 -m pip install -e .python3 -m pip uninstall codex-profile-switcherCPS stores saved profiles under ~/.codex-profiles. Uninstalling the Python package does not automatically delete your saved profiles.
