API Docs
Client Setup

Codex API Setup

From fresh install to UnioAPI via config.toml, over the Responses API.

Codex is OpenAI's terminal coding assistant. It connects to UnioAPI through a custom provider via POST /v1/responses.

Prerequisites

  • A topped-up account and an API key; see Console & top-up.
  • Node.js 18 or newer.

1. Install Codex CLI

Skip to section 2 if it is already installed. Requires Node.js (18 or newer):

npm install -g @openai/codex
codex --version

2. Add the UnioAPI provider

Edit the config file — ~/.codex/config.toml on macOS / Linux, %USERPROFILE%\.codex\config.toml on Windows (create it if missing):

model = "gpt-5.6-sol"
model_provider = "unioapi"

[model_providers.unioapi]
name = "UnioAPI"
base_url = "https://api.unioapi.com/v1"
env_key = "UNIO_API_KEY"
wire_api = "responses"

Three key points:

  • wire_api = "responses": since February 2026 Codex only supports the Responses transport (wire_api = "chat" was removed; older guides are outdated). UnioAPI serves POST /v1/responses natively.
  • Top-level model_provider must match the [model_providers.<id>] id; openai, ollama, and lmstudio are reserved ids.
  • env_key names the environment variable that holds your key; the key never lives in the file.

3. Export the key and launch

macOS / Linux

SHELL_RC="$HOME/.zshrc"; case "$SHELL" in *bash*) SHELL_RC="$HOME/.bashrc";; esac
echo 'export UNIO_API_KEY="your UnioAPI key"' >> "$SHELL_RC"
source "$SHELL_RC"
codex

Windows (PowerShell)

setx UNIO_API_KEY "your UnioAPI key"

Reopen the terminal, then run codex. A normal reply means you are connected. To switch models, change the top-level model to any OpenAI-protocol model from GET /v1/models.

Codex CLI's first session through UnioAPI
public/docs/screenshots/codex-cli-first-run.png · 1600×1000

Ultrafast

For a model with an Ultrafast badge in the UnioAPI model catalog, add ultrafast to its service_tiers in your custom provider's model_catalog_json. Then use /ultrafast or set service_tier = "ultrafast". Codex may not send the tier without the catalog entry. The badge does not guarantee execution at that tier. If Ultrafast is unavailable, UnioAPI tries the same model at Standard before generation; check the request record for the billed tier.

Troubleshooting

SymptomCheck
Provider config error on launchwire_api must be responses; top-level model_provider must match the block id.
401 authentication failedConfirm UNIO_API_KEY is exported and matches env_key. On Windows, reopen the terminal after setx.
400 parameter rejectedCapabilities like background are out of scope — see POST /v1/responses.
404 model not foundTop-level model is not an available model identifier.
400 unsupported_value after enabling FastThe current model does not offer Fast; switch to a model that does or turn Fast off — see Service Tiers.

Next steps