# OpenAI Codex（AI 智能体）

**OpenAI Codex** 是 OpenAI 开发的一系列 AI 编程智能体，能够自主编写功能、修复缺陷、回答关于代码库的问题、运行测试并提交拉取请求，可在云端、终端、IDE 和桌面环境中运行。它于 2025 年 5 月 16 日以研究预览形式发布，当时是一个基于云端的软件工程智能体，由 codex-1 驱动——这是 [OpenAI o3](https://www.edgepedia.org/zh/openai-o3) 针对软件工程优化的版本——并于 2025 年 10 月 6 日全面开放使用。<sup>[1](https://openai.com/index/introducing-codex/)</sup><sup> • </sup><sup>[2](https://openai.com/index/codex-now-generally-available/)</sup> 该名称不应与 OpenAI 2021 年发布的同名代码补全模型混淆；当前的 [Codex](https://www.edgepedia.org/zh/codex-2021-model) 是一个规划并执行多步骤工程工作的智能体，而非补全模型。

| 关键事实 | 详情 |
|---|---|
| 首次发布 | 云端智能体研究预览，2025 年 5 月 16 日，由 codex-1（针对软件工程优化的 o3）驱动<sup>[1](https://openai.com/index/introducing-codex/)</sup> |
| 训练方法 | 在真实世界编程任务上进行强化学习，产出模仿人类风格和拉取请求偏好的代码，并反复迭代测试直至通过<sup>[3](https://cdn.openai.com/pdf/8df7697b-c1b2-4222-be00-1fd3298f351d/codex_system_card.pdf)</sup> |
| 接入方式 | Codex CLI（开源，Apache-2.0）、ChatGPT 中的 Codex 网页版、IDE 扩展、GitHub 集成、Slack，以及面向 macOS 和 Windows 的桌面应用<sup>[4](https://github.com/openai/codex)</sup><sup> • </sup><sup>[5](https://openai.com/index/introducing-upgrades-to-codex/?trk=public_post_comment-text)</sup><sup> • </sup><sup>[6](https://openai.com/index/introducing-the-codex-app/)</sup> |
| 全面开放 | 2025 年 10 月 6 日；日使用量自 8 月初以来增长超过 10 倍，GPT-5-Codex 在头三周内处理了超过 40 万亿 token<sup>[2](https://openai.com/index/codex-now-generally-available/)</sup> |
| 规模 | 截至 2026 年 6 月，周活跃用户超过 500 万，自 2026 年 2 月桌面应用发布以来增长超过 6 倍<sup>[7](https://openai.com/index/codex-for-knowledge-work/)</sup> |
| 用户构成 | 开发者仍为最大群体，但知识工作者约占用户的 20%，且其用户数增速是开发者的三倍以上<sup>[7](https://openai.com/index/codex-for-knowledge-work/)</sup> |
| 安全模型 | 沙箱化执行，默认禁用网络访问；审批策略管控跨越沙箱边界的操作<sup>[8](https://openai.com/index/running-codex-safely/)</sup> |

## 起源与发布

OpenAI 于 2025 年 5 月 16 日推出 Codex，作为一个基于云端的软件工程智能体，可并行处理多项任务。每项任务在各自独立的云沙箱中运行，沙箱预加载用户的代码仓库，智能体可在其中读取和编辑文件，并运行包括测试框架、代码检查工具和类型检查器在内的命令。用户通过 ChatGPT 的侧边栏访问，用“Code”提示词分配任务，或用“Ask”提示词询问关于代码库的问题。<sup>[1](https://openai.com/index/introducing-codex/)</sup>

发布时的模型 codex-1 使用强化学习在多种环境中的真实世界编程任务上进行训练，使其输出能够紧密模仿人类风格和拉取请求偏好、精确遵循指令，并反复运行测试直至获得通过的结果。<sup>[3](https://cdn.openai.com/pdf/8df7697b-c1b2-4222-be00-1fd3298f351d/codex_system_card.pdf)</sup> 一个独立但相关的产品 Codex CLI 已于 2025 年 4 月 16 日发布，是一个开源、轻量级的编程智能体，在终端本地运行，以 Apache-2.0 许可证发布。<sup>[4](https://github.com/openai/codex)</sup>

## 工作原理

**执行环境。** Codex 以多种模式运行。在云端，系统提供一个预加载用户代码仓库的沙箱容器，智能体在其中读取和编辑文件、运行命令，并在隔离环境中执行代码。<sup>[1](https://openai.com/index/introducing-codex/)</sup> 在本地，CLI 和桌面应用使用系统级沙箱来界定智能体可写入的位置、能否访问网络以及哪些路径受保护。审批策略决定 Codex 何时必须在行动前询问，例如当请求的操作超出沙箱范围时；用户可以批准单次操作或整个会话。自动审查功能可自动批准低风险请求，或经用户充分授权的高风险请求，而无需打断用户。<sup>[8](https://openai.com/index/running-codex-safely/)</sup> 默认情况下，Codex 在禁用网络访问的状态下运行，这降低了来自不可信来源的提示注入风险。<sup>[5](https://openai.com/index/introducing-upgrades-to-codex/?trk=public_post_comment-text)</sup>

**智能体执行框架。** OpenAI 将其用 Rust 编写的编排层描述为连接模型、工具和用户环境的智能体执行框架。单次用户回合可包含多次模型请求和工具调用，因此该框架通过延迟发现工具和插件来减少重复工作，默认将工具输出限制在 10,000 token，并将模型可见的历史视为仅追加，以便提示缓存能在单回合的多次请求间复用计算。<sup>[9](https://openai.com/index/gpt-5-6-frontier-intelligence-efficiency/)</sup> 同一框架通过 Agents API 向开发者开放，OpenAI 在该 API 中运行托管的 Codex 执行框架，具备自动上下文压缩、多智能体编排、程序化工具调用以及对 MCP 服务器的支持。<sup>[10](https://developers.openai.com/api/docs/guides/agents)</sup>

## 界面与产品形态

Codex 可通过 ChatGPT 账户从多个相互连接的地方访问。CLI 在本地运行，可通过 npm、Homebrew 或独立安装程序安装；IDE 扩展将智能体带入 VS Code、[Cursor](https://www.edgepedia.org/zh/cursor-coding-agent) 及其他 VS Code 分支；GitHub 集成直接在拉取请求上发布智能体的审查意见；在 Slack 中标记 @Codex 可让其从对话中收集上下文，并返回已完成云端任务的链接。<sup>[4](https://github.com/openai/codex)</sup><sup> • </sup><sup>[5](https://openai.com/index/introducing-upgrades-to-codex/?trk=public_post_comment-text)</sup><sup> • </sup><sup>[2](https://openai.com/index/codex-now-generally-available/)</sup>

**桌面应用。** 2026 年 2 月，OpenAI 推出面向 macOS 的 Codex 应用，这是一个跨项目并行运行多个智能体的指挥中心，内置对 git 工作树的支持，使多个智能体可在同一仓库上工作而不产生冲突。该应用新增了技能（skills），即为代码生成之外的任务打包指令、资源和脚本，以及自动化（Automations），可按计划运行 Codex，结果进入审查队列。Windows 版本于 2026 年 3 月 4 日跟进。<sup>[6](https://openai.com/index/introducing-the-codex-app/)</sup> 后续更新增加了计算机使用、远程 SSH 连接到托管开发环境、通过 ChatGPT 应用的移动端访问，以及记忆功能预览，让 Codex 能跨任务携带上下文。<sup>[11](https://openai.com/index/work-with-codex-from-anywhere/?trk=article-ssr-frontend-pulse_little-text-block)</sup><sup> • </sup><sup>[12](https://openai.com/index/codex-for-almost-everything/?trk=test)</sup>

## 模型

Codex 先后由一系列针对智能体编程调优的模型提供服务。GPT-5-Codex 于 2025 年 9 月发布，在构建完整项目、大规模重构和代码审查等真实工程任务上训练，成为云端任务和代码审查的默认模型。<sup>[5](https://openai.com/index/introducing-upgrades-to-codex/?trk=public_post_comment-text)</sup> GPT-5.1-Codex-Max 是 OpenAI 首个原生训练为通过压缩跨多个上下文窗口运行的模型，可在单个任务中连贯处理数百万 token。<sup>[13](https://cdn.openai.com/pdf/2a7d98b1-57e5-4147-8d0e-683894d782ae/5p1_codex_max_card_03.pdf)</sup> GPT-5.x-Codex 系列的后续快照延续了这一模式，OpenAI 建议仅在 Codex 或类似 Codex 的环境中将这些调优模型用于智能体编程任务，而非作为通用助手使用。<sup>[5](https://openai.com/index/introducing-upgrades-to-codex/?trk=public_post_comment-text)</sup>

## 采用与使用

全面开放后增长迅速。2025 年 8 月初至 10 月初，日使用量增长超过 10 倍，GPT-5-Codex 在发布后三周内处理了超过 40 万亿 token。<sup>[2](https://openai.com/index/codex-now-generally-available/)</sup> 到 2026 年 4 月，OpenAI 称每周有超过 300 万开发者使用 Codex，<sup>[14](https://www.techradar.com/pro/codex-can-now-operate-your-computer-alongside-you-openai-takes-major-shot-at-claude-code-with-major-workplace-updates)</sup> 到 2026 年 6 月，其报告周活跃用户超过 500 万，自 2 月桌面应用发布以来增长超过 6 倍。<sup>[7](https://openai.com/index/codex-for-knowledge-work/)</sup> OpenAI 的企业负责人表示，周用户数在短短 15 天内从 300 万增至 400 万，且 Codex 使用量的 40% 现在来自人力资源、财务、销售和市场营销等领域的非技术工作者。<sup>[15](https://www.techradar.com/pro/we-see-it-as-the-biggest-opportunity-openai-enterprise-boss-on-why-business-users-can-benefit-the-most-from-increasing-ai-adoption-at-work)</sup>

OpenAI 研究人员对 Codex 使用数据的分析发现，2026 年上半年活跃用户增长超过五倍，增长最快的是软件开发者这一最初用户群体之外的用户。超过 10% 的用户每周某个时候管理三个或更多并发 Codex 智能体，26.6% 的用户使用了技能——即可共享的复杂工作流指令包。<sup>[16](https://arxiv.org/abs/2606.26959)</sup>

**OpenAI 内部。** 该公司报告称，其几乎所有工程师都使用 Codex，而 2025 年 7 月这一比例仅略高于一半；他们每周合并的拉取请求增加了 70%；Codex 自动审查几乎每个拉取请求，在生产前捕获关键问题。<sup>[2](https://openai.com/index/codex-now-generally-available/)</sup> 内部团队将其用于代码理解、重构与迁移、性能优化、提高测试覆盖率以及事件响应。<sup>[17](https://openai.com/business/guides-and-resources/how-openai-uses-codex/)</sup>

## 企业部署

OpenAI 围绕 Codex 建立了企业计划。2026 年 4 月，它推出 Codex Labs，通过研讨会和工作会议将 OpenAI 专家带入组织，并宣布与[埃森哲](https://www.edgepedia.org/zh/accenture)（Accenture）、凯捷（Capgemini）、CGI、高知特（Cognizant）、印孚瑟斯（Infosys）、普华永道（PwC）和[塔塔咨询服务](https://www.edgepedia.org/zh/tata-consultancy-services)（Tata Consultancy Services）等全球系统集成商建立合作伙伴关系，推动企业客户从试点走向生产就绪的部署。<sup>[18](https://openai.com/index/scaling-codex-to-enterprises-worldwide/)</sup> 与戴尔（Dell）的另一项合作探索通过戴尔 AI 工厂在混合和本地环境中让 Codex 更贴近企业数据运行。<sup>[19](https://openai.com/index/dell-codex-enterprise-partnership/?trk=article-ssr-frontend-pulse_little-text-block)</sup>

OpenAI 发布的客户案例研究报告了可衡量的效果。企业软件公司 Simplex 选择 Codex 作为其 ChatGPT Enterprise 上的主要编程智能体，报告称在基于 CRUD 的 Web 应用上，设计每个屏幕的时间减少了 40%，开发每个屏幕的时间减少了 70%，内部集成测试时间减少了 17%。<sup>[20](https://openai.com/index/simplex/)</sup> 由于这些数据来自 OpenAI 发布的案例研究，它们代表的是该公司对客户使用情况的自身描述，而非独立审计。<sup>[21](https://www.siliconreport.com/openai-says-simplex-is-using-codex-and-chatgpt-enterprise-to-cut-software-cycle-time-7fd73c8d)</sup>

## 独立评估

关于自主编程智能体的学术研究将 Codex 置于一个比较组中，该组包括 [GitHub Copilot](https://www.edgepedia.org/zh/github-copilot)、Devin、Cursor 和 [Claude Code](https://www.edgepedia.org/zh/claude-code)。对 AIDev 数据集中 7,156 个拉取请求进行的按任务分层分析发现，Codex 在所有九个任务类别中均实现了持续较高的接受率，从 59.6% 到 88.6% 不等，尽管没有单一智能体在所有任务类型中表现最佳。<sup>[22](https://arxiv.org/abs/2602.08915)</sup> 一项对 2024 年 12 月至 2025 年 7 月间来自 2,807 个 GitHub 仓库的 37,623 个带来源标记的拉取请求的研究发现，Codex 撰写的 PR 被回退的频率约为人类 PR 的一半，分别为 6.1% 和 11.5%，而汇总的智能体代码比人类代码更不可能包含硬编码凭证等安全隐患。<sup>[23](https://arxiv.org/abs/2609.17598)</sup>

媒体测试结果不一，但在完整任务上的评价总体良好。[Ars Technica](https://www.edgepedia.org/zh/ars-technica) 的一项比较中，四个智能体重建扫雷游戏，OpenAI Codex 以 10 分中的 9 分获得最高分，指出它是唯一将和弦点击（chording）作为游戏选项纳入的智能体，尽管它编写代码的速度也最慢。<sup>[24](https://arstechnica.com/ai/2025/12/the-ars-technica-ai-coding-agent-test-minesweeper-edition/)</sup> Tom's Guide 对用 Codex 和 Claude Code 构建的三个应用进行比较，认为 Codex 在分析深度和更复杂的数据处理方面是总体赢家，同时发现 Claude Code 对初学者而言更快、更易上手。<sup>[25](https://www.tomsguide.com/ai/claude-code-vs-openai-codex-i-built-3-real-apps-to-find-the-better-agent-heres-the-verdict)</sup>

## 安全与治理

OpenAI 声明的部署原则是：Codex 应在有界环境中高效工作，低风险的日常操作应无摩擦进行，较高风险的操作应停下来接受审查，同时保留智能体原生遥测以便审计智能体的行为。<sup>[8](https://openai.com/index/running-codex-safely/)</sup> 云端智能体最初发布时采用严格禁用网络的沙箱化任务执行环境，后来为安装依赖等任务增加了可配置的互联网访问。<sup>[26](https://deploymentsafety.openai.com/gpt-5-3-codex/gpt-5-3-codex.pdf)</sup> Codex 模型的系统卡描述了模型层面的缓解措施，包括针对有害任务和提示注入的专门安全训练，以及沙箱化和可配置网络访问等产品层面的缓解措施。<sup>[13](https://cdn.openai.com/pdf/2a7d98b1-57e5-4147-8d0e-683894d782ae/5p1_codex_max_card_03.pdf)</sup> 对于 CI 使用，OpenAI 的 codex-action 文档警告称，以只读文件系统访问加无密码 sudo 运行智能体仍可能暴露 OPENAI_API_KEY，并建议采用 drop-sudo 或无特权用户的安全策略。<sup>[27](https://github.com/openai/codex-action/blob/main/docs/security.md)</sup>

## References

1. [Introducing Codex, OpenAI (May 16, 2025)](https://openai.com/index/introducing-codex/)
2. [Codex is now generally available, OpenAI (October 6, 2025)](https://openai.com/index/codex-now-generally-available/)
3. [Addendum to o3 and o4-mini system card: Codex, OpenAI (May 16, 2025)](https://cdn.openai.com/pdf/8df7697b-c1b2-4222-be00-1fd3298f351d/codex_system_card.pdf)
4. [openai/codex: Lightweight coding agent that runs in your terminal, GitHub](https://github.com/openai/codex)
5. [Introducing upgrades to Codex, OpenAI (September 2025)](https://openai.com/index/introducing-upgrades-to-codex/?trk=public_post_comment-text)
6. [Introducing the Codex app, OpenAI (February 2026)](https://openai.com/index/introducing-the-codex-app/)
7. [Codex is becoming a productivity tool for everyone, OpenAI (June 2, 2026)](https://openai.com/index/codex-for-knowledge-work/)
8. [Running Codex safely at OpenAI, OpenAI (May 8, 2026)](https://openai.com/index/running-codex-safely/)
9. [How GPT-5.6 fuses frontier intelligence with frontier efficiency, OpenAI](https://openai.com/index/gpt-5-6-frontier-intelligence-efficiency/)
10. [Agents, OpenAI API documentation](https://developers.openai.com/api/docs/guides/agents)
11. [Work with Codex from anywhere, OpenAI (May 14, 2026)](https://openai.com/index/work-with-codex-from-anywhere/?trk=article-ssr-frontend-pulse_little-text-block)
12. [Codex for (almost) everything, OpenAI (April 16, 2026)](https://openai.com/index/codex-for-almost-everything/?trk=test)
13. [GPT-5.1-Codex-Max system card, OpenAI](https://cdn.openai.com/pdf/2a7d98b1-57e5-4147-8d0e-683894d782ae/5p1_codex_max_card_03.pdf)
14. [Codex can now operate your computer alongside you, TechRadar (April 17, 2026)](https://www.techradar.com/pro/codex-can-now-operate-your-computer-alongside-you-openai-takes-major-shot-at-claude-code-with-major-workplace-updates)
15. [OpenAI enterprise boss on increasing AI adoption at work, TechRadar](https://www.techradar.com/pro/we-see-it-as-the-biggest-opportunity-openai-enterprise-boss-on-why-business-users-can-benefit-the-most-from-increasing-ai-adoption-at-work)
16. [The Shift to Agentic AI: Evidence from Codex, arXiv](https://arxiv.org/abs/2606.26959)
17. [How OpenAI Uses Codex to Accelerate Engineering, OpenAI](https://openai.com/business/guides-and-resources/how-openai-uses-codex/)
18. [Scaling Codex to enterprises worldwide, OpenAI (April 21, 2026)](https://openai.com/index/scaling-codex-to-enterprises-worldwide/)
19. [OpenAI and Dell partner to bring Codex to hybrid and on-premise enterprise environments, OpenAI](https://openai.com/index/dell-codex-enterprise-partnership/?trk=article-ssr-frontend-pulse_little-text-block)
20. [Simplex rethinks software development with Codex, OpenAI](https://openai.com/index/simplex/)
21. [OpenAI Says Simplex Uses Codex and ChatGPT Enterprise Across Design, Build and Test, SiliconReport](https://www.siliconreport.com/openai-says-simplex-is-using-codex-and-chatgpt-enterprise-to-cut-software-cycle-time-7fd73c8d)
22. [Comparing AI Coding Agents: A Task-Stratified Analysis of Pull Request Acceptance, arXiv](https://arxiv.org/abs/2602.08915)
23. [Not All Agents Are Equal: Code Quality and Post-Merge Maintenance Across Five Autonomous Coding Agents in the Wild, arXiv](https://arxiv.org/abs/2609.17598)
24. [We asked four AI coding agents to rebuild Minesweeper, Ars Technica (December 2025)](https://arstechnica.com/ai/2025/12/the-ars-technica-ai-coding-agent-test-minesweeper-edition/)
25. [I vibe coded 3 real apps using Claude Code and OpenAI Codex, Tom's Guide](https://www.tomsguide.com/ai/claude-code-vs-openai-codex-i-built-3-real-apps-to-find-the-better-agent-heres-the-verdict)
26. [GPT-5.3-Codex deployment safety report, OpenAI](https://deploymentsafety.openai.com/gpt-5-3-codex/gpt-5-3-codex.pdf)
27. [Security documentation, openai/codex-action, GitHub](https://github.com/openai/codex-action/blob/main/docs/security.md)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › AI companies, people, and products › AI products and assistants › AI agents and developer tools

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/openai-codex-ai-agent

English original: https://www.edgepedia.org/openai-codex-ai-agent
