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
| Feature | Description |
|---|
| Terminal coding assistant | Interactive CLI for editing code, generating patches, and running commands |
| Atomic patch editing | Uses a dedicated patch format to add, update, or delete files atomically via apply_patch |
| Sandboxing and approval | Configurable sandbox policies and approval modes (on-request, on-failure, never) |
| Plan tracking | update_plan tracks steps with one in_progress step at all times |
| Security constraints | Sensitive operations require user approval; no arbitrary changes to unrelated files |
| Parallel execution | Supports 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: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:3. Install Codex CLI
Inside WSL, run:Verify the installation: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:To use Codex CLI in a specific project:cd mnt/c/path/to/your/project
codex
To change the active model inside Codex CLI:After updating the API address, all Codex CLI model requests route through your Newapi instance instead of OpenAI’s servers directly.
1. Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Official website: https://brew.sh2. Install Node.js
brew update
brew install node
Verify the installation:node --version
npm --version
If you encounter permission issues, you may need to use sudo. It is recommended to use Terminal or iTerm2.
3. Install Codex CLI
npm install -g @openai/codex
If you encounter permission issues:sudo npm install -g @openai/codex
Verify the installation:Run the one-click configuration script:curl -fsSL https://raw.githubusercontent.com/QuantumNous/new-api-docs/refs/heads/main/helper/codex-cli-setup.sh | bash
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 Codex CLI:To use Codex CLI in a specific project:cd /path/to/your/project
codex
After updating the API address, all Codex CLI model requests route through your Newapi instance instead of OpenAI’s servers directly.
macOS troubleshooting
Permission error during installation
- Install with
sudo: sudo npm install -g @openai/codex
- Or configure npm to use the user directory:
npm config set prefix ~/.npm-global
macOS security settings prevent running
- Open System Preferences → Security & Privacy.
- Click Open Anyway or Allow.
- Alternatively, run
sudo spctl --master-disable in Terminal.
1. Install Node.js
Add the NodeSource repository and install Node.js:sudo curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
Verify the installation:node --version
npm --version
Some distributions may require additional dependencies. If you encounter permission issues, use sudo. Ensure your user has write permissions in npm’s global directory.
2. Install Codex CLI
npm install -g @openai/codex
If you encounter permission issues:sudo npm install -g @openai/codex
Verify the installation:Run the one-click configuration script:curl -fsSL https://raw.githubusercontent.com/QuantumNous/new-api-docs/refs/heads/main/helper/codex-cli-setup.sh | bash
The script prompts you for your Newapi base URL and API key and updates the Codex CLI configuration file.4. Start using Codex CLI
Launch Codex CLI:To use Codex CLI in a specific project:cd /path/to/your/project
codex
After updating the API address, all Codex CLI model requests route through your Newapi instance instead of OpenAI’s servers directly.
Linux troubleshooting
Permission error during installation
- Install with
sudo: sudo npm install -g @openai/codex
- Configure npm to use the user directory:
npm config set prefix ~/.npm-global
- Then add to PATH:
export PATH=~/.npm-global/bin:$PATH
Missing dependency libraries# Ubuntu/Debian
sudo apt install build-essential
# CentOS/RHEL
sudo dnf groupinstall "Development Tools"