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 --version2. 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 servesPOST /v1/responsesnatively.- Top-level
model_providermust match the[model_providers.<id>]id;openai,ollama, andlmstudioare reserved ids. env_keynames 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"
codexWindows (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.
public/docs/screenshots/codex-cli-first-run.png · 1600×1000Ultrafast
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
| Symptom | Check |
|---|---|
| Provider config error on launch | wire_api must be responses; top-level model_provider must match the block id. |
| 401 authentication failed | Confirm UNIO_API_KEY is exported and matches env_key. On Windows, reopen the terminal after setx. |
| 400 parameter rejected | Capabilities like background are out of scope — see POST /v1/responses. |
| 404 model not found | Top-level model is not an available model identifier. |
400 unsupported_value after enabling Fast | The current model does not offer Fast; switch to a model that does or turn Fast off — see Service Tiers. |
Next steps
- Codex app setup: the desktop app and IDE extension share the same config
- CC Switch
- Why more new models are Responses-only
Claude App Setup
Connect the Claude desktop app to UnioAPI through Configure Third-Party Inference and call Claude models over the official Anthropic protocol — or switch with CC Switch.
Codex App Setup
Connect the Codex desktop app and IDE extension to UnioAPI — they share config.toml with the Codex CLI, use the Responses API, and read the key from an environment variable.