Skip to content

pynickle/codex-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codex-switcher

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

What it does

  • 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

Installation

Install from crates.io:

cargo install codex-switcher

Install from source:

cargo install --path .

This builds the cxs binary.

Requirements

  • Rust 2024 edition toolchain
  • Windows environment with USERPROFILE set
  • Access to the local Codex config directory under ~/.codex

Usage

cxs add
cxs list
cxs use
cxs use --provider my-provider
cxs use --provider my-provider --profile default

Commands

  • add: interactively add a provider and save its API key
  • use: switch the active provider and write the selected key to auth.json
  • list: print configured providers and mark the current one

Paths Used

  • ~/.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>

Notes

  • Provider entries are stored under model_providers.
  • Switching a provider updates model_provider, and can also update a profile-specific provider value.
  • The key store is a plain JSON map keyed by provider id.

Development

cargo test
cargo run -- --help

License

codex-switcher is licensed under AGPL-3.0-or-later. See LICENSE.

About

⚡cxs — Quickly switch Codex CLI providers from your terminal.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages