Guides

CC Switch

LLMs Text

CC Switch Setup

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:

FieldValue
Provider name4AICode
API KeyAn sk-4ai-... token from the dashboard
API endpointhttps://relay.4aicode.com/v1
Default modelgpt-5.6-terra
Upstream formatOpenAI Responses API

4AICode supports the Responses API directly. Keep Full URL mode and local routing disabled.

1. Prepare the Token and Clients

  1. Create an sk-4ai-... token from Dashboard → Manage Tokens.
  2. Install the latest version from the CC Switch website or GitHub Releases.
  3. 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

  1. Select Codex at the top of CC Switch.
  2. Click + in the upper-right corner.
  3. Stay on App-specific provider and select the Custom preset.
  4. Enter the following values:
CC Switch fieldValue
Name4AICode
API Keysk-4ai-xxxxxxxxxxxxxxxx
API endpoint / Base URLhttps://relay.4aicode.com/v1
Default modelgpt-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:

OptionSetting
Upstream formatOpenAI Responses API
Full URL modeOff
Local routing / mappingOff; recent CC Switch versions may infer this from the upstream format and hide the switch
Model mappingEmpty

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

  1. Click Enable on the 4AICode provider card.
  2. Quit every running Codex CLI or Codex App instance.
  3. 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:

ModelRecommended use
gpt-6-astraNew-generation flagship; billed at 15% of the official price
gpt-5.6-solComplex engineering and strongest reasoning
gpt-5.6-terraEveryday coding; recommended default
gpt-5.6-lunaFast, economical tasks
gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.3-codexExisting 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

SymptomFix
Codex still uses the previous providerConfirm the 4AICode card says “Currently enabled,” quit Codex completely, then open a new terminal or restart the app
A request returns 401Check that the API key is complete and active in the dashboard
A request returns 404Ensure the Base URL ends in /v1 and Full URL mode is off
Requests go through the CC Switch local proxySelect the Responses format and disable local routing takeover
The fields in this guide are missingUpgrade CC Switch; field labels follow the current app version

For the setup script, Codex App mobile support, and SDK examples, see ChatGPT / Codex Setup.