Agent Quickstart
This page is for an AI agent or a scripting user working from a terminal. It focuses on commands, exit status, and the boundary between automation and actions that require the user’s consent. For a human-led walkthrough, use the Quickstart. The dashboard remains available for interactive configuration; see Web Dashboard.
Set up opencodex
Section titled “Set up opencodex”Install the published package and confirm that ocx is on PATH:
npm install -g @bitkyc08/opencodexocx --versionChoose one way to run the proxy:
# Foreground: blocks this terminal until stopped.ocx start
# Background: installs or updates the service, then starts it.ocx serviceRun ocx init in an interactive terminal. If ocx start is occupying the foreground, use a
second terminal:
ocx initThe wizard writes $OPENCODEX_HOME/config.json (normally
~/.opencodex/config.json). It can also inject the proxy address into Codex’s config.toml and
install the optional Codex autostart shim. ocx init never starts the proxy. For a fully
non-interactive setup, configure providers with ocx provider add as shown below instead of driving
the wizard.
Check a headless installation
Section titled “Check a headless installation”Use these read-only checks in scripts and agent runs:
ocx statusocx doctorocx health --jsonocx status reports the proxy and service state. ocx doctor diagnoses local environment,
network, Codex runtime, and account-health problems. ocx health exits 0 when the proxy is
healthy and 1 otherwise; --json returns structured output.
Commands backed by the management API, such as ocx combo set, contact the live proxy. If no live
proxy can be found or the API is unreachable, the CLI treats that as a 503 failure and exits
nonzero. Start the foreground proxy or background service before retrying. See the
CLI reference and Management API for the complete
command and endpoint surfaces.
Add providers and combos without the dashboard
Section titled “Add providers and combos without the dashboard”Registry providers can be added by name. For example, this adds the Anthropic API-key preset and makes it the default provider:
ocx provider add anthropic-apikey \ --api-key "$ANTHROPIC_API_KEY" \ --set-defaultocx provider add writes local configuration. Add --sync if a live proxy is already running and
you want to sync models to Codex immediately; otherwise run ocx sync later. Custom providers that
are not in the registry require both --adapter and --base-url.
Once all target providers are configured and the proxy is running, create a failover combo:
ocx combo set main \ --targets anthropic/claude-opus-4-8,openai/gpt-5.6-sol \ --strategy failoverTargets use provider/model syntax and are comma-separated. The resulting virtual model is
combo/main. See Combos for strategies, weights, sticky routing, and failure
behavior.
Remote and LAN binds
Section titled “Remote and LAN binds”The default loopback bind does not require an API token. A non-loopback bind, such as 0.0.0.0,
requires OPENCODEX_API_AUTH_TOKEN; the proxy refuses to start without it. Set the variable before
ocx start, or before ocx service install so the service receives it:
export OPENCODEX_API_AUTH_TOKEN="your-secret-token"ocx service installClients must then authenticate their management and model requests. Read the remote-access rules in Configuration before exposing opencodex beyond the local machine.

