This article will take you through installing OpenAI Codex CLI from scratch, configuring your API Key, setting up sandbox mode, and integrating with ProjectManager.

Prerequisites

Before installing Codex CLI, make sure your environment meets the following requirements:

Check Node.js version:

node --version
# Should output v22.x.x or higher

Installation Steps

Global Installation

npm install -g @openai/codex

Verify Installation

codex --version
# Should output codex/x.x.x

First Run

codex
# Will prompt for API Key on first run

Configuration Details

API Key Configuration

Codex CLI supports the following methods to configure your API Key:

export OPENAI_API_KEY=sk-xxxxx

Model Selection

Codex CLI supports the following models, specified via the --model parameter:

codex --model o3

Sandbox Mode

Codex CLI has a built-in sandbox mode that restricts AI operation permissions:

codex                        # Suggest mode (default)
codex --full-auto            # Full auto mode

It is recommended to only use full auto mode in trusted environments, and always use Git for easy rollback.

Custom Base URL

If you use a proxy or a third-party service compatible with the OpenAI API:

export OPENAI_BASE_URL=https://your-proxy.example.com/v1

Integrating with Wishmere

Wishmere can automatically detect installed Codex CLI, and you can choose the appropriate agent based on your project type:

In Wishmere’s project settings, you can configure default tools and model switching strategies.

FAQ

1. Node.js Version Does Not Meet Requirements

Codex CLI requires Node.js 22+. If the version is too low:

nvm install 22
nvm use 22
npm install -g @openai/codex

2. Sandbox Permission Denied

If operations are denied in sandbox mode, check if necessary system permissions are missing. macOS users may need to allow terminal operations in “System Preferences → Security & Privacy”.

3. API Rate Limit

OpenAI API has rate limits. If you encounter a 429 error, wait a moment and retry, or upgrade your API plan.

4. Garbled Output

If terminal output is garbled, make sure your terminal supports UTF-8 encoding:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Next Steps

Using Wishmere lets you manage both Claude Code and Codex CLI simultaneously, automatically selecting the most suitable tool based on the task, so you can focus on the work itself.

← Back to Articles