跳到主要內容
OpenAI

2025年5月16日

發佈產品

Codex 隆重登場

一款可以並行處理多項任務且以 codex-1 為核心技術的雲端軟件工程智能代理。 現已對 ChatGPT Pro 版、Team 和 Enterprise 用戶開放使用,Plus 用戶即將開放使用。

在柔和色調的程式主題背景上,主目錄詢問「我們接下來應該寫什麼程式?」並設有一個提示方塊、儲存庫/分支選取器以及一個的任務清單。
正在載入...

我們在今天推出 Codex 的研究預覽:一款可以並行處理多項任務的雲端軟件工程智能代理。Codex 可以為您執行各種任務,例如編寫功能、回答關於程式庫的問題、修正錯誤以及提出審核用的拉取要求;每個任務都在自己的雲端沙箱環境中執行,並已預先載入您的儲存庫。

Codex 以 codex-1 為核心技術,是專為軟件工程最佳化的 OpenAI o3 版本。它使用強化學習透過在各種環境中的真實編碼任務上訓練,產生與人類風格和 PR 喜好設定高度相似的程式碼,精準遵循指示,並且可以迭代執行測試,直到獲得通過的結果。我們於今日向 ChatGPT Pro 版、Enterprise 及 Team 用戶推出 Codex 服務,Plus 和 Edu 支援即將推出。

Codex 的工作方式

現在,您可以透過 ChatGPT 的側邊欄存取 Codex,輸入提示並且按一下「寫程式」來為其指派新的編碼任務。如果您想問 Codex 有關程式庫的問題,請按一下「問問題」。每個任務都會在一個已預先載入您程式庫的獨立隔離環境中分開處理。Codex 可以讀取和編輯檔案,也可以執行測試架構、Linter 和類型檢查器等命令。完成任務通常需要 1 到 30 分鐘,視複雜程度而定,您可以即時監控 Codex 的進展。

Codex 完成任務後,會在它的環境中提交更改。Codex 透過引用終端記錄和測試輸出提供操作的可驗證證據,讓您追蹤完成任務期間的每個步驟。您可以審查結果、要求進一步修改、開啟 GitHub 拉取要求或直接將更改整合至本地環境。您可以在產品中配置 Codex 環境,以使它與您的實際開發環境盡可能相符。

您可透過儲存庫中的 AGENTS.md 檔案指引 Codex。這些文字檔案類似於 README.md,您可以在其中指導 Codex 如何導航您的程式庫、執行哪些測試命令以及如何遵循項目標準實踐。與人類開發人員一樣,Codex 智能代理在配置好的開發環境、可靠測試設定和清晰文件下的表現最佳。 

程式設計評估和內部基準測試顯示,即使沒有 AGENTS.md 檔案或自訂結構 codex-1 亦表現出色。

已排除 23 個通過 SWE-bench 驗證但無法在我們的內部基礎設施上執行的樣本。codex-1 已在最大情境長度為 192k 個一次性密碼和中「推理强度」設定下測試,此參數組合將與目前產品中的設定保持一致。請查看此處關於 o3 的詳細評估資料。

我們的內部 SWE 任務測試基準是 OpenAI 精心挑選的一組現實世界內部 SWE 任務。

建立安全可信賴的智能代理

我們將 Codex 作為研究預覽發佈,這與我們的迭代部署策略目標一致。在設計 Codex 時,我們優先考慮安全性和透明度,以便用戶可以驗證輸出結果 - 隨著 AI 模型獨立處理更複雜的編碼任務,以及安全考慮不斷演變,這項保障措施變得越來越重要。用戶可以透過引文、終端記錄和測試結果檢查 Codex 的工作。當不確定或遇到測試失敗時,Codex 智能代理會明確地告知這些問題,使用戶能夠就如何繼續做出明智的決定。在整合和執行之前,用戶仍然需要手動審查與驗證所有智能代理產生的程式碼。

藍色背景上顯示的程式審查螢幕截圖,附帶測試檔案疊加層(用於驗證引用檔案名稱)連同測試摘要及通過的測試。
淺藍色背景上顯示的代碼審查螢幕截圖,附帶黑色終端疊加層(顯示引用檔案名稱的一項通過測試);同時在可見「修正特殊字元引起的 /diff 錯誤」更改的摘要與差異比對。

