CodeX Deployment Guide
OpenAI's enterprise-grade AI coding assistant with intelligent coding and code generation right in your terminal.
Prerequisites
- Node.js 18+ runtime (Windows Install | macOS Install | Linux Install)
- TokenSwitch account with a valid CodeX API key (Create Key)
- Recommended: CC-Switch configuration tool
CC-Switch Quick Config (Recommended)
Step 1: Install CodeX
bash
npm install -g @openai/codex@latestVerify the installation:
bash
codex --versionStep 2: CC-Switch Configuration
- Open the CC-Switch configuration tool
- Switch to the Codex tab
- Click Add Provider and fill in the following:
| Setting | Value |
|---|---|
| Name | TokenSwitch (or a custom name) |
| Base URL | https://tokenswitch.cc/v1 |
| API Key | Your CodeX API key |
| Model | gpt-5.5 |
| API protocol | responses |
- Save the configuration and you're ready to go
Manual Installation and Configuration
CodeX uses two configuration files:
| File | Purpose |
|---|---|
config.toml | Configures the model, provider, endpoint, and protocol |
auth.json | Stores OPENAI_API_KEY |
Windows
Install CodeX
powershell
npm install -g @openai/codex@latestCreate Configuration Files
- Create the configuration directory:
powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex"- Create the
config.tomlfile (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- Create the
auth.jsonfile (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@latestCreate 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"
}
EOFReplace sk-xxxxxxxxxxxxxxxx with your API key.
Linux
Install CodeX
bash
npm install -g @openai/codex@latestCreate 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"
}
EOFReplace sk-xxxxxxxxxxxxxxxx with your API key.
Configuration Reference
config.toml Parameters
| Parameter | Description | Value |
|---|---|---|
model_provider | Active model provider | tokenswitch |
model | Model to use | gpt-5.5 |
model_reasoning_effort | Reasoning effort | xhigh |
network_access | Enables network access | enabled |
disable_response_storage | Disables response storage | true |
model_providers.tokenswitch.base_url | OpenAI-compatible endpoint | https://tokenswitch.cc/v1 |
model_providers.tokenswitch.wire_api | API protocol format | responses |
model_providers.tokenswitch.requires_openai_auth | Uses OpenAI API key auth | true |
auth.json Parameters
| Parameter | Description |
|---|---|
OPENAI_API_KEY | Your CodeX API key |
Verify Installation
Once configured, run the following in your terminal:
bash
codexIf the CodeX interactive interface launches successfully, deployment is complete.
Troubleshooting
codex: command not found
| Possible Cause | Solution |
|---|---|
| Not installed correctly | Re-run npm install -g @openai/codex@latest |
| PATH not configured | Check that the npm global bin directory is in your PATH |
| Terminal not refreshed | Restart the terminal window |
Connection Failed / Authentication Error
| Possible Cause | Solution |
|---|---|
| Incorrect API key | Check that OPENAI_API_KEY in auth.json is correct |
| Wrong Base URL | Confirm base_url in config.toml is https://tokenswitch.cc/v1 |
| Wrong provider | Confirm model_provider = "tokenswitch" and that [model_providers.tokenswitch] exists |
| Wrong protocol | Confirm wire_api = "responses" |
| Token group mismatch | Confirm you are using an API key that supports OpenAI / CodeX models |
| Insufficient balance | Log in to the TokenSwitch console and check your balance |
Configuration Files Not Taking Effect
- Check that file paths are correct:
~/.codex/config.tomland~/.codex/auth.json - Check that TOML and JSON formatting is correct
- Restart the terminal and try again
Next Steps
CodeX deployment complete!
- CC-Switch Configuration Tool — Graphically manage multiple providers
- FAQ — More troubleshooting help