Search docs...

Start typing to search documentation

Codex
Codex CLI

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.

text
Base URL: https://api.unorouter.com/v1
API Key: YOUR_API_KEY

Sign in to auto-fill your API key

Compatibility

Chat CompletionsResponses APIStreamingTool calling

Step-by-step setup

  1. 1
    Install Codex CLI

    Install the Codex CLI globally with npm.

    bash
    npm install -g @openai/codex

    Sign in to auto-fill your API key

  2. 2
    Configure 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"

    Sign in to auto-fill your API key

  3. 3
    Add 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"
    }

    Sign in to auto-fill your API key

  4. 4
    Start Codex

    Run `codex` in your project directory and start coding.

powershell
$env:OPENAI_BASE_URL="https://api.unorouter.com/v1"
$env:OPENAI_API_KEY="YOUR_API_KEY"

codex

Sign in to auto-fill your API key

Recommended models

Free models that work well here. Paste any model id into the client.

mistral-small-2506llama-3.2-1bgemini-flash-lite-latestallam-2-7bcodestral-2508

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.
Generate API KeyModels