OpenAI Codex CLI Setup Guide
Step-by-step guide to install and configure Codex CLI with UnoRouter on Windows, macOS, and Linux.
Overview
Codex CLI is OpenAI's terminal-based coding agent that reads, writes, and runs code in your project through sandboxed, reviewable patches. Point its custom provider at UnoRouter's base URL and you can drive it with any model from the catalog, not just OpenAI's.
Quick Config
Drop these values into the client. Your key auto-fills when you are signed in.
Base URL: https://api.unorouter.com/v1
API Key: YOUR_API_KEYCompatibility
Step-by-step setup
- 1Install Codex CLI
Install the Codex CLI globally with npm.
bashnpm install -g @openai/codex - 2Configure the model provider
Edit `~/.codex/config.toml` to point Codex at UnoRouter. Set your model id and add a custom provider with UnoRouter's base URL using the responses wire API.
toml# ~/.codex/config.toml model = "YOUR_MODEL_ID" [model_providers.custom] base_url = "https://api.unorouter.com/v1" wire_api = "responses" - 3Add your API key
Write your UnoRouter API key into `~/.codex/auth.json` so Codex authenticates every request.
json// ~/.codex/auth.json { "OPENAI_API_KEY": "YOUR_API_KEY" } - 4Start Codex
Run `codex` in your project directory and start coding.
bashcodex
$env:OPENAI_BASE_URL="https://api.unorouter.com/v1"
$env:OPENAI_API_KEY="YOUR_API_KEY"
codexRecommended models
Free models that work well here. Paste any model id into the client.
Gotchas
- If Codex reports an unsupported endpoint, confirm `wire_api` is set to `responses` and the base URL ends in `/v1`.
- A 401 means the key in `~/.codex/auth.json` is missing or stale. Paste a fresh key from your UnoRouter dashboard and rerun.