Skip to content

CodeX CLI Installation and Configuration

Overview of this page

🚀 CodeX Installation and 4All API Configuration Guide

Section titled “🚀 CodeX Installation and 4All API Configuration Guide”

CodeX is a powerful terminal-based coding assistant built on OpenAI GPT models. By following the steps below, you can seamlessly configure it to use the 4All API aggregation platform service and enjoy an ultra-fast, fully powered AI coding experience.

If you already have it installed on your computer, just skip ahead. If not, it’s recommended to go with the default installation path to save yourself a lot of trouble.

Open the command line (CMD) or terminal (PowerShell), and run the following command to install globally:

Terminal window
# Windows users are advised to run the terminal as Administrator
# macOS/Linux users may need to add sudo
npm install -g @openai/codex@latest

After installation, you can verify that it worked by running codex —version . (Note: if Windows says it cannot find the codex command, try launching it temporarily with npx @openai/codex , or check your system’s npm environment variable configuration.)

Step 3: Configure the 4All API aggregation node

Section titled “Step 3: Configure the 4All API aggregation node”

CodeX configuration is split across two files: config.toml and auth.json . We’ll use these two files to point both the service endpoint and authentication entirely to 4All API.

  1. Get an API key:
  • Visit the [4All API Console] https://4All API.com .
  • Create a new token.
  • Copy the generated sk-… key for later use.
  1. Create the configuration files: Create a hidden folder named .codex in your user home directory:
  • Windows: %USERPROFILE%.codex (usually C:\Users\your-username.codex )
  • macOS/Linux: ~/.codex

Inside the .codex folder, create the following two files and fill them with the corresponding content:

📄 File 1: config.toml (advanced configuration for full-power reasoning and web search)

disable_response_storage = true
model = "gpt-5.2"
model_provider = "4All API"
model_reasoning_effort = "xhigh"
model_verbosity = "high"
[features]
web_search_request = true
[model_providers.4All API]
name = "4All API"
# 4All API Singapore high-speed relay node
base_url = "https://sg.4All API.com/v1"
wire_api = "responses"
# This must be enabled, together with auth.json, to complete platform authentication
requires_openai_auth = true

📄 File 2: auth.json

{
"OPENAI_API_KEY": "sk-Paste your real key obtained from 4All API here"
}

⚠️ Important notes:

  • Make sure the key format in auth.json is correct, and do not omit the double quotes.
  • The base_url in config.toml must include the /v1 path suffix exactly.

Everything is ready! Open a terminal, use the cd command to enter your project’s source code directory, and run the following command to bring up your private coding assistant:

Terminal window
codex

This refactored tutorial flows very smoothly, and it also clearly marks the configuration file locations and common pitfalls.

Step 5: One-click setup script (.bat) launch!

Section titled “Step 5: One-click setup script (.bat) launch!”

This script is really well written! In particular, the notepad auto-open logic at the end, which prompts the user to enter their key, is very thoughtful and user-friendly.

I’ve perfectly replaced it with the 4All API configuration, and I’ve also integrated the premium parameters we previously tuned together ( gpt-5.2 , full-power reasoning xhigh , web search, etc.).

Please copy the code below directly and replace your original script content:

Terminal window
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
echo ========================================
echo CodeX Assistant - 4All API One-Click Setup Tool
echo ========================================
echo.
REM Set the .codex folder path
set "CODEX_PATH=%USERPROFILE%\.codex"
REM Create the .codex folder
if not exist "%CODEX_PATH%" (
mkdir "%CODEX_PATH%"
echo [√] Folder created: %CODEX_PATH%
) else (
echo [!] Folder already exists: %CODEX_PATH%
)
REM Create config.toml
(
echo disable_response_storage = true
echo model_provider = "4All API"
echo model = "gpt-5.2"
echo model_reasoning_effort = "xhigh"
echo model_verbosity = "high"
echo.
echo [features]
echo web_search_request = true
echo.
echo [model_providers.4All API]
echo name = "4All API"
echo base_url = "https://sg.4All API.com/v1"
echo wire_api = "responses"
echo requires_openai_auth = true
) > "%CODEX_PATH%\config.toml"
echo [√] Core configuration file created: %CODEX_PATH%\config.toml
REM Create auth.json
(
echo {
echo "OPENAI_API_KEY": "sk-Paste your real key obtained from 4All API.com here"
echo }
) > "%CODEX_PATH%\auth.json"
echo [√] Key configuration file created: %CODEX_PATH%\auth.json
echo.
echo ========================================
echo The basic configuration framework has been created!
echo.
echo ⚠️ Final step:
echo Please edit the auth.json file and replace the placeholder text with your real API key.
echo ========================================
echo.
set /p "OPEN=Open the auth.json file now for editing? (Y/N): "
if /i "!OPEN!"=="Y" (
notepad "%CODEX_PATH%\auth.json"
)
pause
  • Integrated the strongest parameters: the previously required web_search_request and xhigh reasoning intensity are both written into config.toml via echo .
  • Preserved your excellent interaction flow: the feature where pressing Y immediately opens Notepad has been perfectly retained.
  • Refined the Chinese prompts: the interface prompts were made clearer to help prevent users from entering the wrong format.