你是不是也刷到了 Codex 的演示视频,看着别人一句指令就能自动生成代码、修 Bug、写测试,馋得不行?
结果打开官网一看——需要 ChatGPT Plus 订阅,每月 20 刀起步。
别急,今天教你一招:不用 OpenAI 账号,不用花一分钱订阅费,照样跑起 Codex 桌面版。
秘密武器就是:配置第三方模型。
什么是 Codex?
先简单科普一下。Codex 是 OpenAI 官方出品的AI 编程 Agent,它可以:
- 🔧 自动写代码:你说需求,它帮你实现
- 🐛 自动修 Bug:报错信息丢给它,它自己定位并修复
- 🧪 自动写测试:帮你补全单元测试
- 📂 操作整个项目:读文件、改文件、跑命令,全自动
以前这些只能在网页端用,现在 OpenAI 推出了桌面客户端,体验更丝滑。
但问题来了——默认只能用 OpenAI 自己的模型,而这些模型需要付费订阅。
好消息是:Codex 支持自定义模型提供商,也就是说,你可以接入任何兼容 OpenAI API 格式的第三方模型。
准备工作
第一步:下载 Codex 桌面客户端
前往官方下载页面:
👉 https://openai.com/codex/
支持 Windows / macOS / Linux 三端,下载安装即可。
第二步:获取第三方模型的 API Key
这里以 MiMo 模型(小米大模型团队出品) 为例。
MiMo 目前提供了兼容 OpenAI 格式的 API 接口,注册后即可获取 Key。当然,你也可以选择 DeepSeek、通义千问、Moonshot 等任何兼容 OpenAI API 格式的模型服务商——配置方式完全一样,只是换一下地址和 Key。
核心配置:一文搞定
安装好 Codex 客户端后,你需要编辑一个配置文件。
配置文件位置
| 系统 | 路径 |
|---|---|
| Windows | C:\Users\你的用户名\.codex\config.toml |
| macOS / Linux | ~/.codex/config.toml |
💡 如果
.codex文件夹或config.toml文件不存在,手动新建即可。
配置内容
用任意文本编辑器(记事本、VS Code 都行)打开 config.toml,粘贴以下内容:
``toml
web_search = 「disabled」 # 暂时禁用网页搜索(mimo 暂不支持) model_provider = 「mimo」 # 指定模型提供商名称 model = 「mimo-v2.5-pro」 # 指定具体模型 model_reasoning_effort = 「max」 # 推理强度拉满 disable_response_storage = true # 禁用响应存储(保护隐私) preferred_auth_method = 「你的 API_KEY」 # 替换成你的 Key
============ 模型提供商配置 ============
[model_providers.mimo] name = 「mimo」 base_url = 「https://token-plan-cn.xiaomimimo.com/v1」 # MiMo 的 API 地址 wire_api = 「responses」 # 使用 responses 协议 ``
⚠️ 注意:把 preferred_auth_method = 「你的 API_KEY」 替换成你实际的 API Key!
配置完成后
重启 Codex 客户端,就能正常对话了!
效果展示
配置完成后,打开 Codex,你会看到模型已经切换为你配置的第三方模型:
Codex 界面显示已切换为 mimo 模型
界面和官方模型体验一致,该有的功能一个不少。
对了,安装到这里,你会发现插件商城里啥也没有,这时候你不用上网查了,你只需要告诉它,“我的插件商城没有插件”,然后codex会自动修复的。
进阶:如何接入其他模型?
上面用的是 MiMo,但你可以用任何兼容 OpenAI API 格式的模型。只需改三个地方:
接入 DeepSeek
``toml model_provider = 「deepseek」 model = 「deepseek-chat」 preferred_auth_method = 「你的 DeepSeek_API_KEY」
[model_providers.deepseek] name = 「deepseek」 base_url = 「https://api.deepseek.com/v1」 wire_api = 「responses」 ``
接入通义千问(阿里云)
``toml model_provider = 「qwen」 model = 「qwen-plus」 preferred_auth_method = 「你的通义千问_API_KEY」
[model_providers.qwen] name = 「qwen」 base_url = 「https://dashscope.aliyuncs.com/compatible-mode/v1」 wire_api = 「responses」 ``
接入 Moonshot(月之暗面)
``toml model_provider = 「moonshot」 model = 「moonshot-v1-128k」 preferred_auth_method = 「你的 Moonshot_API_KEY」
[model_providers.moonshot] name = 「moonshot」 base_url = 「https://api.moonshot.cn/v1」 wire_api = 「responses」 ``
配置规律总结:
model_provider— 随便起个名字,和下面[model_providers.xxx]的xxx对应model— 填该服务商的具体模型名称base_url— 填该服务商的 API 地址(通常在官方文档里找)preferred_auth_method— 填你的 API Keywire_api— 一般都填「responses」,兼容性最好
常见问题
Q:配置完重启没反应? A:检查 config.toml 路径是否正确,文件名是否写对(是 config.toml 不是 config.toml.txt)。
Q:报错说 API Key 无效? A:确认 Key 没有多余空格或换行,确认 Key 对应的服务商和 base_url 匹配。
Q:wire_api 填什么? A:大部分兼容 OpenAI 格式的服务商填 「responses」 即可。如果报错,试试改成 「chat」。
Q:可以用免费额度吗? A:取决于服务商。MiMo、DeepSeek 等通常有免费额度或低价套餐,比 ChatGPT Plus 便宜得多。
总结
| 对比项 | 官方方案 | 本文方案 |
|---|---|---|
| 费用 | ChatGPT Plus /月起 | 第三方 API 按量付费,几毛到几块 |
| 门槛 | 需要海外支付 | 国内服务商直接注册 |
| 模型选择 | 仅限 OpenAI 模型 | 任意兼容模型 |
| 体验 | 官方原生 | 基本一致 |
花最少的钱,用最强的 AI 编程工具。
赶紧去试试吧,有问题评论区见 👇
觉得有用?点个关注,持续获取 AI 编程干货 🔥
Did you also see Codex's demo video, watching someone generate code, fix bugs, and write tests with a single command, and feel super tempted?
But then you open the official website and see—you need a ChatGPT Plus subscription, starting at $20 per month.
Don't worry, today I'll teach you a trick: no OpenAI account, no subscription fees at all, you can still run Codex desktop.
The secret weapon is: configuring a third-party model.
What is Codex?
First, a brief introduction. Codex is an AI programming Agent officially produced by OpenAI. It can:
🔧 Automatically write code: you describe what you need, it implements it for you
🐛 Automatically fix bugs: throw the error message at it, it locates and fixes the issue itself
🧪 Automatically write tests: helps you fill in unit tests
📂 Operate on the entire project: read files, modify files, run commands—all fully automatic
Previously, these were only available on the web. Now OpenAI has released a desktop client, and the experience is smoother.
But here's the problem—by default, it can only use OpenAI's own models, and those require a paid subscription.
The good news is: Codex supports custom model providers, meaning you can connect any third-party model that is compatible with the OpenAI API format.
Preparation
Step 1: Download the Codex desktop client
Go to the official download page:
👉 https://openai.com/codex/
It supports Windows / macOS / Linux. Just download and install it.
Step 2: Get an API Key from a third-party model
Here we use the MiMo model (from Xiaomi's large model team) as an example.
MiMo currently provides an API interface compatible with the OpenAI format. You can get a Key after registering. Of course, you can also choose DeepSeek, Tongyi Qianwen, Moonshot, or any other model provider compatible with the OpenAI API format—the configuration method is exactly the same, just change the address and Key.
Core configuration: everything in one article
After installing the Codex client, you need to edit a configuration file.
Configuration file location
💡 If the .codex folder or config.toml file does not exist, just create them manually.
Configuration content
Open config.toml with any text editor (Notepad, VS Code, etc.) and paste the following:
```toml
web_search = "disabled" # Temporarily disable web search (not supported by mimo yet) model_provider = "mimo" # Specify the model provider name model = "mimo-v2.5-pro" # Specify the specific model model_reasoning_effort = "max" # Set reasoning effort to maximum disable_response_storage = true # Disable response storage (protect privacy) preferred_auth_method = "YOUR_API_KEY" # Replace with your Key
============ Model provider configuration ============
[model_providers.mimo] name = 「mimo」 base_url = 「https://token-plan-cn.xiaomimimo.com/v1」 # MiMo API address wire_api = 「responses」 # Use responses protocol ``
⚠️ Note: Replace preferred_auth_method = 「your API_KEY」 with your actual API Key!
After configuration is complete,
restart the Codex client, and you can chat normally!
Result demonstration
After configuration, open Codex, and you will see the model has switched to the third-party model you configured:
The Codex interface shows it has switched to the mimo model.
The interface matches the official model experience, with every expected feature included.
By the way, at this point, you'll find that the plugin marketplace has nothing. You don't need to search online; just tell it, "My plugin marketplace has no plugins," and Codex will automatically fix it.
Advanced: How to connect other models?
The above uses MiMo, but you can use any model compatible with the OpenAI API format. Just change three things:
Connect DeepSeek
``toml model_provider = 「deepseek」 model = 「deepseek-chat」 preferred_auth_method = 「your DeepSeek_API_KEY」
[model_providers.deepseek] name = 「deepseek」 base_url = 「https://api.deepseek.com/v1」 wire_api = 「responses」 ``
Connect Tongyi Qianwen (Alibaba Cloud)
``toml model_provider = 「qwen」 model = 「qwen-plus」 preferred_auth_method = 「your Tongyi Qianwen_API_KEY」
[model_providers.qwen] name = 「qwen」 base_url = 「https://dashscope.aliyuncs.com/compatible-mode/v1」 wire_api = 「responses」 ``
Connect Moonshot (Dark Side of the Moon)
``toml model_provider = 「moonshot」 model = 「moonshot-v1-128k」 preferred_auth_method = 「your Moonshot_API_KEY」
[model_providers.moonshot] name = 「moonshot」 base_url = 「https://api.moonshot.cn/v1」 wire_api = 「responses」 ``
Summary of configuration patterns:
model_provider — give it any name, corresponding to the xxx in [model_providers.xxx] below.
model — fill in the specific model name of that provider.
base_url — fill in the provider's API address (usually found in official docs).
preferred_auth_method — fill in your API Key.
wire_api — generally fill in 「responses」, best compatibility.
FAQ
Q: No response after restarting after configuration? A: Check whether the config.toml path is correct and the file name is correct (it's config.toml, not config.toml.txt).
Q: The error says the API Key is invalid? A: Make sure the Key has no extra spaces or line breaks, and verify that the Key's provider matches the base_url.
Q: What should I fill in for wire_api? A: For most providers compatible with the OpenAI format, just fill in "responses". If you get an error, try changing it to "chat".
Q: Can I use the free quota? A: It depends on the provider. MiMo, DeepSeek, and others usually have free quotas or low-cost plans, which are much cheaper than ChatGPT Plus.
Summary
Spend the least money and use the most powerful AI coding tool.
Go try it now—if you have any questions, leave them in the comments 👇
Found it useful? Follow us to keep getting AI coding tips 🔥

