OpenAI Codex 是什么?What Is OpenAI Codex?
OpenAI Codex 是 OpenAI 推出的编程智能体(coding agent),三形态:Codex Cloud 跑在 ChatGPT 网页端/桌面端——把任务丢进去,它在隔离的云端容器里并行执行,产出可审查的 diff 和 pull request;Codex CLI 是跑在本地终端的 agent,在沙箱里读代码、改文件、跑命令;另有 IDE 扩展把同一个 agent 带进编辑器。OpenAI Codex is OpenAI's coding agent in three forms: Codex Cloud runs inside ChatGPT web/desktop — hand it a task and it executes in parallel inside isolated cloud containers, producing reviewable diffs and pull requests; Codex CLI is a terminal agent that reads, edits, and runs code inside a sandbox; and an IDE extension brings the same agent into your editor.
2026 年 9 月 3 日起,默认模型切换为 GPT-6 Astra(向 Plus / Pro / Business / Enterprise 用户滚动上线,无需加价);免费档与 Go 档使用 GPT-6 Luna 标准速度;GPT-5.5 已于 2026-10-14 从全部计划退役。Codex 随 ChatGPT 订阅包含、不单独售卖:Free($0)、Go($8/月)、Plus($20/月)、Pro($100/月 5x 或 $200/月 20x)、Business($20/人/月年付),以上为 2026-10 核实的公开档位,价格以官网为准。Since September 3, 2026, the default model is GPT-6 Astra (rolling out to Plus / Pro / Business / Enterprise at no extra cost); Free and Go tiers run GPT-6 Luna at standard speed; GPT-5.5 retired from all plans on October 14, 2026. Codex is bundled with ChatGPT plans, not sold separately: Free ($0), Go ($8/mo), Plus ($20/mo), Pro ($100/mo 5x or $200/mo 20x), Business ($20/user/mo billed annually) — public tiers verified Oct 2026; confirm prices on the official site.
核心是开源的:openai/codex 仓库采用 Apache-2.0 协议,约 13 万 GitHub star(2026-10 核实),仍在高频更新。它支持项目级 AGENTS.md(写给 agent 的仓库说明书)、MCP 服务器(在 ~/.codex/config.toml 中配置)、开放 SKILL.md 格式的 Agent Skills(.agents/skills)与子智能体(subagents)。另有 API key 模式:CLI / SDK 按 API token 计费,适合 CI/CD,但不含云端功能(GitHub 代码审查、Slack 集成等)。The core is open source: the openai/codex repo is Apache-2.0 with ~130k GitHub stars (verified Oct 2026) and frequent updates. It supports project-level AGENTS.md (repo instructions written for the agent), MCP servers (configured in ~/.codex/config.toml), Agent Skills in the open SKILL.md format (.agents/skills), and subagents. An API-key mode bills CLI/SDK usage at API token rates for CI/CD — without the cloud features (GitHub code review, Slack, etc.).
Codex 是 OpenAI 的"搭售"打法:产品故事一半是能力、一半是定价——你已经为 ChatGPT 付费,就不用再为 agent 另开一张账单。真正的差异点是异步模式:把任务委托出去,回来收 PR,而不是守在编辑器里看它逐行打字(这是 Cursor / Cline 的循环)。诚实的另一面:用量与你的 ChatGPT 计划共享,重度用户会被推上 Pro $100/$200 档;云端专属功能(自动代码审查、Slack)在 API key 模式里不存在;模型阵容变化快(2026-09 GPT-6 Astra 上线、2026-10-14 GPT-5.5 退役)——别把模型假设写死进长期自动化里。
Codex is OpenAI's bundling play: the product story is as much pricing as capability — if you already pay for ChatGPT, there is no second bill for the agent. The real differentiator is the async model: delegate a task, come back to a PR, instead of watching it type line by line in your editor (the Cursor/Cline loop). The honest caveats: usage shares your ChatGPT plan's limits, so heavy users land on the Pro $100/$200 tiers; cloud-only features (automatic code review, Slack) don't exist in API-key mode; and the model lineup churns fast (GPT-6 Astra rollout Sept 2026, GPT-5.5 retired Oct 14, 2026) — don't hard-code model assumptions into long-lived automation.
— 中国吧 AI Tools Hub Editorial Team
谁适合使用 OpenAI Codex?Who Should Use OpenAI Codex?
✓ 适合以下场景Good Fit For
- 已有 ChatGPT 订阅、想零额外成本用上 agent 的开发者ChatGPT subscribers who want an agent with no extra bill
- 喜欢"丢任务→收 PR"的异步协作,而不是守着编辑器Fans of async "delegate → receive PR" collaboration over babysitting the editor
- 想把代码审查、CI 自动化交给 agent 的团队Teams handing code review and CI automation to an agent
- 重度使用 AGENTS.md / MCP / Skills 等开放扩展格式Heavy users of open extension formats (AGENTS.md / MCP / Skills)
✕ 不适合以下场景Not Ideal For
- 重度使用但只买得起低档订阅——用量与 ChatGPT 计划共享Heavy users on low tiers — usage is shared with your ChatGPT plan
- 只想用 API key 模式,却需要云端功能(代码审查、Slack)API-key-only users who need cloud features (code review, Slack)
OpenAI Codex 快速开始Getting Started with OpenAI Codex
1. 订阅用户:在 ChatGPT 网页端/桌面端直接开 Codex Cloud 云端任务;本地装 CLI:npm i -g @openai/codex,然后用 ChatGPT 账号登录Subscribers: start a Codex Cloud task in ChatGPT web/desktop; install the CLI locally with npm i -g @openai/codex, then sign in with your ChatGPT account
2. 仓库根目录写 AGENTS.md:构建/测试命令、代码规范、环境说明——这是决定任务质量的关键杠杆Write AGENTS.md at the repo root: build/test commands, code conventions, environment notes — the key lever for task quality
3. 需要外部工具时在 ~/.codex/config.toml 添加 MCP 服务器;先跑一个云端小任务,体验"委托→PR"完整流程Add MCP servers in ~/.codex/config.toml when you need external tools; run one small cloud task first to experience the full "delegate → PR" loop
核心功能Key Features
-
Codex Cloud 并行云端任务Codex Cloud: Parallel Cloud Tasks — 隔离的云端容器并行执行任务,产出可审查的 diff 与 pull request;支持自动代码审查与 Slack 集成(Plus 及以上)。Isolated cloud containers execute tasks in parallel, producing reviewable diffs and pull requests; automatic code review and Slack integration on Plus and above.
-
Codex CLI 本地终端 agentCodex CLI: Local Terminal Agent — 在沙箱里读代码、改文件、跑命令;核心开源(Apache-2.0),npm 一行命令安装。Reads, edits, and runs code inside a sandbox; open-source core (Apache-2.0), one npm command to install.
-
IDE 扩展IDE Extension — 同一个 agent 进驻编辑器,终端、云端、编辑器三端体验一致。The same agent inside your editor — consistent experience across terminal, cloud, and IDE.
-
AGENTS.md + MCP + SkillsAGENTS.md + MCP + Skills — 项目说明书 AGENTS.md、~/.codex/config.toml 接 MCP 服务器、开放 SKILL.md 格式的 Agent Skills 与子智能体,生态可组合。Project instructions via AGENTS.md, MCP servers in ~/.codex/config.toml, Agent Skills in the open SKILL.md format, plus subagents — a composable ecosystem.
-
API key 模式API-Key Mode — CLI / SDK 按 API token 计费,适合 CI/CD 与产品集成;不含云端功能(GitHub 代码审查、Slack 等)。CLI/SDK billed at API token rates — built for CI/CD and product integrations; excludes cloud features (GitHub code review, Slack, etc.).
优缺点Pros & Cons
✓ 适合以下场景Good Fit For
- ChatGPT 订阅用户零额外账单——agent 能力"搭车"而来Zero extra bill for ChatGPT subscribers — the agent rides along
- 真异步:委托→云端并行→收 PR,不用守着编辑器Truly async: delegate → parallel cloud runs → collect PRs, no editor babysitting
- 开源核心 + 标准扩展格式(AGENTS.md / MCP / SKILL.md),生态可组合Open-source core plus standard extension formats (AGENTS.md / MCP / SKILL.md)
- GitHub 深度集成:PR、自动代码审查、issue 联动Deep GitHub integration: PRs, automatic code review, issue workflows
✕ 不适合以下场景Not Ideal For
- 用量与 ChatGPT 共享——重度使用会被推上 Pro $100/$200 档Usage shared with ChatGPT — heavy use pushes you to the Pro $100/$200 tiers
- API key 模式没有云端功能(代码审查、Slack 集成)API-key mode lacks cloud features (code review, Slack integration)
- 模型阵容变化快(2026 年 GPT-5.x 退役、GPT-6 Astra 上线),长期自动化别写死模型假设Fast-moving model lineup (GPT-5.x retired, GPT-6 Astra launched in 2026) — don't hard-code model assumptions
应用场景Use Cases
人们使用 OpenAI Codex 的常见场景:Popular ways people use OpenAI Codex.
🚀 异步功能开发Async Feature Work
把需求描述丢给云端,Codex 并行实现,回来 review PR 直接合并——适合"交代清楚就能走"的任务。Hand a spec to the cloud, let Codex implement in parallel, come back to review and merge the PR — ideal for well-specified tasks.
🔍 PR 自动代码审查Automated PR Code Review
把 Codex 接进团队工作流,PR 提交即触发自动审查,把明显的坑拦在合并之前。Wire Codex into the team workflow so every PR gets an automatic review pass, catching obvious issues before merge.
🛠️ 终端结对编程Terminal Pair Programming
在仓库沙箱里让 CLI 改代码、跑测试、修报错,AGENTS.md 保证它按你的规范干活。Let the CLI edit code, run tests, and fix failures inside the repo sandbox, with AGENTS.md keeping it on your conventions.
🤖 CI/CD 与自动化CI/CD & Automation
API key 模式按 token 计费,把重构、迁移、合规检查等"重活"做成可重复的自动化流水线。API-key mode bills by token — turn heavy-lift work like refactors, migrations, and compliance checks into repeatable automated pipelines.
相似 AI 工具Similar AI Tools
如果 OpenAI Codex 不符合你的需求,可以看看这些热门 AI 工具:If OpenAI Codex doesn't fit your needs, here are other popular AI tools you might consider: