Skip to content

Configuring Codex CLI in CC Switch ​

This guide explains how to configure OpenAI Codex CLI to route through RKAPI using CC Switch, including the exact config.toml and auth.json settings required by the Responses API.

Prerequisites ​

Step 1: Add an RKAPI Provider in CC Switch ​

  1. Open CC Switch and switch to the Codex tab.
  2. Click Add Provider (+) and select Custom.
  3. Fill in the provider parameters:
FieldValueNotes
Provider NameRKAPIDisplay name in CC Switch
API Base URL (base_url)https://api.zwwbai.com/v1Must include /v1
API Key (OPENAI_API_KEY)sk-your-api-keyPaste your RKAPI API key
Wire API (wire_api)responsesRequired by modern Codex CLI builds
Model (model)gpt-5.4Or another Codex model listed on https://s2pbxm0xv5y.adtyai-fz.top/pricing

Keep /v1 and wire_api = "responses"

Unlike Claude Code, Codex CLI expects /v1 in base_url (https://api.zwwbai.com/v1) and communicates via the OpenAI Responses protocol (wire_api = "responses"). Omitting /v1 or setting wire_api = "chat" causes endpoint or schema errors.

Step 2: Preview Generated config.toml and auth.json ​

CC Switch manages both Codex configuration files together. Before saving, review the generated content in CC Switch's preview pane.

~/.codex/config.toml ​

toml
model_provider = "gateway"
model = "gpt-5.4"
model_reasoning_effort = "high"

[model_providers.gateway]
name = "RKAPI"
base_url = "https://api.zwwbai.com/v1"
wire_api = "responses"
requires_openai_auth = true

~/.codex/auth.json ​

json
{
  "OPENAI_API_KEY": "sk-your-api-key"
}

File locations written by CC Switch:

  • macOS / Linux: ~/.codex/config.toml and ~/.codex/auth.json
  • Windows: %USERPROFILE%\.codex\config.toml and %USERPROFILE%\.codex\auth.json

Choosing a Model

Always verify exact model names available to your API key group on https://s2pbxm0xv5y.adtyai-fz.top/pricing. You can also create multiple CC Switch profiles—for example, one pinned to a flagship reasoning model and another pinned to a faster model—and toggle between them in one click.

Step 3: Activate the Profile ​

  1. Click Save in CC Switch.
  2. Select the RKAPI profile under the Codex tab and click Enable / Switch.
  3. Verify the files on disk:

macOS / Linux:

bash
cat ~/.codex/config.toml

Windows PowerShell:

powershell
Get-Content "$env:USERPROFILE\.codex\config.toml"

Step 4: Verify Codex CLI in Terminal ​

Open a new terminal in your repository and launch Codex CLI:

bash
codex

Or run a quick non-interactive smoke test:

bash
codex exec "Reply with OK and confirm the current directory name."

If everything is configured properly:

Common Issues ​

SymptomLikely CauseFix
401 UnauthorizedWrong key, expired key, or an old OPENAI_API_KEY env var overriding auth.jsonClear shell OPENAI_API_KEY and re-activate your profile in CC Switch
403 ForbiddenEntered https://s2pbxm0xv5y.adtyai-fz.top/v1 instead of https://api.zwwbai.com/v1Switch base_url to the dedicated API domain https://api.zwwbai.com/v1
404 Not FoundMissing /v1 suffix in base_urlSet base_url = "https://api.zwwbai.com/v1"
Model not found / group mismatchSelected model is not enabled in the key's groupConfirm the model ID on https://s2pbxm0xv5y.adtyai-fz.top/pricing

For deeper troubleshooting—including reasoning-effort tuning and WSL path quirks—see the Codex FAQ. If you also use the graphical Codex client, continue to Codex Desktop App.