OpenAI 开源 Codex CLI 终端编程 Agent

与 Claude Code 对打的本机命令行路线

OpenAI 在发布 o3 与 o4-mini 的同时开源 Codex CLI:可在本地终端读仓库、改文件、跑命令的编程 Agent,与云端 Codex 任务队列形成终端与云端双轨。

时间2025 年 4 月 16 日 级别A · 行业级 组织OpenAI 状态已核验 · 2 个来源
编辑插图:终端光标与代码括号构成的抽象命令行
AI Chronicle 原创插图:提示符与括号,对应 Codex CLI 的终端 Agent 定位。 AI Chronicle

2025 年 4 月 16 日,开发者在终端安装 Codex CLI 后,面对的仍是熟悉的仓库和提示符。不同之处在于,一段自然语言任务现在可以让模型读取代码、提出修改并调用本机命令。OpenAI 沿用了 2021 年“Codex”的名字,交付的却不再只是一个会补代码的模型,而是一个能在 shell 里连续工作的 Agent 客户端。

首发版本强调轻量、开源和本地运行,并与 o3、o4-mini 的发布同日出现。它还允许把截图或低保真草图与本地代码一起交给模型,让命令行不再只接收纯文本需求。客户端代码公开,意味着开发者可以检查它怎样构造请求、申请权限和处理命令;模型本身与 API 服务仍掌握在 OpenAI 手中。开放的是执行入口,不是整条能力栈。

真正的新鲜感很快变成权限问题。一个只能解释报错的助手风险有限,一个可以改文件、移动目录、运行测试的 Agent 则进入了开发者的信任域。Codex CLI 通过批准流程与沙箱边界,让用户在只读建议、自动编辑和更高自治之间作选择。每提高一级便利,都意味着更大的错误半径:生成一段坏代码可以撤销,误执行带副作用的命令则可能越过仓库。

这也是终端路线与编辑器、云端沙箱的区别。编辑器擅长把当前文件和光标附近的上下文交给模型;云端 Agent 可以在隔离环境里排队处理任务;CLI 直接继承本机已有的编译器、依赖、日志和身份凭证。它理解项目更快,也更接近真实系统。所谓“本地”并不自动等于私密或安全——模型调用仍会离开机器,命令权限则来自运行它的那个用户。

随后出现的云端 Codex、IDE 扩展与桌面入口,让 OpenAI 的编程 Agent 逐渐形成多条轨道;这些是首发之后的扩展,不应塞回 4 月的第一版。Codex CLI 当天完成的事情更基础:它让 OpenAI 正式进入已经被 Claude Code、Aider 和各类编辑器 Agent 验证过的终端场景。

从那以后,选择编程 Agent 不再只是在比较模型分数。开发者还要决定任务在哪里执行、哪些文件可以读取、哪些命令必须确认、失败后怎样恢复。Codex CLI 最有分量的贡献,恰好出现在模型开口之前:它迫使终端用户先画出一条权限边界。

After installing Codex CLI on April 16, 2025, a developer still saw the familiar repository and shell prompt. The change was that a natural-language task could now lead a model to inspect code, propose edits, and invoke commands on the local machine. OpenAI reused the Codex name from its 2021 coding model, but the new object was no longer only a model that completed code. It was an agent client designed to continue working inside a terminal session.

The initial release stressed that the client was lightweight, open source, and local, and it appeared alongside o3 and o4-mini. It could also combine screenshots or rough interface sketches with the code available on the machine, giving a command-line task more than text as input. Publishing the client let developers inspect how it assembled requests, asked for permission, and handled commands. The models and API service remained controlled by OpenAI. The execution doorway was open; the entire capability stack was not.

Novelty quickly became a permissions question. An assistant that only explains an error has a limited blast radius. An agent that edits files, moves directories, and runs tests occupies the developer’s trust domain. Codex CLI used approvals and sandbox boundaries to let users choose between suggestions, automated edits, and greater autonomy. Each step toward convenience enlarged the consequences of a mistake. Bad generated code could often be reverted; a side-effecting command might travel beyond the repository.

That was also what distinguished the terminal route from an editor or a cloud sandbox. An editor was good at handing the model the active file and nearby context. A cloud agent could queue work in an isolated environment. A CLI inherited the compilers, dependencies, logs, and credentials already present on the machine. It could understand the working project more directly, but it also stood closer to real systems. “Local” did not automatically mean private or safe: model requests still left the machine, while command authority came from the user who launched the process.

Cloud Codex tasks, IDE extensions, and desktop entry points later gave OpenAI’s coding agents several connected surfaces. Those were extensions of the story, not features to insert into the April launch. What Codex CLI accomplished on its first day was more basic. It placed an official OpenAI product in a terminal category already validated by Claude Code, Aider, and a growing collection of editor agents.

After that, choosing a coding agent could no longer be reduced to comparing model scores. Developers also had to decide where the work ran, which files could be read, which commands required confirmation, and how a failed action would be recovered. Codex CLI’s most consequential contribution appeared before the model produced its first line: it made terminal users draw a permission boundary.

展开完整事件档案人物、主题、模型与产品
人物
模型
o3o4-mini
产品
codex-clicodex-agent
来源

原始资料

  1. 01OpenAI debuts Codex CLITechCrunch · report
  2. 02openai/codexOpenAI · official

试试搜索