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.
- 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,-sand-clive. - Both surfaces read the same
AGENTS.mdand the same ChatGPT plan.
Which one you want
| You want to | Use | Why |
|---|---|---|
| Ask about the file you are looking at | Extension | Selection and open files are context automatically |
| Read a large agent change | Extension | Diffs render in the editor, not the terminal |
| Run with a specific sandbox | Terminal | -s read-only, -s workspace-write |
| Pipe output into something | Terminal | codex exec |
| Override one config key for one run | Terminal | -c model_reasoning_effort="high" |
| Resume yesterday's session | Terminal | codex resume |
| Hand a long job off and keep working | Extension | Delegates to Codex cloud from the sidebar |
Installing the extension
code --install-extension openai.chatgpt
# Cursor and Windsurf ship their own CLI with the same flag
cursor --install-extension openai.chatgpt
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.
Open the sidebar
Command Palette, then Codex: Open Codex Sidebar. That is the surface you will spend all your time in.
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.
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.
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.
{
"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
{
"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.
| Editor | How | Notes |
|---|---|---|
| VS Code | Extension openai.chatgpt | The reference implementation |
| Cursor | The same extension | Runs alongside Cursor's own agent |
| Windsurf | The same extension | Same install command |
| JetBrains IDEs | AI Chat, then select Codex | Native, no marketplace install |
| Xcode | Coding assistant, then select Codex | Native, no marketplace install |
| Anything else | CLI in a terminal | Works 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
| Symptom | Cause | Fix |
|---|---|---|
| Sidebar never appears | Extension disabled for the workspace | Extensions view, enable for this workspace |
codex: command not found in the panel | PATH is interactive-only | Move the export to ~/.zprofile |
| Signed in but no plan usage | An OPENAI_API_KEY is set | unset OPENAI_API_KEY, sign in again |
| Edits land outside the project | Workspace opened at the wrong folder | Reopen at the repository root |
| Cloud task misses your changes | It works from a clone | Commit and push first |
| Two agents editing the same file | Cursor agent plus Codex | One 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.