How to Connect Codex to MiniMax
Article Overview: If you've been searching for the latest, most stable way to connect Codex to the MiniMax large language model, this guide gives you complete step-by-step instructions. We'll explain in detail how to use CC Switch's Local Routing feature to seamlessly connect MiniMax models to the Codex CLI. Whether you need to solve protocol conversion between interface formats, or want to manage your API Key securely and centrally, this CC Switch-based local routing walkthrough helps you finish the setup quickly and boost your development efficiency.
📖 Table of Contents
- Prerequisites: Environment & Tools
- Step 1: Add the Codex Provider in CC Switch
- Step 2: Enable Local Routing and Take Over Codex
- Step 3: Switch Providers and Restart Codex
- Advanced: Configuring Other Chat-Format LLM Providers
- Troubleshooting (FAQ)
Prerequisites: Environment & Tools
Before connecting Codex to MiniMax models, make sure your local development environment meets the following prerequisites (for best compatibility, we recommend CC Switch 3.16.0 or later):
- CC Switch client: installed properly and launching normally.
- Codex CLI environment: installed and run at least once locally, so that the
~/.codex/config.tomldirectory and config file have been auto-generated on your machine. - API credentials ready: an official, valid API Key obtained from the MiniMax open platform.
Step 1: Add the Codex Provider in CC Switch
For the Codex CLI to correctly recognize and call MiniMax models, we first need to bind the provider in the CC Switch console.


- Open your CC Switch client, look to the top, and switch to the dedicated Codex tab.
- Click the "+" button in the top-right corner to add a new API provider.

- In the built-in preset list that pops up, search for and select MiniMax. Thanks to CC Switch's presets, you only need to complete these two simple steps:

- Enter the MiniMax API Key you obtained from the official source.
- Click the Save Provider button at the bottom.

💡 Pro tip: CC Switch's powerful preset mechanism already includes MiniMax's official request URL, default preferred models, model list menu and advanced thinking/reasoning parameters. This greatly simplifies the tedious steps of connecting Codex to MiniMax — no need to manually look up API docs to match fields.
Step 2: Enable Local Routing and Take Over Codex

Since mainstream LLMs like MiniMax typically use an OpenAI-style Chat interface standard, we need CC Switch's Local Routing feature to perform the underlying protocol conversion for Codex compatibility.
When you click the MiniMax provider you just configured and enable Local Routing, the system shows a smart prompt: "This provider uses the OpenAI Chat interface format and requires the routing service to work properly — please start routing first."
Follow these steps to configure routing takeover and achieve seamless proxying:


- Go to the Routing page in CC Switch settings and expand the Local Routing panel.
- Turn on the routing master switch to start the local mapping service (the default listen address is usually
127.0.0.1:15721). - Enable the Codex-specific takeover: if you only need Codex to use this route, keep the routing switches for other tools like Claude and Gemini off to avoid interference.
🔒 Key security benefit: after routing takeover is complete, CC Switch points Codex's live config file directly at your local secure routing service and manages authentication with virtual placeholders. Your real MiniMax API Key is stored encrypted in CC Switch's local config and is only auto-injected over the internal network when forwarding requests. This completely eliminates the security risk of exposing your API Key in plaintext in the Codex config file.
Step 3: Switch Providers and Restart Codex
Go back to the Codex provider list, click the MiniMax provider you carefully configured, and decisively select Enable. (Note: if you see a "routing required" warning badge on the interface, it means this provider only works while the routing service is running. If routing is accidentally shut down, CC Switch will show a friendly pop-up warning and block it.)
⚠️ Critical pitfall to avoid: after switching, we strongly recommend restarting your current Codex session immediately!
Here's why you must restart:
- Refresh the model list cache: without a restart, Codex may cling to stale cached data, so the model menu won't refresh and still shows the old provider's model list.
- Reload the JSON catalog: CC Switch generates the latest
model_catalog_jsonfile, and Codex's/modelmenu usually needs a brand-new process to read and reload it.

After restarting and re-entering Codex, you can type the /model command. You should now clearly see the active model has switched to the MiniMax preset you need (for example, the powerful MiniMax 2.7 series models).
Advanced: Configuring Other Chat-Format LLM Providers
Once you've mastered connecting Codex to MiniMax, you can easily apply the same approach elsewhere. Popular domestic AI models (like Kimi, DeepSeek, SiliconFlow, etc.) are also fully supported for quick setup in CC Switch:
- Prefer built-in presets: CC Switch ships continuously updated presets for all common Chat-format providers — one click and you're done.
- Custom flexible configuration: you only need to choose "custom configuration" when the preset list doesn't have the niche provider you're hunting for. In that case, fill in the API Key, Base URL and available models according to the official API docs. **IMPORTANT: set "API format" to
OpenAI Chat Completions (需开启路由)**. - Native direct-connect mode: if your upstream API provider natively supports the
OpenAI Responses APIprotocol, you don't need to enable local routing at all. CC Switch can connect directly through the Responses protocol, avoiding the performance overhead of Chat conversion.
Troubleshooting (FAQ)
To help you quickly pinpoint problems when you hit a wall, we've put together the following guide to the most common errors, based on the search habits of developers on search engines like Bing and Google:
1. After connecting, Codex reports a 404 error, or says it can't find the /responses path — what do I do?
- Likely cause: in most cases, you didn't properly enable the Codex routing takeover switch in CC Switch, or you previously hardcoded the upstream provider's Chat base URL into Codex's
config.tomlconfig file. - Solution: open Codex and check the
~/.codex/config.tomlfile. Make sure its interface address has been taken over by CC Switch and points to the local routing service (e.g.[http://127.0.0.1:15721/v1](http://127.0.0.1:15721/v1)).
2. When connecting to MiniMax, the upstream interface keeps returning 404 errors?
- Likely cause: if you're using the built-in MiniMax preset, verify that the provider is indeed an official preset and that the Codex local routing service shows as successfully enabled.
- Solution: if you connected manually using "custom provider" mode, carefully check how you filled in the Base URL. It must be the root address (Host) of the API service, and should never include a full API path suffix like
/chat/completions.
3. After typing /model in Codex, I can't see MiniMax models in the menu?
- Solution: after saving the provider config in CC Switch, you must restart the Codex process. Although CC Switch auto-generates
cc-switch-model-catalog.jsonin the background within milliseconds, the running Codex session doesn't support hot-reloading the model catalog — you need to start a new process to force a refresh.
4. Local routing is clearly on, but API requests still go to the old provider?
- Solution: carefully verify that all three of the following states match:
- On the Codex tab in CC Switch, the currently highlighted provider is clearly MiniMax.
- The "local routing service" indicator in CC Switch's settings panel shows green, indicating it's running.
- In the "routing enabled" settings, Codex's dedicated switch is toggled On.
5. Can I use an official native OpenAI Codex account with local routing?
- Recommendation: strongly not recommended. In local routing takeover mode, CC Switch actively blocks switching to the official OpenAI provider as a safety mechanism. Accessing the official native API through a local proxy or protocol conversion can easily trigger OpenAI's strict risk controls and lead to account bans. CC Switch's local routing is designed primarily for third-party domestic LLMs, aggregator API platforms, or scenarios needing protocol conversion (like MiniMax in this article).
