CC-Switch Codex
This page talks about managing Codex Providers through CC Switch. It is not the same as direct configuration with the Codex client or Codex CLI: the focus here is to first maintain the providers in CC Switch, and then apply them to Codex.
Official information Downloads and documentation are subject to the official site.
What this page explains
Codex usually operates through OpenAI or OpenAI-compatible interfaces, so focus on checking three items: Base URL, Key, and model name. Whether the Base URL needs to include /v1depends on what is displayed in the provider's backend.
Confirmation before starting
| Things to confirm | How to view | Why |
|---|---|---|
| Codex can open normally | First, confirm that the Codex CLI or the corresponding client itself can run | CC Switch does not install Codex for you |
| The provider supports OpenAI-compatible interfaces | The backend can show API address, Base URL, OpenAI compatibility, and other instructions | Codex needs to be able to request the compatible interface |
| The model can be used in Codex scenarios | The available model name can be seen in the backend model list | Do not put Claude/Gemini model names into Codex |
| Key status is normal | The backend token is not expired, not disabled, and the balance is normal | Most 401 errors should start by checking the Key |
How to fill in the fields
| Setting | Filling Method | Attention Beginners |
|---|---|---|
| Provider Name | Write the provider's name or usage | For example, 'Main OpenAI-compatible provider' |
| Target Tool / Preset | Select Codex or OpenAI/Codex-related presets | Do not select Claude Code or Gemini |
| Base URL | Copy the API link provided by the provider's backend | Generally, it is the API address provided by the provider; whether to include /v1 follow the backend example |
| API Key | Copy the complete key | Do not add extra spaces before or after, do not copy it as a note name |
| Model Name | Copy the backend model list exactly | If obtaining the model list fails, manually add it, still copying the backend name exactly |
Apply to Codex
- Open CC Switch and go to the Provider management area.
- Add a new provider, or choose an existing OpenAI-compatible provider.
- Select Codex or OpenAI/Codex-related presets as the target tool.
- Fill in the Base URL, API Key, and model name, and save.
- Execute Apply / Switch to apply this Provider to Codex.
- Close the current terminal window and reopen it, then test again.
Test whether it works
First test the request with the shortest question to see if it can go through. After the test is successful, proceed to use it in the real project.
Codex Minimal Test
codex "Please reply only: CC-Switch Codex is active" If the returned model does not exist, first check the model name; if the return is unauthorized, first check the Key; if the connection times out, first check the Base URL and the network.
