The codex provider dispatches tasks to OpenAI Codex using the @openai/codex-sdk TypeScript library. Internally the SDK drives codex app-server over stdio JSON-RPC. The Bridge handles per-agent CODEX_HOME isolation so each agent keeps its own configuration.
Provider name: codex
Codex supports two authentication modes:
Option A — API key
CODEX_API_KEY=sk-...Option B — interactive login
codex auth loginThis stores credentials in ~/.codex/. No env var needed — the SDK picks it up automatically.
The CLI must be installed with its optional native dependencies (binaries needed by the SDK).
Linux / macOS
npm install -g @openai/codex
# verify
codex --version
which codex # note the path — you'll need it for CODEX_BIN_PATHWindows (PowerShell)
npm install -g @openai/codex
codex --version
where.exe codex # note the pathIf the Bridge logs
Unable to locate Codex CLI binaries, it means the binary is not in PATH or was installed without optional dependencies. UseCODEX_BIN_PATHto set the absolute path explicitly (see below).
| Variable | Required | Default | Description |
|---|---|---|---|
CODEX_API_KEY |
if no CLI login | — | OpenAI API key |
CODEX_BIN_PATH |
no | (auto-detect from PATH) | Absolute path to the codex binary, e.g. /usr/local/bin/codex or /usr/bin/codex |
CODEX_DEFAULT_MODEL |
no | (SDK default) | Model override, e.g. gpt-5.4-nano or codex-mini-latest |
CODEX_TIMEOUT_MINUTES |
no | 10 |
Hard timeout per task |
AGENTS_FOLDER |
no | ~ |
Root directory where agent workspace folders are created |
Linux / macOS
PAIRING_TOKEN=your_pairing_token \
PROVIDERS=codex \
CODEX_API_KEY=sk-... \
CODEX_BIN_PATH=/usr/local/bin/codex \
CODEX_DEFAULT_MODEL=gpt-5.4-nano \
./ctrlnode-bridge-linux-x64Linux / macOS — binary in non-standard path
PAIRING_TOKEN=your_pairing_token \
PROVIDERS=codex \
CODEX_API_KEY=sk-... \
CODEX_BIN_PATH=/usr/bin/codex \
CODEX_DEFAULT_MODEL=gpt-5.4-nano \
./ctrlnode-bridge-linux-x64Windows (PowerShell)
$env:PAIRING_TOKEN = "your_pairing_token"
$env:PROVIDERS = "codex"
$env:CODEX_API_KEY = "sk-..."
$env:CODEX_BIN_PATH = "C:\Users\you\AppData\Roaming\npm\codex.cmd"
$env:CODEX_DEFAULT_MODEL = "gpt-5.4-nano"
.\ctrlnode-bridge.exe.env file
PAIRING_TOKEN=your_pairing_token
PROVIDERS=codex
CODEX_API_KEY=sk-...
CODEX_BIN_PATH=/usr/local/bin/codex
CODEX_DEFAULT_MODEL=gpt-5.4-nano
AGENTS_FOLDER=/home/ubuntuThe Bridge provisions a dedicated CODEX_HOME directory for each agent under AGENTS_FOLDER. This ensures each agent's Codex configuration, history, and credentials are kept separate, preventing cross-agent contamination in multi-agent setups.
- When a task is dispatched to a Codex agent, the Bridge resolves the agent-specific
CODEX_HOMEand starts the SDK session. - The task prompt and agent instructions are forwarded to the Codex model.
- Output events are streamed back to CTRL NODE in real time.
- On completion the Bridge writes an output markdown file and reports
completed,blocked, orfailedstatus.
PROVIDERS=codex,gemini
CODEX_API_KEY=sk-...
CODEX_BIN_PATH=/usr/local/bin/codex
GEMINI_API_KEY=AIza...