Skip to main content

Prerequisites

Before you begin, prepare:
  1. A ToAPIs API key from the ToAPIs Console.
  2. Codex CLI, installed from the official Codex documentation or with:
  3. CC Switch, downloaded only from ccswitch.io or the official GitHub Releases.

Add ToAPIs in CC Switch

  1. Open CC Switch and select Codex in the application switcher.
  2. Click + and choose App-specific provider.
  3. Select the Custom preset and enter:
  1. Click Add, then click Enable on the ToAPIs provider card.
  2. Exit any running Codex session and reopen the terminal so the new configuration is loaded.
ToAPIs natively supports POST /v1/responses. Do not enable local routing/model mapping; that option is intended for providers that only expose Chat Completions.

Start and Verify

Send a simple task, for example:
If Codex responds normally, the setup is complete.

Change the Model

Edit the ToAPIs provider to use another Responses-compatible model available to your account. CC Switch can fetch models from /v1/models; you can also review the ToAPIs model list. Common choices: Availability depends on your account and channel configuration. Prefer the /v1/models list fetched by CC Switch.

Troubleshooting

Codex still uses the previous provider

Codex does not hot-reload provider configuration. Fully exit Codex, reopen the terminal, and run codex again.

401 Unauthorized

  • Confirm the API key in CC Switch is complete
  • Verify that the key is active in the ToAPIs Console
  • Ensure the account has sufficient balance

404 or an incorrect Responses path

Confirm the Base URL is https://toapis.com/v1, the protocol is Responses, and local routing/model mapping is disabled.

Model unavailable

Use CC Switch’s model-fetch button or call GET https://toapis.com/v1/models with the same API key.

Configuration and Key Safety

CC Switch manages ~/.codex/auth.json and ~/.codex/config.toml. Do not commit these files, your API key, or screenshots containing the key to Git. See the official CC Switch user manual for additional provider-management instructions.