Prerequisites
Before you begin, prepare:- A ToAPIs API key from the ToAPIs Console.
-
Codex CLI, installed from the official Codex documentation or with:
- CC Switch, downloaded only from ccswitch.io or the official GitHub Releases.
Add ToAPIs in CC Switch
- Open CC Switch and select Codex in the application switcher.
- Click + and choose App-specific provider.
- Select the Custom preset and enter:
- Click Add, then click Enable on the ToAPIs provider card.
- 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
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 runcodex 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 callGET 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.