How to Maximize OpenAI’s Codex

How to Maximize OpenAI’s Codex

如何最大化利用 OpenAI 的 Codex

In this article, I’ll discuss how to get the most out of OpenAI’s Codex Coding Agent. 在本文中,我将探讨如何充分利用 OpenAI 的 Codex 编程助手。

I’ve written a lot of previous articles about Anthropic’s Claude Code, and how I use it for programming, and different techniques that I apply to make it more effective. However, the last two weeks I’ve been experimenting more and more with OpenAI’s Codex and seeing vastly improved results compared to Codex a few months ago. 我之前写过很多关于 Anthropic Claude Code 的文章,介绍了我是如何将其用于编程,以及我为了提高其效率所采用的各种技巧。然而,在过去的两周里,我一直在深入尝试 OpenAI 的 Codex,并发现其表现相比几个月前有了显著提升。

In my opinion, Codex is equally good on a lot of tasks and has the advantage that it’s, in many cases, faster than Claude Code and that it’s better at doing exactly what it’s asked to do and not performing other tasks (which is the problem I’ve experienced with Claude Code). 在我看来,Codex 在许多任务上的表现同样出色,且具备一个优势:在很多情况下,它比 Claude Code 更快,并且更擅长精准执行指令,而不会擅自执行其他任务(这正是我在使用 Claude Code 时遇到的问题)。

In this article, I’ll be discussing my experience using OpenAI’s Codex for advanced coding tasks and other application areas, as well as some techniques that I use to enhance Codex’s performance. This infographic highlights the main contents of this article. I’ll discuss OpenAI’s Codex coding model: why you should use it, my current setup with the techniques that I use to get the most out of the model, and I’ll do a comparison of OpenAI’s Codex model versus Anthropic’s Claude Code model. 在本文中,我将讨论我使用 OpenAI Codex 处理高级编程任务及其他应用领域的经验,以及我用来提升 Codex 性能的一些技巧。这张信息图突出了本文的主要内容。我将探讨 OpenAI 的 Codex 编程模型:为什么要使用它,我目前的配置以及我用来最大化模型效能的技巧,并对 OpenAI 的 Codex 模型与 Anthropic 的 Claude Code 模型进行对比。

Why use OpenAI Codex?

为什么要使用 OpenAI Codex?

First of all, I want to cover why you should be using OpenAI Codex. It’s worth mentioning that the pricing of Codex for the 20x Max subscription is the same as Claude Code. The only differentiator is the quality of the outputs produced by the model and how efficiently it can complete tasks. 首先,我想谈谈为什么要使用 OpenAI Codex。值得一提的是,Codex 的 20x Max 订阅价格与 Claude Code 相同。唯一的区别在于模型输出的质量以及完成任务的效率。

Considering I program every single day, it’s important for me to stay up-to-date with the latest coding models and consistently try out new and upcoming models, such as GPT-5.5, to see if it works better than my current setup. I just started using Codex with GPT-5.5 around two weeks ago and simply applied it to some real-world tasks I was working on. This is important, as I believe running coding models on test tasks does not truly test the model’s capabilities, and it’s not a valid and complete test. 考虑到我每天都在编程,紧跟最新的编程模型并不断尝试 GPT-5.5 等新模型,以观察其是否比我当前的配置更好,对我来说非常重要。我大约两周前才开始将 Codex 与 GPT-5.5 结合使用,并将其直接应用于我正在处理的一些实际任务中。这一点很重要,因为我认为在测试任务上运行编程模型并不能真正检验模型的能力,那不是一种有效且完整的测试。

When I used it on some of the more complex tasks I was working on, I was quite impressed by the results. In my opinion, Codex was extremely efficient at completing some tasks and completed them very quickly. Furthermore, I got the impression that Codex was better than Claude Code at performing exactly the tasks I was asking it to do and not changing other stuff in the code. 当我在处理一些更复杂的任务时使用它,其结果令我印象深刻。在我看来,Codex 在完成某些任务时效率极高,且速度非常快。此外,我感觉 Codex 在精准执行我要求的任务、而不擅自改动代码中其他部分方面,表现得比 Claude Code 更好。

Actually, a problem I’ve experienced with Claude Code a few times is that I ask it to complete a specific task, and it mostly completes that task, but it also changes some other things I didn’t want it to change. It’s worth mentioning that this is very much a balance. On one hand, you have Claude Code’s approach, which is to give the model more freedom to make decisions on what should be changed, which can lead to the model changing parts of the code that you don’t intend to change. On the other hand, you have Codex’s approach, which is changing only exactly what the user is asking you to update. This can, on the other hand, have the downside that it leads to bugs all over the code because it’s not updated, simply because Codex just performs exactly what it’s asked to do and nothing else. 事实上,我在使用 Claude Code 时遇到过几次问题:我要求它完成特定任务,它虽然完成了,但同时也改动了我不想让它改动的其他内容。值得一提的是,这很大程度上是一种权衡。一方面,Claude Code 的做法是给予模型更多自主权来决定修改内容,这可能导致模型改动了你本不想修改的代码部分。另一方面,Codex 的做法是仅修改用户明确要求更新的内容。反过来说,这也有一个缺点,即可能导致代码各处出现 Bug,因为其他相关部分没有得到更新——仅仅是因为 Codex 只执行了被要求的任务,而没有做任何额外的工作。

