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 API key
Modelgpt-5.5
API protocolresponses
  1. Save the configuration and you're ready to go

Manual Installation and Configuration

CodeX uses two configuration files:

FilePurpose
config.tomlConfigures the model, provider, endpoint, and protocol
auth.jsonStores OPENAI_API_KEY

Windows

Install CodeX

powershell
npm install -g @openai/codex@latest

Create Configuration Files

  1. Create the configuration directory:
powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex"
  1. Create the config.toml file (path: %USERPROFILE%\.codex\config.toml):
toml
model_provider = "tokenswitch"
model = "gpt-5.5"
model_reasoning_effort = "xhigh"
network_access = "enabled"
disable_response_storage = true

[model_providers.tokenswitch]
name = "tokenswitch"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"
requires_openai_auth = true
  1. Create the auth.json file (path: %USERPROFILE%\.codex\auth.json):
json
{
  "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx"
}

Replace sk-xxxxxxxxxxxxxxxx with your API key.

macOS

Install CodeX

bash
npm install -g @openai/codex@latest

Create Configuration Files

bash
mkdir -p ~/.codex
cd ~/.codex

cat > config.toml << 'EOF'
model_provider = "tokenswitch"
model = "gpt-5.5"
model_reasoning_effort = "xhigh"
network_access = "enabled"
disable_response_storage = true

[model_providers.tokenswitch]
name = "tokenswitch"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"
requires_openai_auth = true
EOF

cat > auth.json << 'EOF'
{
  "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx"
}
EOF

Replace sk-xxxxxxxxxxxxxxxx with your API key.

Linux

Install CodeX

bash
npm install -g @openai/codex@latest

Create Configuration Files

bash
mkdir -p ~/.codex

cat > ~/.codex/config.toml << 'EOF'
model_provider = "tokenswitch"
model = "gpt-5.5"
model_reasoning_effort = "xhigh"
network_access = "enabled"
disable_response_storage = true

[model_providers.tokenswitch]
name = "tokenswitch"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"
requires_openai_auth = true
EOF

cat > ~/.codex/auth.json << 'EOF'
{
  "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx"
}
EOF

Replace sk-xxxxxxxxxxxxxxxx with your API key.

Configuration Reference

config.toml Parameters

ParameterDescriptionValue
model_providerActive model providertokenswitch
modelModel to usegpt-5.5
model_reasoning_effortReasoning effortxhigh
network_accessEnables network accessenabled
disable_response_storageDisables response storagetrue
model_providers.tokenswitch.base_urlOpenAI-compatible endpointhttps://tokenswitch.cc/v1
model_providers.tokenswitch.wire_apiAPI protocol formatresponses
model_providers.tokenswitch.requires_openai_authUses OpenAI API key authtrue

auth.json Parameters

ParameterDescription
OPENAI_API_KEYYour CodeX API key

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 OPENAI_API_KEY in auth.json is correct
Wrong Base URLConfirm base_url in config.toml is https://tokenswitch.cc/v1
Wrong providerConfirm model_provider = "tokenswitch" and that [model_providers.tokenswitch] exists
Wrong protocolConfirm wire_api = "responses"
Token group mismatchConfirm you are using an API key that supports OpenAI / CodeX 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
  • Restart the terminal and try again

Next Steps

CodeX deployment complete!

Harmony, Kindness, Mutual Help, Happiness