與人類喜好設定一致

訓練 codex-1 的主要目標是使輸出結果與人類寫程式的喜好設定和標準保持高度一致。相較於 OpenAI o3,codex-1 總是能產生良好資料段,可立即展開人工審查並整合至標準工作流程。

Please fix the following issue in the astropy/astropy repository. Please resolve the issue in the problem below by editing and testing code files in your current code execution session. The repository is cloned in the /testbed folder. You must fully solve the problem for your answer to be considered correct. Problem statement:Modeling's `separability_matrix` does not compute separability correctly for nested CompoundModels Consider the following model: ```python from astropy.modeling import models as m from astropy.modeling.separable import separability_matrix cm = m.Linear1D(10) & m.Linear1D(5) ``` It's separability matrix as you might expect is a diagonal: ```python >>> separability_matrix(cm) array([[ True, False], [False, True]]) ``` If I make the model more complex: ```python >>> separability_matrix(m.Pix2Sky_TAN() & m.Linear1D(10) & m.Linear1D(5)) array([[ True, True, False, False], [ True, True, False, False], [False, False, True, False], [False, False, False, True]]) ``` The output matrix is again, as expected, the outputs and inputs to the linear models are separable and independent of each other. If however, I nest these compound models: ```python >>> separability_matrix(m.Pix2Sky_TAN() & cm) array([[ True, True, False, False], [ True, True, False, False], [False, False, True, True], [False, False, True, True]]) ``` Suddenly the inputs and outputs are no longer separable? This feels like a bug to me, but I might be missing something?
Codex
OpenAI o3

防止濫用

防範 AI 驅動的軟件工程遭到惡意套用(例如惡意軟件開發)變得日益關鍵。與此同時,防護措施不應過度妨礙正當且有益的應用程式亦同樣重要,即使這些應用程式可能涉及某些同樣會被用於惡意軟件開發的技術(例如底層內核工程)。

為了平衡安全性和實用性,Codex 經過訓練,能識別並準確地拒絕以開發惡意軟件為目的的要求,同時清晰地區分與支援合法任務。我們也增強政策架構,並納入嚴格的安全評估程序,以有效強化這些界限。我們已發佈《o3 系統卡附錄》來反映這些評估内容。

安全執行

Codex 智能代理完全在雲端安全隔離的容器中運作。在任務執行期間將停用網絡存取功能,智能代理的交互僅限於透過 GitHub 儲存庫明確提供的程式以及用戶透過設定指令碼配置的預安裝依賴項。智能代理無法存取外部網站、API 或其他服務。

早期用例

OpenAI 的技術團隊已開始將 Codex 作為其日常工具包的一部分使用。OpenAI 工程師最常用它來完成那些重複性、範圍明確的任務,例如重構、重新命名和編寫測試,因為這些任務會分散他們的注意力。它也適用於建立新功能架構、連接元件、修正錯誤和草擬文件。團隊正在養成運用 Codex 的新習慣:分類待命問題、在一天的開始規劃任務以及委派後台工作以保持進度。Codex 能藉由減少情境切換和顯示被遺忘的待辦事項,讓工程師更快地交付產品,並專心處理最重要的事情。

在發佈之前,我們也與一小群外部測試人員合作,以便更加了解 Codex 在不同程式庫、開發流程和團隊中的表現。

  • Cisco(在新視窗中開啟) 正在探索 Codex 如何協助他們的工程團隊將偉大的想法更快地付諸實踐。作為早期設計合作夥伴,Cisco 正在評估 Codex 在其產品組合中的實際用例,並向 OpenAI 團隊提供反饋,以助於塑造 Codex 的未來。
  • Temporal(在新視窗中開啟) 使用 Codex 加速功能開發、偵錯問題、編寫和執行測試以及重構大型程式庫。它也能在後台執行複雜任務來協助他們保持專注,這樣可以在加速迭代的同時讓工程師維持「心流狀態」。
  • Superhuman(在新視窗中開啟) 使用 Codex 加速小型但重複的任務,例如提升測試覆蓋率和修正整合故障。它也有助於他們加快產品交付速度,讓產品經理無需工程師協助(程式碼審核除外),即可提交輕量級程式碼更改。
  • Kodiak(在新視窗中開啟) 正在使用 Codex 編寫偵錯工具、提升測試覆蓋率並重構程式碼,進而加速開發自動駕駛技術 Kodiak Driver。Codex 也成為寶貴的參考工具,透過展現相關情境和過往更改,協助工程師理解堆疊中不熟悉的部分。

