Skip to content

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.

Install the published package and confirm that ocx is on PATH:

Terminal window
npm install -g @bitkyc08/opencodex
ocx --version

Choose one way to run the proxy:

Terminal window
# Foreground: blocks this terminal until stopped.
ocx start
# Background: installs or updates the service, then starts it.
ocx service

Run ocx init in an interactive terminal. If ocx start is occupying the foreground, use a second terminal:

Terminal window
ocx init

The 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.

Use these read-only checks in scripts and agent runs:

Terminal window
ocx status
ocx doctor
ocx health --json

ocx 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:

Terminal window
ocx provider add anthropic-apikey \
--api-key "$ANTHROPIC_API_KEY" \
--set-default

ocx 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:

Terminal window
ocx combo set main \
--targets anthropic/claude-opus-4-8,openai/gpt-5.6-sol \
--strategy failover

Targets 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.

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:

Terminal window
export OPENCODEX_API_AUTH_TOKEN="your-secret-token"
ocx service install

Clients must then authenticate their management and model requests. Read the remote-access rules in Configuration before exposing opencodex beyond the local machine.