AI 程式設計教程中文版
官方教程中文版產品入口

安裝和使用 IDE 擴充套件

說明如何安裝 Codex IDE extension,並理解它和本地專案、編輯器上下文、登入方式的關係。

Codex IDE extension 讓你在編輯器裡直接使用 OpenAI 的 coding agent(程式設計 Agent)。它可以 read(讀取)、edit(編輯)和 run code(執行程式碼),幫助你構建功能、修 bug、理解不熟悉的程式碼。

在 VS Code extension 裡,你可以把 Codex 放在 IDE 側邊欄裡和程式碼並排使用,也可以把任務 delegate(委託)給 Codex Cloud。

IDE 支援範圍、套餐權益、下載入口和編輯器整合會變化。安裝前先看官方 IDE 頁面和 pricing 頁面,不要依賴舊截圖、舊部落格或二手列表。

計劃包含內容見:

https://developers.openai.com/codex/pricing

官方概覽影片:

https://www.youtube.com/watch?v=sd21Igx4HtA

Extension setup

Codex IDE extension 支援 VS Code forks(VS Code 分支編輯器),例如 Cursor 和 Windsurf。

你可以從 Visual Studio Code Marketplace 安裝:

https://marketplace.visualstudio.com/items?itemName=openai.chatgpt

也可以按編輯器直接開啟安裝入口:

Codex IDE integrations 的平臺和編輯器覆蓋範圍以官方 IDE 文件為準。安裝時先確認當前編輯器、作業系統和登入方式是否仍被支援。

在 Windows 上,你可以用 Windows sandbox 原生執行 Codex;如果需要 Linux-native environment(原生 Linux 環境),也可以使用 WSL2。Windows 設定見:

https://developers.openai.com/codex/windows

安裝後,你會在 editor sidebar(編輯器側邊欄)看到 Codex。

在 VS Code 裡,Codex 預設開啟在右側邊欄。如果你安裝後沒有馬上看到 Codex,重啟 VS Code。

如果你使用 Cursor,activity bar(活動欄)預設是橫向顯示。摺疊的專案可能會隱藏 Codex,所以可以 pin(固定)它,並重新調整 extensions 的順序。

Codex extension 截圖:

https://cdn.openai.com/devhub/docs/codex-extension.webp

JetBrains IDE integration

如果你想在 JetBrains IDEs 裡使用 Codex,先確認官方 IDE 頁面或 JetBrains 官方頁面是否仍提供對應 integration。

它支援三種登入方式:

  • ChatGPT 登入。
  • API key。
  • JetBrains AI subscription(JetBrains AI 訂閱)。

參考入口:

https://blog.jetbrains.com/ai/2026/01/codex-in-jetbrains-ides/

Move Codex to the right sidebar

在 VS Code 中,Codex 會自動出現在 right sidebar(右側邊欄)。如果你更喜歡把它放在 primary sidebar(左側主邊欄),可以把 Codex icon 拖回左側 activity bar。

在 Cursor 這類 VS Code forks 中,你可能需要手動把 Codex 移到右側邊欄。移動前,可能還需要臨時修改 activity bar orientation(活動欄方向):

  1. 開啟 editor settings,搜尋 activity bar,位置在 Workbench settings。
  2. 把 orientation 改成 vertical
  3. 重啟編輯器。

設定截圖:

https://cdn.openai.com/devhub/docs/codex-workbench-setting.webp

然後把 Codex icon 拖到右側邊欄,例如放在 Cursor chat 旁邊。Codex 會作為 sidebar 裡的另一個 tab 出現。

移動完成後,可以把 activity bar orientation 重新設回 horizontal,恢復預設行為。

如果之後改變主意,隨時可以把 Codex 拖回 primary sidebar。

Sign in

安裝 extension 後,它會提示你使用 ChatGPT account 或 API key 登入。

ChatGPT plan、API key 和團隊賬號的可用方式、額度和計費口徑會變化。價格和額度見:

https://developers.openai.com/codex/pricing

Update the extension

Extension 會自動更新。

你也可以在 IDE 裡開啟 extension page,手動檢查是否有更新。

Set up keyboard shortcuts

Codex 提供可以繫結到 IDE keyboard shortcuts(快捷鍵)的 commands,例如:

  • toggle Codex chat(開啟/關閉 Codex 聊天)。
  • add items to the Codex context(把專案加入 Codex 上下文)。

檢視所有可用 commands 並繫結快捷鍵:

  1. 開啟 Codex chat。
  2. 選擇 settings icon(設定圖示)。
  3. 選擇 Keyboard shortcuts

命令列表見:

https://developers.openai.com/codex/ide/commands

Slash commands 列表見:

https://developers.openai.com/codex/ide/slash-commands

如果你剛開始使用 Codex,先讀 best practices guide:

https://developers.openai.com/codex/learn/best-practices

Work with the Codex IDE extension

下面是 IDE extension 最常用的能力。

Prompt with editor context

使用 open files(已開啟檔案)、selections(選區)和 @file references(檔案引用),用更短 prompt 得到更相關的結果:

https://developers.openai.com/codex/ide/features#prompting-codex

Switch models

使用 default model(預設模型),或切換到其他模型,發揮各自優勢:

https://developers.openai.com/codex/ide/features#switch-between-models

Adjust reasoning effort

lowmediumhigh 之間選擇 reasoning effort(推理強度),按任務在速度和深度之間取捨:

https://developers.openai.com/codex/ide/features#adjust-reasoning-effort

圖片生成

無需離開編輯器,就可以生成或編輯圖片;需要迭代時,也可以使用 reference assets(參考素材):

https://developers.openai.com/codex/ide/features#image-generation

Choose an approval mode

ChatAgentAgent (Full Access) 之間切換,根據你希望 Codex 擁有的 autonomy(自主程度)選擇模式:

https://developers.openai.com/codex/ide/features#choose-an-approval-mode

Delegate to the cloud

把較長任務交給 cloud environment,在 IDE 裡監控進度並 review 結果:

https://developers.openai.com/codex/ide/features#cloud-delegation

跟進雲端任務

預覽 cloud changes,繼續要求 Codex follow up,然後把生成的 diffs 應用到本地測試和收尾:

https://developers.openai.com/codex/ide/features#cloud-task-follow-up

IDE extension commands

瀏覽可從 command palette(命令面板)執行、也可以繫結快捷鍵的完整 commands:

https://developers.openai.com/codex/ide/commands

斜槓命令

用 slash commands 控制 Codex 行為,並從聊天裡快速修改常用設定:

https://developers.openai.com/codex/ide/slash-commands

Extension settings

透過 editor settings 調整模型、approvals 和其他預設行為:

https://developers.openai.com/codex/ide/settings

接下來去哪

本頁目錄