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 token (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 token |
| Model | gpt-5.4 |
- Save the configuration and you're ready to go
Manual Installation and Configuration
Windows
Install CodeX
powershell
npm install -g @openai/codex@latestCreate Configuration Files
- Create the configuration directory:
powershell
mkdir "$env:USERPROFILE\.codex"- Create the
config.tomlfile (path:%USERPROFILE%\.codex\config.toml):
toml
model_provider = "openai"
model = "gpt-5.4"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"- Create the
auth.jsonfile (path:%USERPROFILE%\.codex\auth.json):
json
{
"OPENAI_API_KEY": "your-codex-token"
}macOS
Install CodeX
bash
npm install -g @openai/codex@latestCreate Configuration Files
- Create the configuration directory:
bash
mkdir -p ~/.codex- Create
~/.codex/config.toml:
toml
model_provider = "openai"
model = "gpt-5.4"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"- Create
~/.codex/auth.json:
json
{
"OPENAI_API_KEY": "your-codex-token"
}Linux
Install CodeX
bash
npm install -g @openai/codex@latestCreate Configuration Files
- Create the configuration directory:
bash
mkdir -p ~/.codex- Create
~/.codex/config.toml:
toml
model_provider = "openai"
model = "gpt-5.4"
base_url = "https://tokenswitch.cc/v1"
wire_api = "responses"- Create
~/.codex/auth.json:
json
{
"OPENAI_API_KEY": "your-codex-token"
}Configuration Reference
config.toml Parameters
| Parameter | Description | Value |
|---|---|---|
model_provider | Model provider | openai |
model | Model to use | gpt-5.4 |
base_url | API endpoint URL | https://tokenswitch.cc/v1 |
wire_api | API protocol format | responses |
auth.json Parameters
| Parameter | Description |
|---|---|
OPENAI_API_KEY | Your dedicated CodeX token |
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 the token in auth.json is correct |
| Wrong Base URL | Confirm base_url in config.toml is https://tokenswitch.cc/v1 |
| Token group mismatch | Confirm you are using a token group that supports OpenAI 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 (watch for quotes and commas)
- Restart the terminal and try again
Next Steps
✅ CodeX deployment complete!
- CC-Switch Configuration Tool — Graphically manage multiple providers
- FAQ — More troubleshooting help