Specific techniques I use to optimize Codex

我用来优化 Codex 的特定技巧

In this section, I’ll cover some specific techniques I use to make Codex perform better than just out of the box. I’ll cover my setup and some techniques. 在本节中,我将介绍一些我用来让 Codex 发挥出超越“开箱即用”水平的特定技巧,包括我的配置和一些方法。

My setup

我的配置

First of all, let’s cover my setup. I do use fast mode on Codex currently because I’m not hitting my limits that often. However, if you are hitting your limits, you should consider turning off FastMode or getting another Codex account. Furthermore, I use extra high thinking when I’m using plan mode and high thinking or reasoning when I’m using normal mode, and I’m using GPT-5.5, of course. 首先,谈谈我的配置。我目前在 Codex 上使用了快速模式(Fast Mode),因为我并不常触及使用上限。然而,如果你经常触及上限,你应该考虑关闭快速模式或获取另一个 Codex 账号。此外,我在使用计划模式(Plan Mode)时会开启“超高思考”(Extra High Thinking),在普通模式下使用“高思考”或“推理”,当然,我使用的是 GPT-5.5。

I’ve also given Codex access to Playwright MCP, which is a way that it can access my browser and perform actions there. This is extremely efficient, for example, for OpenClaw bots, which I’ll cover in the next section, and for actually going into the browser and testing features that Codex has implemented. As I’ve mentioned in multiple previous articles, allowing your coding agents to test their own work vastly improves the performance of these coding models. 我还让 Codex 访问了 Playwright MCP,这使它能够访问我的浏览器并在其中执行操作。这非常高效,例如对于我将在下一节中介绍的 OpenClaw 机器人,以及进入浏览器测试 Codex 所实现的功能都很有帮助。正如我在之前的多篇文章中所提到的,允许编程助手测试自己的工作成果,能极大地提升这些编程模型的性能。

Lastly, I’m also using YOLO mode with Codex, where I give it, or allow it to perform, any action within the folder it’s working in. In my experience, the frontier coding models, such as Claude Code and Codex, are not prone to making severe mistakes such as deleting production databases or similar, and they’ll typically warn you before taking irreversible actions. Furthermore, I also believe that if you set up your codebase and infrastructure correctly, this will not really be an issue. An agent or you, for that matter, shouldn’t have access to permanently delete databases and perform irreversible damage on any infrastructure. That is typically more a sign of poor infrastructure design choices rather than an issue with a programmer or a coding agent. 最后,我也在 Codex 上使用了 YOLO 模式,即我赋予它(或允许它执行)在工作文件夹内的任何操作权限。根据我的经验,Claude Code 和 Codex 等前沿编程模型不容易犯下删除生产数据库之类的严重错误,它们通常会在采取不可逆操作前发出警告。此外,我还认为,如果你正确设置了代码库和基础设施,这根本不会成为问题。无论是代理还是你本人,都不应该拥有永久删除数据库或对任何基础设施造成不可逆损害的权限。这通常更多是基础设施设计不当的迹象,而不是程序员或编程助手的问题。

OpenClaw bots

OpenClaw 机器人

Another use case I have for Codex is that I’m using it for my OpenClaw bots. One of the great advantages of using Codex over Claude Code currently is that you can power your OpenClaw bots with your Codex subscription, which you are not allowed to do with your Claude Code subscription anymore. This is important because, in my opinion, Codex is a frontier-level intelligent model you can use for your OpenClaw bots, which also has acceptable pricing. With this, I mean that Claude Code API pricing simply isn’t applicable for almost all programmers out there, and thus isn’t an option for OpenClaw. Instead, you can buy a $100 or $200 subscription with Codex and have a very intelligent model power your OpenClaw bots. 我使用 Codex 的另一个用例是将其用于我的 OpenClaw 机器人。目前,使用 Codex 相比 Claude Code 的一大优势在于,你可以用 Codex 订阅来驱动你的 OpenClaw 机器人,而 Claude Code 的订阅已不再允许这样做。这一点很重要,因为在我看来,Codex 是一个可用于 OpenClaw 机器人的前沿级智能模型,且价格合理。我的意思是,Claude Code 的 API 定价对于绝大多数程序员来说根本不适用,因此它不是 OpenClaw 的选择。相反,你可以购买 100 美元或 200 美元的 Codex 订阅,并拥有一个非常智能的模型来驱动你的 OpenClaw 机器人。