A small Bash dispatcher that launches Codex with a model selected through orms (OpenRouter) or oms (Ollama Cloud). API keys are read from 1Password and are never written to disk.
Find a file
2026-07-12 10:50:12 +08:00
.gitignore Add initial cxsw dispatcher and docs 2026-07-12 10:40:43 +08:00
AGENTS.md Add initial cxsw dispatcher and docs 2026-07-12 10:40:43 +08:00
cxsw.sh Add initial cxsw dispatcher and docs 2026-07-12 10:40:43 +08:00
LICENSE Add initial cxsw dispatcher and docs 2026-07-12 10:40:43 +08:00
README.md Add links to selector binaries in README 2026-07-12 10:50:12 +08:00

Codex Switch

A small Bash dispatcher that launches Codex CLI with a model selected through orms (OpenRouter) or oms (Ollama Cloud). API keys are read from 1Password and are never written to disk. Provider configuration is passed to Codex for that invocation only, leaving ~/.codex/config.toml unchanged.

Requirements

  • Bash 4+
  • codex, op, and timeout on $PATH
  • orms and/or oms on $PATH
  • An authenticated 1Password CLI session
  • ~/.local/bin on $PATH

The script reads each provider token from the following 1Password references:

op://CLI-Tools/OpenRouter - Codex/credential
op://CLI-Tools/Ollama Cloud - Codex/credential

Install

With curl

Download the latest version from the repository and install it as cxsw:

mkdir -p "$HOME/.local/bin" && curl --fail --silent --show-error --location "https://code.paulg.it/paulgit/codex-code-switch/raw/branch/main/cxsw.sh" --output "$HOME/.local/bin/cxsw" && chmod 755 "$HOME/.local/bin/cxsw"

From a clone

From the cloned repository, install the local copy:

mkdir -p "$HOME/.local/bin" && install -m 755 cxsw.sh "$HOME/.local/bin/cxsw"

Usage

cxsw orms  # OpenRouter, using the model selected by orms
cxsw oms   # Ollama Cloud, using the model selected by oms

Arguments after the provider are passed through to Codex, for example:

cxsw orms --no-alt-screen
cxsw oms resume

Use /status inside Codex to confirm the active provider and model.

License

This project is released under the WTFPL, version 2.