Your privacy choices

Allow optional cookies for referral attribution, visit analytics, and Google Ads purchase measurement.

Codex Deployment Guide

Covers CLI installation, API access, and development environment configuration.

📋 Prerequisite (Step One) Complete the Node.js installation first and make sure Node.js 18+ is installed correctly. When configuring CC-Switch, remember to open the advanced options. You can start chatting after adding the model.


🎯 Quick Navigation

Codex is a next-generation AI coding assistant built on the GPT-5 architecture, offering developers powerful code generation and optimization capabilities.

Deployment path: Configure the system environment ➜ Install the CLI tool ➜ Integrate the API ➜ Prepare the development environment

⚠️ Prerequisite

Before configuring Codex with CC-Switch, make sure you have installed the Codex tool globally with npm:

npm install -g @openai/codex@latest
下载压缩包 下载压缩包

Verify the installation: codex --version

We recommend the CC-Switch quick configuration tool for simple graphical setup without command-line work.

Configuration Steps

  1. Launch CC-Switch and switch to the Codex tab

The CC-Switch application with several tabs at the top. A red arrow highlights the “Codex” tab. After launching CC-Switch, click this tab to open the Codex configuration workflow.The CC-Switch application with several tabs at the top. A red arrow high…

  1. Open the CC-Switch application
  2. Click the “Codex” tab at the top
  3. Click the orange “+” button in the upper-right corner to add a configuration
  4. Enter the Codex provider configuration
  5. Provider name: Enter a custom name, such as “gpt-agent”
  6. Base URL: Enter https://api.llm-token.cn/v1
  7. API Key: Paste your API key
  8. Model: Select gpt-5.4 (the latest model when this guide was written was 5.4)
  9. Other settings: Adjust reasoning effort, network access, and other parameters as needed
  10. Click “Save”

The Add Configuration screen in CC-Switch. Tabs for “Codex Provider” and “Unified Provider” appear at the top, with “Codex Provider” selected. Below them are “Custom Configuration” and preset provider options such as OpenAI Official and Shengsuanyun. Provider Name and Notes fields appear at the bottom, along with Cancel and Add buttons. This screen appears after clicking the orange “+” button and is where you add a custom provider.The Add Configuration screen in CC-Switch. Tabs for “Codex Provider” and…

The Edit Provider Configuration screen in CC-Switch. The provider name is set to “Guizhou Cloud Computing,” part of the website field shows “https:///,” the API Key field contains a masked key, and the API request URL is “https://api.llm-token.cn/v1.” A yellow note says to enter a service endpoint compatible with the OpenAI Response format, and a blue Save button appears in the lower-right corner.The Edit Provider Configuration screen in CC-Switch. The provider name i…

💡 Tip

  • CC-Switch automatically creates the ~/.codex/config.toml and auth.json files
  • You can add multiple provider configurations and switch between them at any time
  • After switching configurations, close and restart Codex for the change to take effect
  1. Enable and use the configuration
  2. Find the configuration you just created in the configuration list
  3. Click “In Use” on the right side of the configuration
  4. The configuration will be marked “In Use” with a green label
  5. Restart Codex to apply the new configuration
  6. Switch quickly from the system tray

CC-Switch lets you switch Codex configurations from the system tray:

  • Right-click the CC-Switch icon in the system tray
  • Select the Codex category from the menu
  • Select the configuration you want to use
  • The configuration takes effect immediately without opening the main window

⚠️ Important

  • You must restart Codex after switching configurations
  • You can test API endpoint speed in CC-Switch

⌨️ Manual Command-Line Setup

If you do not use CC-Switch, follow the steps below to configure Codex manually.

🖥️ Windows

Step One: Install the Codex Command-Line Tool

Launch Command Prompt or PowerShell as an administrator, then run:

npm install -g @openai/codex@latestcodex --version

Create the configuration file: config.toml

model_provider = "gpt-agent"model = "gpt-5.4"model_reasoning_effort = "xhigh"disable_response_storage = trueapproval_policy = "on-request"sandbox_mode = "danger-full-access"model_supports_reasoning_summaries = true[model_providers.gpt-agent]name = "ikun"base_url = "https://api.llm-token.cn/v1"wire_api = "responses"requires_openai_auth = true

Create the authentication file: auth.json

{  "OPENAI_API_KEY": "此处粘贴您的 CodeX 专用令牌"}

Step Three: Initialize the Workspace

mkdir my-codex-projectcd my-codex-projectcodex

🍏 macOS

Install the Codex Tool

npm install -g @openai/codex@latestcodex --version

Integrate the API Service

Create the configuration directory:

mkdir -p ~/.codexcd ~/.codex

Create the config.toml configuration:

cat > config.toml << 'EOF'model_provider = "gpt-agent"model = "gpt-5.4"model_reasoning_effort = "xhigh"disable_response_storage = trueapproval_policy = "on-request"sandbox_mode = "danger-full-access"model_supports_reasoning_summaries = true[model_providers.gpt-agent]name = "ikun"base_url = "https://api.llm-token.cn/v1"wire_api = "responses"requires_openai_auth = trueEOF

Create the auth.json authentication configuration:

cat > auth.json << 'EOF'{  "OPENAI_API_KEY": "此处粘贴您的 CodeX 专用令牌"}EOF

Initialize the Workspace

mkdir my-codex-projectcd my-codex-projectcodex

🐧 Linux

Install the Codex Tool

sudo npm install -g @openai/codex@latestcodex --version

1 2

Integrate the API Service

Create the configuration directory:

mkdir -p ~/.codexcd ~/.codex

Create the config.toml configuration:

cat > config.toml << 'EOF'model_provider = "gpt-agent"model = "gpt-5.4"model_reasoning_effort = "xhigh"disable_response_storage = trueapproval_policy = "on-request"sandbox_mode = "danger-full-access"model_supports_reasoning_summaries = true[model_providers.gpt-agent]name = "ikun"base_url = "https://api.llm-token.cn/v1"wire_api = "responses"requires_openai_auth = trueEOF

Create the auth.json authentication configuration:

cat > auth.json << 'EOF'{  "OPENAI_API_KEY": "此处粘贴您的 CodeX 专用令牌"}EOF

Initialize the Workspace

mkdir my-codex-projectcd my-codex-projectcodex

Where Are the Configuration Files Stored?

  • Windows: %USERPROFILE%\.codex\
  • macOS/Linux: ~/.codex/

Configured but Unable to Chat?

Try the steps below. If the issue persists, contact support.

The CC Switch interface with the “Guizhou Cloud Computing” row highlighted in green. A three-dot icon appears on the left and a “Query failed” label appears on the right. A red arrow points to the gear icon on the left, indicating where to click when troubleshooting a configuration that cannot chat.The CC Switch interface with the “Guizhou Cloud Computing” row highlight…

The CC Switch Settings screen. Red arrows point to the “Proxy” tab at the top and the “Running” status in the Local Proxy section. The Local Proxy module lets you control the proxy service and view its status and port information; “Running” indicates that the proxy service is operating normally.The CC Switch Settings screen. Red arrows point to the “Proxy” tab at th…

Proxy-related settings in the Codex deployment guide. The General, Proxy, and Logs tabs appear at the top, with Proxy selected. The main proxy toggle is enabled, and Codex and Gemini options appear below it, with a red arrow pointing to Codex. The screen also shows proxy server address, proxy port, proxy type, proxy capabilities, and application logging settings. Use these settings to troubleshoot a configuration that cannot chat.Proxy-related settings in the Codex deployment guide. The General, Proxy…