Codex Controller (codexctl)
Codex Controller - Full control plane for Codex CLI
Prerequisite: Requires @openai/codex to be installed first.
Version: 0.10.0 | Author: Bhanu Korthiwada
๐ Website: codexctl on GitHub
๐ Documentation: See README for usage
Why Codex Controller?
Codex Controller starts from a practical limitation in Codex CLI today: there is no native first-class multi-profile workflow. This repo starts with a full end-to-end control plane for profile management, usage visibility, switching, and concurrent terminal usage.
Use it when you need to:
-
๐ Multi-account management - Switch between work/personal/dev accounts instantly
-
๐ค Automation - Run Codex in CI/CD with specific credentials
-
๐ Usage monitoring - Track quota across teams
-
๐ณ Concurrent sessions - Use multiple accounts in parallel
-
๐ Profile-based workflows - Environment-specific configurations
-
๐ Securely store multiple Codex CLI profiles with optional encryption
-
โก Switch instantly between accounts without re-authenticating
-
๐ค Auto-switch based on quota availability
-
๐ Monitor usage across all your Codex accounts
-
๐ณ Use concurrently - different accounts in different terminals
Codex vs API (Important)
- ChatGPT/Codex plans and the OpenAI API are separate products with separate billing.
- A ChatGPT plan does not automatically include API usage credits.
- Codex CLI can authenticate with either a ChatGPT account or an API key.
codexctl usagereads ChatGPT/Codex plan claims from local auth tokens.codexctl usage --realtimechecks API billing/quota via OpenAI API endpoints.codexctl status --json,usage --json,verify --json, anddoctor --jsonprovide script-safe structured output.- References:
- Codex CLI auth flow: https://developers.openai.com/codex/cli
- API vs ChatGPT billing separation: https://help.openai.com/en/articles/8156019
Features
Multi-Account Management
- ๐ Secure Profiles - Store multiple Codex credentials with optional encryption
- โก Instant Switching - Switch accounts in < 1 second
- ๐ Quick Toggle - Toggle between current and previous with
codexctl load - - ๐๏ธ Full CRUD - Save, load, list, delete, backup profiles
Automation & Control
- ๐ค Auto-Switcher - Automatically pick best profile based on quota
- ๐ Usage Monitoring - Real-time quota and billing data
- โ Verify - Validate all profiles' authentication status
- ๐ณ Concurrent Sessions - Use multiple accounts in parallel
- ๐ CI/CD Integration - Run with specific credentials in pipelines
Developer Experience
- ๐ฅ๏ธ Cross-Platform - macOS, Linux, Windows (WSL2)
- ๐ง Shell Completions - Bash, Zsh, Fish, PowerShell
- ๐งช Zero Runtime - Single binary, no Node.js required
- ๐ณ Docker - Multi-arch images
- ๐ฆ Import/Export - Transfer profiles between machines
Quick Start
Prerequisites
First, install Codex CLI:
# Install Codex CLI (required)
# Verify installation
Install codexctl
# Via cargo
# Or via npm
# Or download binary from GitHub Releases
# Or via Homebrew (macOS/Linux)
First Steps
# Save your current Codex CLI profile
# Create another profile
# (switch accounts in Codex CLI, then:)
# List all profiles
# Switch to a profile
# Quick-switch to previous profile
Commands
codexctl save <name> Save current Codex auth as a profile
codexctl load <name> Load a saved profile and switch to it
codexctl list List all saved profiles
codexctl delete <name> Delete a saved profile
codexctl status Show current profile status
codexctl usage Show plan claims and API quota context
codexctl verify Verify all profiles' authentication status
codexctl backup Create a backup of current profile
codexctl run --profile <name> -- <cmd>
Run a command with a specific profile
codexctl env <name> Export shell commands for concurrent usage
codexctl diff <name1> <name2> Compare/diff two profiles
codexctl switch Switch to a profile interactively (fzf)
codexctl history View command history
codexctl doctor Run health check on profiles
codexctl completions Generate shell completions
codexctl import <name> <b64> Import a profile from another machine
codexctl export <name> Export a profile for transfer
codexctl setup Interactive setup wizard
Encryption
# Save with encryption
# Or use environment variable
# Load encrypted profile
# Run one command with an encrypted profile, then restore original auth
Usage And Auto-Switching
Inspect usage directly or let the controller pick the best available profile:
# Show current profile usage details
# Emit structured JSON for automation
# Compare usage across all saved profiles
# Switch to the profile with the best remaining quota
Concurrent Usage
Run different Codex identities in separate terminals:
# Print shell exports for a profile
# Bash/Zsh example
# Run one command against a specific profile and restore after
codexctl load and codexctl run only swap the live auth.json. Existing local sessions, history, memories, and state stay untouched. The automatic backup created during load now captures the live auth.json only, matching the actual mutation surface.
Structured Output
For CI, shell pipelines, and editor tooling:
Shell Completions
Docker
# Run with Docker
Configuration
Configuration directory: ~/.config/codexctl/
# ~/.config/codexctl/config.toml
[]
= "codex" # Default CLI to manage
[]
= true
= 80 # Switch when quota below 80%
[]
= false # Always prompt for passphrase
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Security
For responsible disclosure and supported-version policy, see SECURITY.md.
Support
For usage help and reporting guidance, see SUPPORT.md.
Changelog
Release history is tracked in CHANGELOG.md.
License
MIT License - see LICENSE for details.
Built by Bhanu Korthiwada