Codex account switching and local proxy syncing for OpenClaw and Lobster workflows.
This project is an enhanced fork of mileson/CJFCodexSwitcher.
Enhancements in this fork focus on OpenClaw and Lobster operations:
- switch
~/.codex/auth.json - sync
~/.cli-proxy-apito the same account - restart local
cliproxyapiautomatically - trigger proxy OAuth login when the target account has no local proxy credential yet
LobsterCodexSwitcher is a CLI/TUI tool for people who use multiple Codex accounts and need to:
- inspect live 5-hour and weekly quota windows
- switch accounts quickly from a ranked list
- keep the local CLI proxy aligned with the selected Codex account
- automate account selection through stable non-interactive CLI commands
- Direct startup into the live account list
- Active account shown at the top and separated from the rest
- Live refresh of quota windows and reset times
- Automatic snapshot save for the current account when needed
- Add a new account directly from the quota view via the official
codex loginflow - Agent-friendly CLI:
--list,--json,--best,--switch,--save-current - Automatic local proxy auth sync after
--switch - Automatic local
cliproxyapirestart after proxy auth sync - Automatic proxy OAuth login prompt and execution when proxy credentials are missing
| Layer | Technology |
|---|---|
| Runtime | Python 3 |
| Network | Python stdlib urllib |
| Packaging | pyproject.toml + setuptools |
| UI | Terminal TUI |
git clone https://github.com/sunflower225/LobsterCodexSwitcher.git
cd LobsterCodexSwitcher
python3 install.py
source ~/.zshrc # or ~/.bashrc
codex-switcherRequirements:
- Python 3.8+
- A working
codexCLI on your machine - A working local
cliproxyapiif you want proxy sync
The tool opens directly into the live account view.
Key fields:
邮箱: account emailSPACE: primary workspace / organization label for the accountPLAN: plan type such asTEAM5小时: 5-hour remaining amount and next reset time每周: weekly remaining amount and next reset time[当前]: the active account, shown first
Bottom actions:
Enter: refresh current pagea: start the officialcodex loginflow, then auto-save the authenticated account and keep it active#: switch to the selected account0: exit the tool
codex-switcher --list
codex-switcher --list --json
codex-switcher --best
codex-switcher --best --json
codex-switcher --switch 2
codex-switcher --switch user@example.com
codex-switcher --switch best
codex-switcher --switch best --json
codex-switcher --save-current
codex-switcher --refreshAfter codex-switcher --switch ..., the tool now also handles local proxy state:
- Finds matching auth files under
~/.cli-proxy-api - Enables the newest matching auth file for the selected email
- Disables other active auth files
- Restarts
com.user.cliproxyapi - If no proxy auth exists for that email, runs proxy OAuth login and retries sync
Example:
codex-switcher --switch flow14662@gmail.com --jsonThe JSON output includes a proxy block showing:
- whether proxy sync succeeded
- which auth file was enabled
- whether a proxy login attempt was triggered
- whether the local proxy restart succeeded
If your OpenClaw gateway uses a local CLIProxyAPI, this is the practical flow:
codex-switcher --switch flow14662@gmail.com --jsonWhat happens:
~/.codex/auth.jsonswitches to the selected Codex account~/.cli-proxy-apiis reconciled to the same emailcom.user.cliproxyapiis restarted- OpenClaw can immediately keep using the matching proxy account
This removes the old manual sequence of:
- switching the Codex account
- checking which proxy auth file is active
- disabling stale proxy auth files
- restarting
cliproxyapi
LobsterCodexSwitcher/
├── codex_switcher.py
├── codex-switcher.py
├── install.py
├── pyproject.toml
├── README.md
├── README_CN.md
├── tests/
└── docs/
See SECURITY.md.
See CONTRIBUTING.md.
MIT
