CodexBeginnersUpdated

Codex Setup

Codex is OpenAI's coding assistant.

Complete the Environment Setup chapter first and make sure Node.js and npm are installed.

After basic setup, use the Codex config.toml guide to choose reasoning effort, credential storage, Provider Base URLs, and profiles safely.


Linux / MacOS

Step 1: Install Codex

bash
npm install -g @openai/codex@latest

Step 2: Create Config Folder

Create a .codex folder under your home directory.

bash
mkdir -p ~/.codex

Step 3: Create config.toml

Create config.toml inside .codex and paste:

toml
model_provider = "icodeeasy"
model = "gpt-6.1-sol"
cli_auth_credentials_store = "file"
suppress_unstable_features_warning = true
personality = "pragmatic"

[model_providers.icodeeasy]
name = "icodeeasy"
base_url = "https://api.icodeeasy.cc"
wire_api = "responses"
requires_openai_auth = true

gpt-6.1-sol is the current mainstay Codex model on this site. For maximum capability, set model to the flagship gpt-6-astra and keep every other field unchanged. Existing gpt-5.6-sol configurations still work but are no longer recommended.

If api.icodeeasy.cc is slow from your network, change base_url to https://jp.icodeeasy.cc or https://sg.icodeeasy.cc.

Step 4: Sign in and create auth.json

Copy the API key from API Keys, then run the commands below. Paste the key and press Enter. The input is hidden and the key is not persisted in your shell startup files:

bash
read -s OPENAI_API_KEY
printf '\n'
printf '%s' "$OPENAI_API_KEY" | codex login --with-api-key
unset OPENAI_API_KEY
codex login status

Codex writes the credential to ~/.codex/auth.json. Do not create or edit that file manually: config.toml controls the model and Provider, while auth.json stores only login credentials. Restrict both files to your user:

bash
chmod 600 ~/.codex/config.toml ~/.codex/auth.json

Step 5: Start Codex

bash
cd your-project-folder
codex

Windows

Step 1: Install Codex

powershell
npm install -g @openai/codex@latest

Step 2: Create Config Folder

View your user directory:

powershell
echo $env:USERPROFILE

Create the .codex folder:

powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.codex"

Step 3: Create config.toml

Create config.toml inside .codex and paste:

toml
model_provider = "icodeeasy"
model = "gpt-6.1-sol"
cli_auth_credentials_store = "file"
suppress_unstable_features_warning = true
personality = "pragmatic"

[model_providers.icodeeasy]
name = "icodeeasy"
base_url = "https://api.icodeeasy.cc"
wire_api = "responses"
requires_openai_auth = true

[features]
elevated_windows_sandbox = true

gpt-6.1-sol is the current mainstay Codex model on this site. For maximum capability, set model to the flagship gpt-6-astra and keep every other field unchanged. Existing gpt-5.6-sol configurations still work but are no longer recommended.

If api.icodeeasy.cc is slow from your network, change base_url to https://jp.icodeeasy.cc or https://sg.icodeeasy.cc.

Step 4: Sign in and create auth.json

Copy the API key from API Keys, then run:

powershell
$secureKey = Read-Host "API Key" -AsSecureString
$plainKey = [System.Net.NetworkCredential]::new("", $secureKey).Password
$plainKey | codex login --with-api-key
$plainKey = $null
codex login status

Codex writes the credential to $env:USERPROFILE\.codex\auth.json. Do not create or edit the file manually, and do not set a permanent user-level OPENAI_API_KEY variable.

Step 5: Start Codex

Open a new PowerShell window, enter your project directory, and start:

powershell
cd your-project-folder
codex

VSCode

Complete the Codex CLI setup first and confirm codex login status succeeds. The VSCode extension reuses the same config.toml and Codex login cache.

Step 1: Install Codex Extension

Search for and install Codex in the VSCode extension marketplace.

Step 2: Open Config File

The Codex VSCode extension reuses .codex/config.toml under your user directory. Create the .codex folder and config.toml by following the Linux / MacOS or Windows steps above.

Step 3: Configure API Key

You normally do not need to enter the key again. If the extension still asks you to sign in, run codex login status in VSCode's integrated terminal and then run Developer: Reload Window.