Setting it up is actually very simple. I recommend using CC Switch, an open-source configuration management tool that lets you switch Codex model providers with one click. Below, I’ll walk you through setting it up step by step using GLM-5.2 and DeepSeek as examples.Article author and source: Jiguang
OpenAI has released an official guide showing you how to replace the underlying "brain" of their Codex client with other third-party models or free open-source models.
You didn't misread
OpenAI, the company that tightly hides the technical details of GPT-4, the one mocked online for having "Open" in its name but being anything but open, is now voluntarily telling you: here, let me teach you how to avoid using my models.
I thought about it, but I still don’t understand.
First, let’s talk about what Codex is. It’s a suite of coding assistant tools recently launched by OpenAI, including a desktop app, a command-line interface (CLI), and a developer SDK—all rewritten in Rust, open-source, and licensed under Apache-2.0. You can think of it as OpenAI’s version of Claude Code, or the command-line counterpart to Cursor.
Here comes the key point.
This tool supports a command-line parameter called --oss. When you use this parameter, Codex will not call the OpenAI API but instead connect to your third-party model or locally running open-source model—use whatever you like, such as GLM-5.2, DeepSeek, Ollama, or LM Studio. It can work with any model that runs locally or is provided by a third party, meaning it’s not limited to OpenAI’s own models.
Moreover, OpenAI doesn't secretly support this feature—they specifically wrote a detailed document explaining how to configure a local provider, how to adjust the config.toml file, and how to make Codex call your own endpoint.
Document address:https://developers.openai.com/codex/config-advanced#oss-mode-local-providers
It's like McDonald's issuing an official guide on how to replace their burger buns with whole wheat bread from the bakery next door.
I've been working on AI-related content for three years and have seen many of OpenAI's moves, but this is the first time I truly feel that the times have changed.
To understand the weight of this matter, you need to look back at what OpenAI has accomplished over the past few years.
In 2020, when GPT-3 was released, many researchers expected OpenAI to open-source the model weights, as it had done in the past—after all, the company is called OpenAI, with “open” right in its name. But OpenAI responded that the model was too powerful to release publicly and could only be accessed via API.
At the time, some in the community began joking that the company should be renamed ClosedAI.
In 2023, GPT-4 was released. This time, even the technical report was shortened. While GPT-3’s paper detailed the number of layers and the amount of data used, GPT-4’s technical report simply stated, “Due to competitive and safety considerations, we are not disclosing any architectural details.”
At the time, Sam Altman was asked this question, and his response was essentially that we believe disclosing this information now would not be a responsible approach.
Since then, OpenAI has become synonymous with "closed." Want to know how GPT-4 was trained? Not telling you. Want to know what data was used? Not telling you. Want to run an OpenAI model on your own device? Impossible.
Meanwhile, Meta has been aggressively open-sourcing on the other side, continuously releasing Llama models with full weights, detailed papers, and encouraging the community to modify them however they like. DeepSeek has done the same from the start, releasing model weights under the MIT license and inviting developers worldwide to experiment.
During those years, the AI community had a clear division into two camps: one side consisted of OpenAI, Anthropic, and others pursuing a closed-source API model, while the other side included Meta, Mistral, DeepSeek, and others embracing an open-source approach. The two sides operated independently, with entirely different business models.
Then now, in 2026, OpenAI suddenly says, "Here, let me teach you how to use open-source models."
This shift is too big. My own feeling is that this isn't about OpenAI suddenly seeing the light, but rather that the competitive logic of the entire industry has changed.
Over the past few years, what AI companies competed over was model capability. Whoever had a smarter, faster, and cheaper model won. That’s why closed-source made sense—I worked hard to train this model; why should I show it to you?
But things are different now. Model capabilities are rapidly converging. Look at the current benchmark rankings—the top models all score very similarly. GPT-5.5 is powerful, but Claude Opus is just as strong, Gemini is also competitive, and open-source models like GLM-5.2 and DeepSeek are quickly catching up. Simply comparing model capabilities no longer creates decisive gaps.
The focus of competition is shifting from "models" to "ecosystems".
Whoever makes developers happy and integrates into their workflow will win.
OpenAI is well aware of this. So what they are doing now is not clinging solely to the model as a moat, but rather pushing out the Codex toolchain. It doesn’t matter which model you use—as long as you use my client, my CLI, or my SDK, you’re within my ecosystem.
Once you get used to it and your workflow is fully integrated with this set of tools, you’ll likely still choose OpenAI’s models because they’re the default option, offer the smoothest experience, and save you the hassle of switching.
This strategy isn’t new. Microsoft did exactly the same thing back then—by making Windows open to all hardware manufacturers, it ended up dominating the entire PC ecosystem. Google’s Android did the same—by open-sourcing it for all phone manufacturers, Android now holds 70% of the global smartphone market.
OpenAI is now doing something similar. And frankly, this is good for the entire industry.
Previously, developers had to choose: either a powerful proprietary tool with limited flexibility, or a highly customizable open-source solution that required heavy self-management. Now, OpenAI says you can have both: use my toolchain for an excellent experience, and keep your own model for maximum flexibility.
This will force other companies to keep up. If you don’t open up? Fine, developers will use OpenAI’s tools instead.
The benefits of competition will ultimately reach developers.
Sometimes I feel that the AI industry is changing too quickly.
In 2023, people were debating whether OpenAI would remain closed forever and become the next "evil empire." In 2024, due to the pricing and capabilities of GPT-4o, many believed OpenAI was poised to dominate the market. By the end of 2024, DeepSeek V3 emerged, sparking a surge in open-source community momentum, leading many to conclude that closed-source models were no longer viable.
Then in 2026, OpenAI suddenly pulled this move.
There is no permanent closure, and no permanent openness. Only perpetual competition and constant change.
Returning to the matter at hand, if you're a developer, you can try Codex's OSS model right now.
Setting it up is actually very simple. I recommend using CC Switch, an open-source configuration management tool that lets you switch Codex model providers with one click. Below, I’ll walk you through setting it up step by step using GLM-5.2 and DeepSeek as examples.
Step 1: Download and install CC Switch
Download the latest version from GitHub athttps://github.com/farion1231/cc-switch/releases/latest.
Scroll to the bottom to download the corresponding desktop version.
macOS users can install directly using Homebrew:
brew install --cask cc-switch
Windows and Linux users can download the corresponding installer and proceed with the default settings.
Step 2: Get your API Key
You need to obtain an API key from the model provider first.
If you'd like to use DeepSeek, go tohttps://www.deepseek.com/to register an account and create an API Key in the Open Platform. DeepSeek’s API is extremely affordable—just 1 yuan per million input tokens for V4 Pro, making it virtually free for individual developers.
If you want to use GLM-5.2, visit the Zhipu Open Platformhttps://open.bigmodel.cn/to register, and create an API Key in the console. GLM-5.2 has just been open-sourced, and its API is being rolled out gradually.
Step 3: Add a supplier in CC Switch
Open CC Switch, switch to OpenAI, and click the “Add” button in the top-right corner.
Here’s a convenient feature: CC Switch comes with pre-configured settings for major providers. Simply type “DeepSeek” or “ZhiPu” into the search box.
GLM», directly select the corresponding preset.
Using DeepSeek as an example, after selecting the preset, you only need to enter your API Key in the form—leave all other fields at their default settings.
Note a detail: if you want to use DeepSeek V4’s million-token context version, the model name must be written as deepseek-v4-pro[1m]—this [1m] is DeepSeek’s special syntax to activate the 1-million-token long context window. Don’t miss it.
The configuration for GLM-5.2 is the same: select the "ZhiPu GLM" preset, enter your API Key, and set the model name to glm-5.2, then save.
Step 4: Enable local routing
This step is crucial.
Click the gear icon in the top-left corner of the CC Switch to access settings, go to the "Routing" tab, and turn on the local routing switch.
Why open this? Because Codex uses OpenAI's Responses API protocol, while domestic providers like DeepSeek and Zhipu offer Chat.
The Completions interface uses different protocols on each side. CC Switch performs a translation layer in the middle, allowing Codex to continue communicating using its familiar protocol, while CC Switch handles translating the request into a format DeepSeek can understand and then translating the response back.
After enabling, CC Switch will start a local proxy service at http://127.0.0.1:15721/v1. The entire process is completely transparent to Codex, which believes it is still communicating with OpenAI, while the requests are actually forwarded to the model you specified.
Step 5: Enable the vendor
Return to the CC Switch main interface, locate the DeepSeek or GLM-5.2 you just configured in the vendor list, and click to enable it.
CC Switch will automatically write the configuration to ~/.codex/config.toml; you don’t need to manually modify any files.
After enabling, it is recommended to click the "Health Check" button next to the supplier; CC Switch will send a test request to verify that your API key and network connectivity are functioning properly. Ensure your account has funds when registering for the first time.
Step 6: Restart Codex
There’s a small catch: Codex doesn’t support hot-swapping like Claude Code. After switching providers, you need to close the current terminal, open a new one, and then restart Codex.
After launching, use the /model deepseek-v4-pro command to confirm whether the current model is the one you just configured. If it displays DeepSeek V4 or GLM-5.2, the configuration was successful.
After use, please check your usage on the DeepSeek official website.
Switch to the /model deepseek-v4-flash model
How do I switch in the future?
It will be simple to switch to other models in the future—just switch to another provider in CC Switch.
For example, today you might want to use DeepSeek to save money on coding, tomorrow you might want to try GLM-5.2 to test the performance of China’s top open-source model, and the day after that, switch back to OpenAI’s GPT-5.5 for complex tasks—all with just one click.
Honestly, with this combo, you get the seamless experience of the Codex toolchain while freely choosing any model you like—OpenAI’s, domestic ones, open-source, it’s all up to you.
This is what “open” should really look like.
My own feeling is that the industry is entering a new phase.
The model war has subsided; the ecosystem war has just begun.
Whoever makes developers happy is the winner.
