Skip to content

CodeX Deployment Guide

OpenAI's enterprise-grade AI coding assistant with intelligent coding and code generation right in your terminal.

💡 Prerequisites

Step 1: Install CodeX

bash
npm install -g @openai/codex@latest

Verify the installation:

bash
codex --version

Step 2: CC-Switch Configuration

  1. Open the CC-Switch configuration tool
  2. Switch to the Codex tab
  3. Click Add Provider and fill in the following:
SettingValue
NameTokenSwitch (or a custom name)
Base URLhttps://tokenswitch.cc/v1
API KeyYour CodeX token
Modelgpt-5.4
  1. Save the configuration and you're ready to go

Manual Installation and Configuration

Windows

Install CodeX

powershell
npm install -g @openai/codex@latest

Create Configuration Files

  1. Create the configuration directory:
powershell
mkdir "$env:USERPROFILE\.codex"
  1. Create the config.toml file (path: %USERPROFILE%\.codex\config.toml):
toml
model_provider = "openai"
model = "gpt-5.4"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"
  1. Create the auth.json file (path: %USERPROFILE%\.codex\auth.json):
json
{
  "OPENAI_API_KEY": "your-codex-token"
}

macOS

Install CodeX

bash
npm install -g @openai/codex@latest

Create Configuration Files

  1. Create the configuration directory:
bash
mkdir -p ~/.codex
  1. Create ~/.codex/config.toml:
toml
model_provider = "openai"
model = "gpt-5.4"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"
  1. Create ~/.codex/auth.json:
json
{
  "OPENAI_API_KEY": "your-codex-token"
}

Linux

Install CodeX

bash
npm install -g @openai/codex@latest

Create Configuration Files

  1. Create the configuration directory:
bash
mkdir -p ~/.codex
  1. Create ~/.codex/config.toml:
toml
model_provider = "openai"
model = "gpt-5.4"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"
  1. Create ~/.codex/auth.json:
json
{
  "OPENAI_API_KEY": "your-codex-token"
}

Configuration Reference

config.toml Parameters

ParameterDescriptionValue
model_providerModel provideropenai
modelModel to usegpt-5.4
base_urlAPI endpoint URLhttps://tokenswitch.cc/v1
wire_apiAPI protocol formatresponses

auth.json Parameters

ParameterDescription
OPENAI_API_KEYYour dedicated CodeX token

Verify Installation

Once configured, run the following in your terminal:

bash
codex

If the CodeX interactive interface launches successfully, deployment is complete.

Troubleshooting

codex: command not found

Possible CauseSolution
Not installed correctlyRe-run npm install -g @openai/codex@latest
PATH not configuredCheck that the npm global bin directory is in your PATH
Terminal not refreshedRestart the terminal window

Connection Failed / Authentication Error

Possible CauseSolution
Incorrect API KeyCheck that the token in auth.json is correct
Wrong Base URLConfirm base_url in config.toml is https://tokenswitch.cc/v1
Token group mismatchConfirm you are using a token group that supports OpenAI models
Insufficient balanceLog in to the TokenSwitch console and check your balance

Configuration Files Not Taking Effect

  • Check that file paths are correct: ~/.codex/config.toml and ~/.codex/auth.json
  • Check that TOML and JSON formatting is correct (watch for quotes and commas)
  • Restart the terminal and try again

Next Steps

✅ CodeX deployment complete!

Harmony, Kindness, Mutual Help, Happiness