Appearance
Deploy CodeX CLI
Configure OpenAI CodeX CLI to use 3xCoder as its API endpoint.
Prerequisites
Step 1: Install CodeX CLI
bash
npm install -g @openai/codexVerify installation:
bash
codex --versionStep 2: Configure CodeX
CodeX CLI uses two configuration files: config.toml for the API endpoint and auth.json for authentication.
Windows
Config file: %APPDATA%\codex\config.toml
toml
[api]
base_url = "https://api.3xcoder.com/v1"Auth file: %APPDATA%\codex\auth.json
json
{
"api_key": "sk-your-api-key-here"
}macOS
Config file: ~/Library/Application Support/codex/config.toml
toml
[api]
base_url = "https://api.3xcoder.com/v1"Auth file: ~/Library/Application Support/codex/auth.json
json
{
"api_key": "sk-your-api-key-here"
}Linux
Config file: ~/.config/codex/config.toml
toml
[api]
base_url = "https://api.3xcoder.com/v1"Auth file: ~/.config/codex/auth.json
json
{
"api_key": "sk-your-api-key-here"
}Step 3: Verify
Run CodeX:
bash
codex "Hello, what can you do?"Alternative: Environment Variables
You can also configure CodeX using environment variables:
powershell
$env:OPENAI_BASE_URL = "https://api.3xcoder.com/v1"
$env:OPENAI_API_KEY = "sk-your-api-key-here"
codex "Hello!"bash
export OPENAI_BASE_URL="https://api.3xcoder.com/v1"
export OPENAI_API_KEY="sk-your-api-key-here"
codex "Hello!"TIP
To make environment variables permanent, add the export lines to your shell profile (~/.bashrc, ~/.zshrc, or $PROFILE for PowerShell).
Using CC-Switch
You can also configure CodeX through CC-Switch:
- Run
npx cc-switch@latest - Select CodeX as the target tool
- Set base URL to
https://api.3xcoder.com/v1 - Enter your API key
- Apply the configuration
Troubleshooting
codex: command not found
- Ensure Node.js is installed and npm global bin is in your PATH
- Try reinstalling:
npm install -g @openai/codex
API connection errors
- Verify your API key:
curl https://api.3xcoder.com/v1/models -H "Authorization: Bearer sk-your-key" - Check config file paths are correct for your OS
- Ensure no trailing slash on the base URL
Model errors
- CodeX uses OpenAI models by default. Verify the model is available through your 3xCoder account
