Skip to main content

Documentation Index

Fetch the complete documentation index at: https://doc.hitopen.com/llms.txt

Use this file to discover all available pages before exploring further.

Codex CLI is OpenAI’s terminal-based interactive coding agent. It runs locally on your computer and supports patch-based file editing, sandboxed command execution, and parallel tool use.

Features

FeatureDescription
Terminal coding assistantInteractive CLI for editing code, generating patches, and running commands
Atomic patch editingUses a dedicated patch format to add, update, or delete files atomically via apply_patch
Sandboxing and approvalConfigurable sandbox policies and approval modes (on-request, on-failure, never)
Plan trackingupdate_plan tracks steps with one in_progress step at all times
Security constraintsSensitive operations require user approval; no arbitrary changes to unrelated files
Parallel executionSupports multi_tool_use.parallel to run multiple tools simultaneously

Setup

Codex CLI on Windows works best through WSL2 (Windows Subsystem for Linux).

1. Install WSL2

Open PowerShell as administrator and run:
wsl --install
Restart your computer after installation.
Use PowerShell instead of CMD. If you encounter permission issues, run as administrator. Some antivirus software may flag WSL — add it to your whitelist if needed.

2. Install Node.js via NVM inside WSL

Inside WSL, install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
Open a new terminal window, then enter WSL and install Node.js 22:
wsl
nvm install 22
Check OpenAI’s Windows requirements for the currently required Node.js version, as it may change.

3. Install Codex CLI

Inside WSL, run:
npm i -g @openai/codex
Verify the installation:
codex --version

4. Configure Newapi

Run the one-click configuration script inside WSL:
iex (irm 'https://raw.githubusercontent.com/QuantumNous/new-api-docs/refs/heads/main/helper/codex-cli-setup.ps1')
The script prompts you for your Newapi base URL and API key and updates the Codex CLI configuration file.

5. Start using Codex CLI

Launch WSL, then start Codex CLI:
wsl
codex
To use Codex CLI in a specific project:
cd mnt/c/path/to/your/project
codex
To change the active model inside Codex CLI:
/model
After updating the API address, all Codex CLI model requests route through your Newapi instance instead of OpenAI’s servers directly.