CC Switch is a cross-platform configuration manager for AI CLIs. It provides a visual way to switch between the official Codex setup and multiple API providers. This guide uses CC Switch 3.20 or later.
Configuration Overview
CC Switch manages ~/.codex/auth.json and ~/.codex/config.toml:
| Field | Value |
|---|---|
| Provider name | 4AICode |
| API Key | An sk-4ai-... token from the dashboard |
| API endpoint | https://relay.4aicode.com/v1 |
| Default model | gpt-5.6-terra |
| Upstream format | OpenAI Responses API |
4AICode supports the Responses API directly. Keep Full URL mode and local routing disabled.
1. Prepare the Token and Clients
- Create an
sk-4ai-...token from Dashboard → Manage Tokens. - Install the latest version from the CC Switch website or GitHub Releases.
- Install the Codex CLI.
sk-4ai-xxxxxxxxxxxxxxxx is a placeholder in this guide. Replace it with the token created in the dashboard when filling in the provider. Keep real tokens out of version control and private messages.
On first launch, CC Switch can import your existing Codex configuration. It updates the Codex configuration files whenever you switch providers.
2. Add the 4AICode Provider
- Select Codex at the top of CC Switch.
- Click + in the upper-right corner.
- Stay on App-specific provider and select the Custom preset.
- Enter the following values:
| CC Switch field | Value |
|---|---|
| Name | 4AICode |
| API Key | sk-4ai-xxxxxxxxxxxxxxxx |
| API endpoint / Base URL | https://relay.4aicode.com/v1 |
| Default model | gpt-5.6-terra |
The recommended endpoint depends on region: use .com on international networks and https://relay.4aicode.net/v1 in mainland China. The English examples use .com.
3. Check Advanced Options
Expand Advanced options and confirm:
| Option | Setting |
|---|---|
| Upstream format | OpenAI Responses API |
| Full URL mode | Off |
| Local routing / mapping | Off; recent CC Switch versions may infer this from the upstream format and hide the switch |
| Model mapping | Empty |
https://relay.4aicode.com/v1 is an API prefix. With Full URL mode disabled, Codex adds the /responses path.
In the config.toml (TOML) editor near the bottom of the form, set model_reasoning_effort to xhigh. This is the recommended value for this guide, and CC Switch writes it to the Codex configuration.
Click Add to save the provider.
4. Enable and Verify
- Click Enable on the 4AICode provider card.
- Quit every running Codex CLI or Codex App instance.
- Open a new terminal and run:
codex
Enter a simple task such as “List this directory and explain the project structure.” A normal response confirms the setup.
Codex needs a restart after CC Switch changes its provider. You can use the main window or system tray for future provider switches.
Change Models
Edit the 4AICode provider and enter a model under Default model. These models are currently exposed by 4AICode; the dashboard model list and account-pool status are authoritative:
| Model | Recommended use |
|---|---|
gpt-6-astra | New-generation flagship; billed at 15% of the official price |
gpt-5.6-sol | Complex engineering and strongest reasoning |
gpt-5.6-terra | Everyday coding; recommended default |
gpt-5.6-luna | Fast, economical tasks |
gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.3-codex | Existing workflows |
gpt-5.6-sol supports max reasoning effort. xhigh is the recommended setting for the other models. max uses more reasoning compute, responds more slowly, and costs more. Save, enable the provider again, and restart Codex.
Configuration Reference
CC Switch stores the token in auth.json for a third-party API-key provider, with the same semantics as the examples below. The official ChatGPT login mode uses a separate authentication structure containing tokens and last_refresh; CC Switch manages each structure according to the provider type. CC Switch may also generate a different provider ID and section name.
auth.json:
{
"OPENAI_API_KEY": "sk-4ai-xxxxxxxxxxxxxxxx"
}
config.toml:
model_provider = "custom"
model = "gpt-5.6-terra"
model_reasoning_effort = "xhigh"
[model_providers.custom]
name = "4AICode"
base_url = "https://relay.4aicode.com/v1"
wire_api = "responses"
requires_openai_auth = true
requires_openai_auth = true tells this provider to read its API key from auth.json.
Troubleshooting
| Symptom | Fix |
|---|---|
| Codex still uses the previous provider | Confirm the 4AICode card says “Currently enabled,” quit Codex completely, then open a new terminal or restart the app |
A request returns 401 | Check that the API key is complete and active in the dashboard |
A request returns 404 | Ensure the Base URL ends in /v1 and Full URL mode is off |
| Requests go through the CC Switch local proxy | Select the Responses format and disable local routing takeover |
| The fields in this guide are missing | Upgrade CC Switch; field labels follow the current app version |
For the setup script, Codex App mobile support, and SDK examples, see ChatGPT / Codex Setup.