根據早期測試人員的經驗,我們建議同時將明確的任務分配給多個智能代理,並嘗試不同類型的任務和提示,以有效地探索模型的功能。

Codex CLI 更新

我們上個月發佈了 Codex CLI,這是一款在終端執行的輕量級開放原始碼智能代理。它將 o3 和 o4-mini 等模型的強大功能引入您的本地工作流程,讓您輕鬆協作以更快地完成任務。 

我們也在今天發佈 codex-1 的精簡版本,這是專為 Codex CLI 設計的 o4-mini 版本。這個新模型支援提升 CLI 中的工作效率,在保持優秀指示遵循與編碼風格的同時,最佳化低延遲程式問答與編輯功能。它現在可用作 Codex CLI 中的預設模型和 API 中的 codex-mini-latest 模型。隨著我們不斷改良 Codex-mini 模型,基礎快照也將定期更新。

我們也簡化您的開發人員帳戶連接到 Codex CLI 的流程。您現在可以使用 ChatGPT 帳戶登入並選取要使用的 API 組織,且無需手動產生和設定 API 詞元。我們將自動為您產生並配置 API 金鑰。使用 ChatGPT 登入 Codex CLI 的 Plus 和 Pro 版用戶,今天稍晚即可開始兌換價值 5 美元和 50 美元的免費 API 積分,有效期為 30 天。

Codex 的可用性、收費模式和限制

我們從今天起逐步向 ChatGPT Pro 版、Enterprise 及 Team 用戶推出 Codex 服務,Plus 與 Edu 支援即將推出。在接下來的幾週內,所有用戶皆可免費存取 Codex 以便您探索所有功能,之後我們將推出限速存取和靈活的收費選項,您可以按需購買額外的使用量。我們計劃近期擴展 Plus 和 Edu 用戶的存取權。

對於使用 codex-mini-latest 建立模型的開發人員,此模型已在回覆 API 上使用,價格為每 100 萬個輸入詞元 1.50 美元,每 100 萬個輸出詞元 6 美元,並提供 75% 的提示快取折扣。

Codex 仍處於開發初期。作為研究預覽,它目前仍欠缺某些功能,例如無法接收圖像輸入進行前端開發,以及在智能代理運作期間實時修正它的執行方向。此外,委派給遠端代理程式比互動式編輯需要更長的時間,這可能需要一些時間來適應。經過一段時間以後,與 Codex 智能代理的互動將越來越類似於與同事的非同步協作。隨著模型能力的提升,我們預期智能代理將能在更長的時間內處理更複雜的任務。

下一步是什麽

我們設想未來開發人員可以自主掌控自己想要完成的工作,將剩餘工作委派給智能代理:借助 AI,開發人員可以更快地完成任務並提高工作效率。為了實現這個目標,我們正在建立一套支援即時協作和非同步委派的 Codex 工具。 

與 Codex CLI 等 AI 工具配對已迅速成為行業規範,幫助開發人員在寫程式時可以更快完成任務。但我們相信,Codex 在 ChatGPT 中引入的非同步多代理工作流程,將成為工程師編寫優質程式的主流方式。

最終,即時配對和任務委派這兩種互動模式會彼此融合。開發人員將在他們的 IDE 和日常工具中與 AI 代理協作,提出問題、獲取建議並分擔耗時較長的任務,這些全部都在統一的工作流程中進行。

展望未來,我們計劃引入更具互動性和靈活性的智能代理工作流程。開發人員很快就能在任務執行中提供指引,協同制定實施策略,並接收主動提供的進展更新。我們也設想與現有工具進行更深入的整合:Codex 目前已與 GitHub 連線,您很快便能從 Codex CLI、ChatGPT Desktop 甚至是問題追蹤程式或 CI 系統等工具指派任務。

