Codex Integration
Configure OpenAI Codex CLI with QCode.cc API key
Codex Integration Guide¶
QCode.cc supports not only Claude Code but also OpenAI Codex CLI. After purchasing a plan, Claude Code and Codex share the same quota, giving you flexibility to choose which tool to use.
Configuration Overview¶
Codex CLI requires two configuration files:
- ~/.codex/config.toml - Service configuration
- ~/.codex/auth.json - Authentication configuration
Windows Configuration¶
Step 1: Create Configuration Directory¶
mkdir $HOME\.codex
Step 2: Create config.toml¶
Create the configuration file at ~/.codex/config.toml:
model_provider = "crs"
model = "gpt-5-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.crs]
name = "crs"
base_url = "https://asia.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
env_key = "CRS_OAI_KEY"
Step 3: Create auth.json¶
Create the authentication file at ~/.codex/auth.json:
{
"OPENAI_API_KEY": "cr_xxxxxxxxxx"
}
Replace
cr_xxxxxxxxxxwith your QCode.cc API key.
Step 4: Set Environment Variable (Optional)¶
If you prefer to provide the key via environment variable:
# Temporary
$env:CRS_OAI_KEY = "cr_xxxxxxxxxx"
# Permanent
[System.Environment]::SetEnvironmentVariable("CRS_OAI_KEY", "cr_xxxxxxxxxx", [System.EnvironmentVariableTarget]::User)
Then set OPENAI_API_KEY to null in auth.json.
macOS Configuration¶
Step 1: Create Configuration Directory¶
mkdir -p ~/.codex
Step 2: Create config.toml¶
cat > ~/.codex/config.toml << 'EOF'
model_provider = "crs"
model = "gpt-5-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.crs]
name = "crs"
base_url = "https://asia.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
env_key = "CRS_OAI_KEY"
EOF
Step 3: Create auth.json¶
cat > ~/.codex/auth.json << 'EOF'
{
"OPENAI_API_KEY": "cr_xxxxxxxxxx"
}
EOF
Replace
cr_xxxxxxxxxxwith your QCode.cc API key.
Step 4: Set Environment Variable (Optional)¶
If you prefer to provide the key via environment variable:
# Temporary
export CRS_OAI_KEY="cr_xxxxxxxxxx"
# Permanent
echo 'export CRS_OAI_KEY="cr_xxxxxxxxxx"' >> ~/.zshrc
source ~/.zshrc
Then set OPENAI_API_KEY to null in auth.json.
Linux Configuration¶
Step 1: Create Configuration Directory¶
mkdir -p ~/.codex
Step 2: Create config.toml¶
cat > ~/.codex/config.toml << 'EOF'
model_provider = "crs"
model = "gpt-5-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.crs]
name = "crs"
base_url = "https://asia.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
env_key = "CRS_OAI_KEY"
EOF
Step 3: Create auth.json¶
cat > ~/.codex/auth.json << 'EOF'
{
"OPENAI_API_KEY": "cr_xxxxxxxxxx"
}
EOF
Replace
cr_xxxxxxxxxxwith your QCode.cc API key.
Step 4: Set Environment Variable (Optional)¶
If you prefer to provide the key via environment variable:
# Temporary
export CRS_OAI_KEY="cr_xxxxxxxxxx"
# Permanent (Bash)
echo 'export CRS_OAI_KEY="cr_xxxxxxxxxx"' >> ~/.bashrc
source ~/.bashrc
# Permanent (Zsh)
echo 'export CRS_OAI_KEY="cr_xxxxxxxxxx"' >> ~/.zshrc
source ~/.zshrc
Then set OPENAI_API_KEY to null in auth.json.
Verify Configuration¶
After configuration, run Codex CLI to verify:
codex
Success Indicators¶
- Codex starts normally and connects to the service
- Can generate code and receive AI responses
- Network requests go through QCode.cc proxy service
Troubleshooting¶
Configuration File Not Found¶
Problem: Codex cannot find configuration file
Solution:
1. Check if the configuration file path is correct
2. Confirm ~/.codex/ directory exists
3. Confirm config.toml and auth.json files exist
API Key Authentication Failed¶
Problem: Environment variable invalid or API key error
Solution:
1. Check if CRS_OAI_KEY environment variable is correctly set
2. Verify API key format is correct (starts with cr_)
3. Confirm key hasn't expired, visit Dashboard to verify
Network Connection Issues¶
Problem: Cannot connect to QCode.cc service
Solution:
1. Check network connection
2. Verify base_url is set to https://asia.qcode.cc/openai
3. Try backup endpoints:
- 🇭🇰 Hong Kong: http://103.218.243.5/openai
- 🇨🇳 Shenzhen: http://103.236.53.153/openai
QCode.cc Advantages¶
| Advantage | Description |
|---|---|
| 80% Cost Savings | Significantly lower than official pricing |
| Shared Quota | Claude Code and Codex share the same plan quota |
| 99.9% Availability | Enterprise-grade stable service |
| Asia-Pacific Optimized | Low latency, fast response |
Related Documentation¶
- Environment Configuration - Claude Code setup
- Quick Start - Getting started with Claude Code