Search docs...

Start typing to search documentation

OpenAICodex CLI

OpenAI Codex CLI Setup Guide

Step-by-step guide to install and configure Codex CLI with UnoRouter on Windows, macOS, and Linux.

What is Codex CLI?

Codex CLI is a coding agent from OpenAI that runs locally on your computer.

Features

Terminal-basedRuns entirely in your terminal, no browser or editor required.
Tool-drivenUses tools to read, write, and execute code in your project.
Atomic PatchApplies changes as atomic patches, making each edit easy to review.
SandboxingRuns commands in a sandboxed environment to protect your system.
Plan TrackingBreaks tasks into steps, tracks progress, and explains what it is doing.
Multimodal InputAccepts text, images, and file references as input context.

Quick Setup with CC Switch

Use CC Switch to configure your provider with one click. It automatically sets the API endpoint and provider name for you.

Sign in to auto-fill your API key

Or use the CC Switch CLI:

bash
cc-switch provider add

Manual Configuration

Permanent Config File (Recommended)

Persists across sessions and terminal restarts.

%APPDATA%\codex\auth.json

json
{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}

Sign in to auto-fill your API key

%APPDATA%\codex\config.toml

toml
model = "gpt-5.1-codex-mini"

[model_providers.custom]
base_url = "https://api.unorouter.ai/v1"
wire_api = "responses"

Sign in to auto-fill your API key

Environment Variables

Add to your shell profile. Resets when the terminal closes unless sourced from a profile file.

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

Sign in to auto-fill your API key

Installation

Step 2: Install WSL

Windows Subsystem for Linux is required. Run this command:

powershell
wsl --install

Step 3: Install Codex CLI

bash
npm i -g @openai/codex

Ready to get started?

Get your API key and start using UnoRouter with Codex CLI.