Codex in VS Code: the extension and the CLI

There are two ways to put Codex in VS Code and they are good at different things. The extension gives it your editor context. The CLI in the integrated terminal gives you flags, sandboxes and scripts. Most people end up running both.

By the Continuum team. We build a workbench that runs Claude Code, Codex, and their peers, so the model rates quoted here are the ones our own cost analytics ship with.

The short version

Install the extension published by OpenAI, identifier openai.chatgpt, from the Visual Studio Marketplace or with code --install-extension openai.chatgpt. It works in VS Code, Cursor and Windsurf. Sign in with the same ChatGPT account the CLI uses. For anything scripted, sandboxed by flag, or non-interactive, open the integrated terminal and run codex there instead. Both read the same ~/.codex configuration and AGENTS.md.

What you need to know
  • Extension identifier: openai.chatgpt, publisher OpenAI.
  • One command: code --install-extension openai.chatgpt.
  • Same extension works in Cursor and Windsurf. JetBrains and Xcode pick Codex inside their own assistant.
  • Command Palette: Codex: Open Codex Sidebar.
  • The integrated terminal is not a downgrade: it is where exec, -s and -c live.
  • Both surfaces read the same AGENTS.md and the same ChatGPT plan.

Which one you want

You want toUseWhy
Ask about the file you are looking atExtensionSelection and open files are context automatically
Read a large agent changeExtensionDiffs render in the editor, not the terminal
Run with a specific sandboxTerminal-s read-only, -s workspace-write
Pipe output into somethingTerminalcodex exec
Override one config key for one runTerminal-c model_reasoning_effort="high"
Resume yesterday's sessionTerminalcodex resume
Hand a long job off and keep workingExtensionDelegates to Codex cloud from the sidebar

Installing the extension

Fastest route, from any shell.
code --install-extension openai.chatgpt

# Cursor and Windsurf ship their own CLI with the same flag
cursor --install-extension openai.chatgpt
01

Or install it from the marketplace

Open the Extensions view, search Codex, and take the one published by OpenAI. Check the identifier reads openai.chatgpt before installing: the marketplace has a long tail of look-alikes with similar names.

02

Open the sidebar

Command Palette, then Codex: Open Codex Sidebar. That is the surface you will spend all your time in.

03

Sign in

Use Sign in with ChatGPT to draw on your Plus, Pro, Business, Edu or Enterprise plan. The API key option exists and bills per token instead, which is almost never what you want at a desk.

04

Point it at the repository root

Open the repository as the workspace folder, not a subdirectory. The workspace root is what scopes the agent, the same way the launch directory scopes the CLI.

What the extension is actually good at

Three things, and it is worth being blunt that everything else is better in the terminal.

Context you did not have to describe

Your open files and current selection are already context. In the terminal you would paste a path or a range and hope you got it right. For "why is this function slow" with the function on screen, that alone is the reason to use the extension.

Review that renders as a diff

Changes arrive as a summary plus a focused diff in the editor, with your own syntax highlighting, your own theme, and the ability to jump to any hunk. Terminal diffs are fine for twenty lines and painful for four hundred.

Handing a long task to the cloud

When a task turns out to be bigger than the sitting, the sidebar can move it to Codex cloud, which keeps running when you close the laptop. It works from a clone of your repository, so anything uncommitted is invisible to it. Commit or push first, or it will confidently solve the wrong version of the code.

Running the CLI in the integrated terminal

The integrated terminal is a real terminal, so the CLI needs nothing special. What follows is the setup that makes it pleasant rather than merely possible.

Open a terminal with Ctrl+` and start where the workspace is.
codex                          # interactive, cwd is the workspace root
codex -s read-only             # explore an unfamiliar repo safely
codex -C packages/api          # scope it to one package in a monorepo
codex resume                   # continue the previous session
codex exec "run the tests and fix what fails"   # non-interactive

A dedicated terminal profile

Give Codex its own profile and it gets a labelled tab instead of competing with your build output.

.vscode/settings.json
{
  "terminal.integrated.profiles.osx": {
    "codex": {
      "path": "codex",
      "icon": "sparkle"
    }
  },
  "terminal.integrated.profiles.linux": {
    "codex": {
      "path": "codex",
      "icon": "sparkle"
    }
  }
}

A task for the run you repeat

.vscode/tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Codex: review staged diff",
      "type": "shell",
      "command": "codex exec -s read-only \"review the staged diff, P0 and P1 only\"",
      "presentation": { "reveal": "always", "panel": "dedicated" },
      "problemMatcher": []
    }
  ]
}

Other editors

How Codex reaches each editor, August 2026.

EditorHowNotes
VS CodeExtension openai.chatgptThe reference implementation
CursorThe same extensionRuns alongside Cursor's own agent
WindsurfThe same extensionSame install command
JetBrains IDEsAI Chat, then select CodexNative, no marketplace install
XcodeCoding assistant, then select CodexNative, no marketplace install
Anything elseCLI in a terminalWorks everywhere

In Cursor and Windsurf you now have two agents in one window. That is genuinely useful, and also the fastest way to lose track of which one made a change. Pick one per task rather than per file.

When it misbehaves

SymptomCauseFix
Sidebar never appearsExtension disabled for the workspaceExtensions view, enable for this workspace
codex: command not found in the panelPATH is interactive-onlyMove the export to ~/.zprofile
Signed in but no plan usageAn OPENAI_API_KEY is setunset OPENAI_API_KEY, sign in again
Edits land outside the projectWorkspace opened at the wrong folderReopen at the repository root
Cloud task misses your changesIt works from a cloneCommit and push first
Two agents editing the same fileCursor agent plus CodexOne agent per task, or use worktrees

Questions people ask

It is listed as Codex, published by OpenAI, with the identifier openai.chatgpt. Install it from the Extensions view or with code --install-extension openai.chatgpt.

Open the integrated terminal with Ctrl+` and run codex. The workspace root becomes the working directory, so the agent is scoped to the folder you opened. Add a terminal profile so it gets its own labelled tab.

Yes. Both are VS Code forks and take the same openai.chatgpt extension. You end up with two agents in one editor, so decide which one owns a given task before you start it.

You do not install a separate plugin. In JetBrains IDEs open AI Chat and select Codex as the agent; in Xcode open the coding assistant and do the same.

Yes. Sign in with ChatGPT in either and the same Plus, Pro, Business, Edu or Enterprise plan covers both. Usage from both counts against one set of limits, not two.

Your PATH is set in an interactive-only shell file such as .zshrc. Move the export to .zprofile or .profile, which login shells read, then restart the window.

Yes, while it runs locally. If you delegate the task to Codex cloud it switches to a clone of your repository and stops seeing anything you have not pushed.

The extension when the editor already has the context, which is most reading and reviewing. The CLI when you need a flag: a specific sandbox, a config override, non-interactive exec, or resuming a prior session.

Sources

Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.

  1. Codex documentation: IDE extension
  2. Visual Studio Marketplace: Codex by OpenAI
  3. openai/codex on GitHub
Try it

Outside the editor,
watching all of it.

Continuum tracks Codex sessions from the extension, the terminal and the app in one sidebar, with quota gauges and spend by repo.

free app · your subscriptions · local-first