Skip to content

CLI Reference

The opencodex CLI is ocx. Run ocx help (or --help / -h) for usage.

Interactive setup wizard. Prompts for a provider (preset or custom), API key (literal or ${ENV}), default model, and proxy port; saves ~/.opencodex/config.json; and optionally injects the proxy into $CODEX_HOME/config.toml (default ~/.codex/config.toml).

Start the proxy server (default port 10100). Writes a PID file and refuses to start a second instance. On start it syncs each provider’s models into Codex’s catalog. On shutdown it restores native Codex — unless it was launched as a managed service (OCX_SERVICE=1).

Terminal window
ocx start
ocx start --port 8080

Stop the running proxy (by PID), remove the PID file, and restore native Codex. If a managed background service is installed, ocx stop also stops it first (so it won’t respawn the proxy). The same action is available from the web dashboard’s Stop button (POST /api/stop).

Restore native Codex without stopping the proxy — strips the injected config lines and routed catalog entries so plain codex works natively again. eject is an alias of restore.

Print whether the proxy is running (and its PID) or not.

Fetch the live model list from every configured provider and re-inject the merged catalog into Codex. Run it after adding a provider or to refresh available models.

Run the OAuth login flow for a provider and store the credential in ~/.opencodex/auth.json (auto-refreshed). Supported: xai, anthropic, kimi.

Terminal window
ocx login xai

Remove the stored OAuth credential for a provider.

Open the web dashboard at http://localhost:<port>, auto-starting the proxy if it isn’t running.

Run opencodex as a login-managed background service (macOS launchd, Linux systemd user unit, Windows Task Scheduler) that auto-starts on login and auto-restarts on crash. Service runs set OCX_SERVICE=1 so a restart doesn’t churn the Codex config.

SubcommandAction
installCreate and start the service.
startStart an installed service.
stopStop the service and restore native Codex.
statusReport whether the service is running.
uninstallRemove the service and restore native Codex. (alias: remove)
Terminal window
ocx service install
ocx service status
ocx service uninstall

Replace the codex binary on PATH with a lightweight wrapper script that auto-starts the opencodex proxy whenever codex is launched. The original binary is backed up and restored on uninstall.

If Codex is updated and overwrites the wrapper, the shim auto-repairs on the next install call — the new binary is backed up and a fresh wrapper is written.

SubcommandAction
installInstall the shim (or repair if stale).
uninstallRemove the shim and restore the original Codex binary.
statusReport shim state (installed / stale / missing).
Terminal window
ocx codex-shim install
ocx codex-shim status
ocx codex-shim uninstall

Self-update opencodex to the latest version published on npm, using the package manager it was installed with (bun install -g @bitkyc08/opencodex@latest or npm install -g @bitkyc08/opencodex@latest). It detects a source checkout and tells you to git pull && bun install instead, and is a no-op if you’re already on the newest version. Restart the proxy afterward (ocx stop && ocx start) to run the new build.

Terminal window
ocx update

New versions become available the moment the Release workflow publishes them to npm.

ocx help, ocx --help, ocx -h — print usage and examples.