codex-switcher is a small Rust CLI for switching Codex CLI model providers.
It manages provider entries in ~/.codex/config.toml, stores provider API keys locally, and updates ~/.codex/auth.json to activate the selected provider.
Repository: https://github.com/pynickle/codex-switcher
- Add a provider interactively
- Switch the active provider interactively or by ID
- List configured providers and show the current one
- Optionally update a named profile when switching providers
- Sync existing
.codex/agents/*.tomlmodel_providervalues when switching providers
Install from crates.io:
cargo install codex-switcherInstall from source:
cargo install --path .This builds the cxs binary.
- Rust 2024 edition toolchain
- Windows environment with
USERPROFILEset - Access to the local Codex config directory under
~/.codex
cxs add
cxs list
cxs use
cxs use --provider my-provider
cxs use --provider my-provider --profile default
cxs use --provider my-provider --no-agent-providersadd: interactively add a provider and save its API keyuse: switch the active provider, sync agent provider settings by default, and write the selected key toauth.jsonlist: print configured providers and mark the current one
~/.codex/config.toml: provider definitions and active provider~/.codex/cxs-provider-keys.json: local provider key store~/.codex/auth.json: active Codex auth state
You can override these paths with:
cxs --config <path> --keys <path> --auth <path> <command>- Provider entries are stored under
model_providers. - Switching a provider updates
model_provider, and can also update a profile-specific provider value. - Switching a provider also updates existing
model_providerkeys in.codex/agents/*.toml; pass--no-agent-providersto skip this. - The key store is a plain JSON map keyed by provider id.
cargo test
cargo run -- --helpcodex-switcher is licensed under AGPL-3.0-or-later. See LICENSE.