軟件工程是最早借助 AI 大幅提升生產力的行業之一,為個人和小型團隊開拓了新的可能性。儘管我們對這些成果持樂觀態度,但我們也正在與合作夥伴攜手,深入研究廣泛應用智能代理對開發人員工作流程的影響,以及此趨勢對不同背景的員工、技能水準及地區技術發展帶來的變化。 

這只是個開始 - 我們期待看到您使用 Codex 建立的成果。

直播重播

附錄

系統訊息

我們分享 codex-1 系統訊息以協助開發人員了解模型的預設行為並量身訂製 Codex,使其在自訂工作流程中高效運作。例如,codex-1 系統訊息會提示 Codex 執行 AGENTS.md 檔案中提到的所有測試,但如果您時間緊迫,可以要求 Codex 略過這些測試。

1
# Instructions
2
- The user will provide a task.
3
- The task involves working with Git repositories in your current working directory.
4
- Wait for all terminal commands to be completed (or terminate them) before finishing.
5

6
# Git instructions
7
If completing the user's task requires writing or modifying files:
8
- Do not create new branches.
9
- Use git to commit your changes.
10
- If pre-commit fails, fix issues and retry.
11
- Check git status to confirm your commit. You must leave your worktree in a clean state.
12
- Only committed code will be evaluated.
13
- Do not modify or amend existing commits.
14

15
# AGENTS.md spec
16
- Containers often contain AGENTS.md files. These files can appear anywhere in the container's filesystem. Typical locations include `/`, `~`, and in various places inside of Git repos.
17
- These files are a way for humans to give you (the agent) instructions or tips for working within the container.
18
- Some examples might be: coding conventions, info about how code is organized, or instructions for how to run or test code.
19
- AGENTS.md files may provide instructions about PR messages (messages attached to a GitHub Pull Request produced by the agent, describing the PR). These instructions should be respected.
20
- Instructions in AGENTS.md files:
21
- The scope of an AGENTS.md file is the entire directory tree rooted at the folder that contains it.
22
- For every file you touch in the final patch, you must obey instructions in any AGENTS.md file whose scope includes that file.
23
- Instructions about code style, structure, naming, etc. apply only to code within the AGENTS.md file's scope, unless the file states otherwise.
24
- More-deeply-nested AGENTS.md files take precedence in the case of conflicting instructions.
25
- Direct system/developer/user instructions (as part of a prompt) take precedence over AGENTS.md instructions.
26
- AGENTS.md files need not live only in Git repos. For example, you may find one in your home directory.
27
- If the AGENTS.md includes programmatic checks to verify your work, you MUST run all of them and make a best effort to validate that the checks pass AFTER all code changes have been made.
28
- This applies even for changes that appear simple, i.e. documentation. You still must run all of the programmatic checks.
29

30
# Citations instructions
31
- If you browsed files or used terminal commands, you must add citations to the final response (not the body of the PR message) where relevant. Citations reference file paths and terminal outputs with the following formats:
32
1) `【F:<file_path>†L<line_start>(-L<line_end>)?】`
33
- File path citations must start with `F:`. `file_path` is the exact file path of the file relative to the root of the repository that contains the relevant text.
34
- `line_start` is the 1-indexed start line number of the relevant output within that file.
35
2) `【<chunk_id>†L<line_start>(-L<line_end>)?】`
36
- Where `chunk_id` is the chunk_id of the terminal output, `line_start` and `line_end` are the 1-indexed start and end line numbers of the relevant output within that chunk.
37
- Line ends are optional, and if not provided, line end is the same as line start, so only 1 line is cited.
38
- Ensure that the line numbers are correct, and that the cited file paths or terminal outputs are directly relevant to the word or clause before the citation.
39
- Do not cite completely empty lines inside the chunk, only cite lines that have content.
40
- Only cite from file paths and terminal outputs, DO NOT cite from previous pr diffs and comments, nor cite git hashes as chunk ids.
41
- Use file path citations that reference any code changes, documentation or files, and use terminal citations only for relevant terminal output.
42
- Prefer file citations over terminal citations unless the terminal output is directly relevant to the clauses before the citation, i.e. clauses on test results.
43
- For PR creation tasks, use file citations when referring to code changes in the summary section of your final response, and terminal citations in the testing section.
44
- For question-answering tasks, you should only use terminal citations if you need to programmatically verify an answer (i.e. counting lines of code). Otherwise, use file citations.

作者

OpenAI