Getting Codex running in VS Code takes a few minutes. Install the Codex extension that OpenAI publishes (its ID is openai.chatgpt), sign in with your ChatGPT account or an API key, and type a prompt into the sidebar. Under the hood it’s the same agent as the Codex CLI, and the two read the same configuration.
Before you send anything, though, the sandbox has already decided what Codex is allowed to touch. In the default workspace-write mode, network access stays off unless you enable it in config.toml, according to OpenAI’s agent approvals and security documentation (2026). I’d leave it that way until you have a reason not to.
It works in VS Code, VS Code Insiders, Cursor and Windsurf, on macOS, Windows and Linux.
What Do You Need Before Installing Codex in VS Code?
Mostly a paid ChatGPT plan. ChatGPT Plus, Pro, Business, Edu, and Enterprise plans include Codex in the IDE extension, while Free and Go include Codex only in the desktop app. An OpenAI API key also works if you’d rather pay per token. Beyond that you need an editor that runs VS Code extensions, on macOS, Windows or Linux.
Supported editors and operating systems
The extension works with VS Code, VS Code Insiders, Cursor, and Windsurf. The last two are VS Code forks, so they pick it up without any extra steps.
- Visual Studio Code and VS Code Insiders
- Cursor and Windsurf, both VS Code forks
Xcode and JetBrains IDEs get their own Codex integrations instead of this extension.
In Cursor, you install the same extension from Cursor’s own Extensions view, even though Cursor and stock VS Code differ in several ways.
Windows support took a while. At launch, OpenAI’s community post listed macOS and Linux, with Windows experimental and best run through WSL (August 2025). Platform support changed during 2025 and 2026, and the current extension page lists macOS, Windows and Linux.
These days the native Windows sandbox runs Codex in PowerShell without WSL or a VM. WSL2 is still there for when you need Linux-native tooling (OpenAI Windows documentation, 2026). Windows 11 is the recommended baseline. Windows 10 is best effort, and in practice it needs version 1809 or newer.
Plan requirements
Plus at $20 a month is the lowest tier whose listing names the IDE extension, according to OpenAI’s pricing page (November 2026). Free and Go list Codex in the desktop app only, subject to rollout.
Above that it gets more expensive fast:
- Pro starts at $100 a month (tiers at $100, $200 and $500) and includes everything in Plus
- Business costs $20 per user per month billed annually ($25 billed monthly), for teams of 2 or more
- Enterprise and Edu add enterprise security and priority processing on top of Business
- An API key works in the extension too, billed at API rates, but you lose the cloud features
GitHub subscribers have another route. GitHub documents a Codex extension powered by Copilot, available only on the Copilot Pro+ plan in VS Code Insiders. Narrow, but worth knowing about if you already pay for Pro+.
How to tell the right extension from look-alikes
“Codex” now covers a CLI, a desktop app, a cloud interface and the IDE extension. This guide is about the extension, which uses the same agent as the Codex CLI and shares the same configuration.
In the Marketplace, look for these details:
- Display name Codex – OpenAI’s coding agent
- Publisher OpenAI
- Extension ID openai.chatgpt
One tutorial opens with a warning that multiple Codex extensions exist. So check the publisher before you hit Install. Honestly, the ID is the quickest check.
How to Install the Codex Extension and Sign In

Installing it is the same routine as any other VS Code extension. No admin rights, no separate download. After install, the extension prompts you to sign in with your ChatGPT account or API key.
- Open the Extensions view in VS Code and search for Codex.
- Pick the listing published by OpenAI with the ID openai.chatgpt, then click Install.
- Sign in when prompted, with your ChatGPT account or an API key.
- Open a project folder so the first chat has files to work with.
- Click the Codex icon. If it isn’t visible, run “Codex: Open Codex Sidebar” from the Command Palette.
- Restart the editor if Codex still does not appear.
Sign in with ChatGPT or an API key
With ChatGPT sign-in, usage counts against your plan allowance and cloud features stay available.
An API key works differently. You’re billed at API rates, separate from your ChatGPT allowance, and there are no cloud features, per OpenAI’s pricing page (November 2026).
I’d go with ChatGPT sign-in for almost everyone. The API key only makes sense if you already pay for API credits and you never plan to send work to the cloud.
If the sidebar does not appear
In VS Code, Codex opens in the right sidebar by default. People still lose it.
The Command Palette entry gets you back every time, whether the icon got hidden, moved somewhere odd, or never rendered after install.
How to Run Your First Task With Editor Context

Select the code you care about and write a short prompt with the goal in it. Codex reads the editor state on its own, so you don’t need to paste anything. With context from open files and selected code, shorter prompts come back faster and closer to what you meant.
Open files, selections and @file references
The composer pulls context from open files in the editor, from whatever code you have selected, and from files you name with an @file reference. You can also reference recent chats directly from the composer, which helps when a task spills over into a second conversation.
OpenAI’s docs suggest starting with explaining code, a focused change, or debugging. Good advice. A narrow refactoring request on one selected function is much easier to review than a repo-wide code refactoring prompt (and you will be reviewing it).
Something like this, with one function selected, works well: “Add input validation for missing keys. Keep the return type unchanged.”
Switching model and reasoning effort
Limits matter here. On Plus, OpenAI’s pricing page (November 2026) estimates local messages per five-hour window at 17 to 180 for GPT-6.2 Sol and 350 to 3,000 for GPT-6 Luna. Those are estimates, and weekly limits may also apply. That’s a huge range, so watch your own usage for a week before trusting either end of it.
The model switcher sits under the chat input. The docs also cover adjusting reasoning effort. I use the heavier setting for hard bugs and drop to the lighter one for quick edits.
Slash commands worth knowing
Type / in the chat input to open the list, then keep typing to filter it.
/statusshows the thread ID, context usage and rate limits/reviewreviews uncommitted changes or compares against a base branch/localand/cloudswitch where the task runs/initgenerates an AGENTS.md scaffold for the project
OpenAI’s own pages disagree on one name. One version of the IDE slash command page lists /auto-context for toggling automatic IDE context, while a newer version lists /ide-context. Go with whatever your build shows.
Which Approval Mode Should You Use in Codex?
For most work, start with the mode that edits inside the project and asks before going outside it. OpenAI recommends the ask-for-approval mode as the starting point too. Read-only is good for planning sessions. Full access belongs in disposable environments and nowhere else.
Approval modes compared
| Mode | Runs without asking | Asks before | Best for |
|---|---|---|---|
| Read-only (Chat in 2025 docs) | Inspecting code | Any edit | Planning, explaining code |
| Ask for approval (Agent in 2025 docs) | Edits and commands inside the working directory | Outside edits, network access | Scoped edits in a Git repo |
| Approve for me (Auto-review) | Same boundary, eligible requests auto-reviewed | Requests auto-review denies | Long tasks with many prompts |
| Full access (Agent (Full Access) in 2025 docs) | Everything, network included | Nothing | Disposable containers or VMs only |
I matched the rows by behavior. There’s no official translation table. Also, sending requests to automatic review does not expand the sandbox, so Auto-review only changes who answers the prompt.
Why the mode names differ across pages
The 2025 extension docs name Chat, Agent and Agent (Full Access). OpenAI’s newer permission-mode page calls them Ask for approval, Approve for me and Full access.
Then JetBrains’ October 2026 help page lists Read-only, Workspace access, Auto review and Full access. Confusing, yes. Available modes vary by app version, execution environment, local configuration and organization requirements.
So ignore the labels and match by behavior. In the IDE extension the permissions control sits below the composer, and it’s worth glancing at, because the active mode is not always the one you enabled.
Sandbox modes and network access
Approval mode decides when Codex asks. The sandbox is a separate thing: it decides what Codex can touch at all.
read-onlyreads files and runs commands in a read-only sandbox, and it’s the recommended choice for folders without version controlworkspace-writeis the default for version-controlled folders, paired with on-request approvalsdanger-full-accessmeans no sandbox and no approvals, and the page labels it not recommended
Network access is off by default in workspace-write. To turn it on, add network_access = true under [sandbox_workspace_write] in config.toml.
Even in workspace-write, the .git, .agents, .codex and .aws directories stay read-only. Which is another reason to make your own Git checkpoints before and after each task, instead of hoping Codex handles it.
How to Review Codex Changes and Roll Them Back
Read the diff. Run the project’s own tests, then /review, and commit only what you could explain to a coworker. When something goes wrong, Git is your undo, not the chat.
Reading the diff and running checks
OpenAI’s extension page describes the loop as a summary plus a focused diff, with follow-ups in the same chat.
I look at the size of the change before I read any of it. If I asked for a one-file fix and eleven files changed, something went sideways.
- Run
git statusto see which files Codex touched - Run
git diff --statand compare the file count with what you asked for - Run the project’s tests and linters yourself
OpenAI’s best-practices guide says to ask Codex to create tests when needed, run the relevant checks, confirm the result, and review the work before you accept it. The same guide suggests naming a “done when” condition in the prompt, such as tests passing or a bug no longer reproducing. That one small habit cuts down a lot of back-and-forth.
When a task spans a dozen files, a refresher on what git diff actually reports helps.
Running /review before you commit
/review appears only when the open project is inside a Git repository. If you don’t see it, that’s usually why.
You can point it at a few different scopes:
- A base branch, where it finds the merge base and reviews your branch diff
- Uncommitted changes, including staged, unstaged and untracked files
- A single commit, reviewing that commit’s exact change set
- Custom instructions, so the review focuses on criteria you provide
Under Settings > Git, Inline runs /review in the current chat when possible, while Detached starts a separate review chat.
Rolling back when a task goes wrong
Commit a clean checkpoint before every task. After that, everything Codex does is disposable.
The built-in Undo button is blunt. A feature request on OpenAI’s developer forum points out that it reverts the entire task, even when you only want to discard part of it.
To throw the whole task away, git restore . discards edits to tracked files. Then git clean -n lists the new files Codex created, so you can check them before deleting anything.
Keeping part of it takes a little more work. Stage the hunks you want with git add -p and discard the rest.
If a bad change is already committed, revert the commit in Git instead of rewriting history.
How to Configure Codex With config.toml and AGENTS.md
The enforceable settings live in config.toml: model, approvals, sandbox, MCP servers. AGENTS.md is where plain-language instructions for each project go. The CLI and the IDE extension share the same configuration layers, so one edit covers both.
Where config.toml lives and which layer wins
To open it from the extension, select the gear icon in the top-right corner, then Codex Settings, then Open config.toml.
Codex resolves values in this order, highest precedence first:
- CLI flags and –config overrides
- Project .codex/config.toml files, closest to your working directory first
- Profile files selected with –profile
- User config at ~/.codex/config.toml
- Cloud-managed defaults for the signed-in workspace
- System config, /etc/codex/config.toml on Unix
- Built-in defaults
Project layers load only when you trust the project. Mark it untrusted and Codex skips project .codex/ layers, including local config, hooks and rules, while user and system config still load.
Provider, notification and telemetry keys belong in your user-level config. Codex ignores them in project-local files, which can be a confusing hour if you don’t know it.
One more gotcha. OpenAI’s advanced configuration page states that profiles are not currently supported in the IDE extension (version retrieved November 2026). A CLI profile won’t necessarily behave the same way in the editor.
Editor settings are a separate layer
config.toml controls the default model and provider, approval policies, sandbox settings and MCP servers.
Editor settings are their own thing. They cover how the extension behaves inside VS Code and compatible editors, using keys prefixed chatgpt.* in the editor’s settings system. OpenAI’s settings page says those keys “belong to the IDE extension and don’t go in config.toml.” VS Code stores them like any other setting, so you can edit them through the settings.json file.
How AGENTS.md is discovered
Codex reads AGENTS.md files before doing any work, layering global guidance with project-specific overrides.
- Global defaults sit in your Codex home directory and every repository inherits them
- Project files are read from the project root (typically the Git root) down to your current working directory
- Inside each directory, AGENTS.override.md wins first, then AGENTS.md, then fallback names, with at most one file per directory
There’s a cap on the combined size. Codex stops adding files once the total reaches project_doc_max_bytes, which is 32 KiB by default. When instructions get truncated, raise the limit or split large files across nested directories.
Run /init to generate an AGENTS.md scaffold for the project. If the repo already uses another filename, list it in project_doc_fallback_filenames (for example TEAM_GUIDE.md).
Checking that it loaded, and a retired value to remove
OpenAI’s guide suggests running codex --ask-for-approval never "Summarize the current instructions." from a repository root. Codex should echo guidance from the global and project files in precedence order. Since the CLI and the extension share configuration, a clean result there is a good first check.
Also, clean out an old value if you have it. approval_policy = “untrusted” is no longer supported. If it lingers in user config, project config, profile files, startup scripts or managed defaults, the client can fail to start.
For read-only interactive use, OpenAI’s replacement is sandbox_mode = “read-only” with approval_policy = “on-request”.
When Should You Delegate a Task to Codex Cloud?
Send it to the cloud when the work is long, well-scoped and doesn’t need you watching. Short interactive edits stay local.
Each cloud task gets its own workspace and keeps working while your computer is asleep. That’s the real appeal, honestly.
What happens when you start a cloud task
- Codex creates a container and checks out your repo at the selected branch or commit SHA.
- It runs your setup script, plus an optional maintenance script when a cached container is resumed.
- It applies your internet access settings.
Setup scripts run with internet access to install dependencies. During the agent phase, internet access is off by default, though you can configure limited or unrestricted access.
Setup scripts run in a separate Bash session from the agent, so an export does not persist. I’ve seen people lose time on this. Add variables to ~/.bashrc or the environment settings instead.
The task works from a remote repository, specifically any repository available to Codex through your connected GitHub account or GitLab account (GitLab support is in beta).
Local or cloud: a decision rule
| Factor | Local | Cloud |
|---|---|---|
| Where it runs | Your workspace, under the sandbox | Isolated container, own workspace per task |
| Starting state | Whatever is in your working tree | Selected branch or commit SHA |
| Network | Off by default in workspace-write | Online for setup, off by default for the agent |
| Results | Edits land in your working tree | A diff you inspect, then commit or open a pull request |
Cloud fits when the task is long, the repo is pushed, and the setup script covers every dependency.
If the task depends on work that only exists in your editor, keep it local. A cloud task starts from a branch or commit, so it never sees your unpushed edits.
Bringing the results back
In the IDE, /cloud-environment chooses the environment, and it is available only in cloud mode. Cloud tasks also appear in the Codex cloud interface.
From the terminal, codex apply takes a cloud task ID and applies that task’s latest diff to your local working tree with git apply.
And in the cloud chat itself you can inspect the changed files, request follow-up changes, then commit or open a pull request.
Where cloud tasks fail
- A task that installs packages mid-run has no network by default. Move installs into the setup script, which still has internet access.
- Enterprise workspaces require access to the published environment you select.
- Turning on agent internet access exposes the environment to security risks, which is why OpenAI supports allowlists of domains and HTTP methods. Use them.
Why Is Codex Not Showing Up or Asking for Approval Every Time?

Usually it’s one of a few things. The sidebar hangs on loading, a conversation won’t start, prompts keep showing up despite your settings, or the Windows sandbox refuses to set up.
OpenAI’s extension page has no troubleshooting section (retrieved November 2026). The dated reports below come from OpenAI’s developer forum instead.
| Symptom | Reported cause | First fix |
|---|---|---|
| Sidebar stuck on loading after an update | Extension build regression or corrupted local state (April and May 2026 reports) | Roll back the extension version |
| Prompts keep appearing | Mode and sandbox do not match the approval policy | Check the mode below the composer, then config.toml |
| Error starting conversation | 403 on a remote server, or a start-up timeout | Read the Codex log |
| Sandbox setup fails on Windows | Enterprise policy blocks setup (error 1385 means the sandbox users are denied the logon rights they need) | Ask IT to grant the logon rights or allow setup, or use WSL2 |
Stuck on loading or no login screen
This one has a long history.
- In August 2025, a Windows 11 user saw only “CODEX” and a blue loading bar on extension 0.5.0, with no login screen. One user in that thread fixed it by downgrading to 0.4.12.
- In the same thread, several users installed the CLI with
npm install -g @openai/codex, rancodex login, and the extension then opened directly. - Late April 2026 brought another case. After an update the extension stayed stuck even after reinstalling, and one user traced it to corrupted local Codex state and reset it.
- On May 14, 2026, an auto-update broke the sidebar on Windows 11, and rolling back to openai.chatgpt@26.5506.31004 worked.
- Config can cause it too. One user fixed the hang by removing a model-provider setting from config.toml.
Run the CLI commands in the integrated terminal. And back up config.toml before you delete anything under ~/.codex. Please.
Conversation will not start
- A September 2025 report on a remote server showed “Failed to Load Tasks” with a 403 Forbidden in the log.
- In Cursor, opening the sidebar or sending a prompt spun for 30 to 45 seconds before “Error starting conversation.” Oddly, one user found that opening Task History while Codex was thinking unblocked it.
- A user on VS Code remote SSH reported the loading screen persisting after uninstall, reinstall and a window reload.
- On Windows, enterprise policy can block sandbox setup, such as local user creation, firewall changes or the logon rights the sandbox users need (error 1385 signals the logon-rights case).
With the MXC sandbox, child processes stop when the foreground command exits, so detached dev servers may not survive.
Prompts that will not stop
A lot of people read approval_policy = never as “approve everything.” It isn’t. It means Codex never asks, and it works with any sandbox mode.
Codex makes a best effort within the constraints you set. With workspace-write, an edit outside the workspace is not approved silently. It just stays out of reach.
Only Full access, which runs with no sandbox and no approvals, removes both the prompts and the walls.
The sources don’t fully agree here. The docs describe never as never asking, while one forum post lists GitHub issue 5038, reporting that the VS Code extension ignores approval_policy=”never”, as open.
To see what’s actually active, run /status in the CLI. It shows the active model, approval policy, writable roots and token usage.
Common Questions About Codex in VS Code
Should I use the Codex extension or the Codex CLI?
It comes down to how you like to work, since the extension uses the same agent as the Codex CLI and shares its configuration. For editor-driven work I’d pick the extension, because it sees open files and selections on its own.
The CLI can reach the same context through its /ide command.
Is Codex the same as GitHub Copilot?
No. You hand Codex a task and it reads, edits and runs code to get it done. It’s a coding agent.
Copilot began as inline autocomplete and has since added agents. DataCamp’s 2026 comparison lists no real-time inline autocomplete for Codex, which is the clearest practical difference.
Does Codex search the web while it works in VS Code?
Yes, for local tasks. OpenAI documents web search as enabled by default in the extension, with results served from a cache.
That cache is an OpenAI-maintained index, so you get pre-indexed results instead of live pages. A web_search setting in config.toml chooses the mode.
How do I stop the Codex extension from auto-updating?
Set extensions.autoUpdate to false in VS Code settings. One Cursor user did exactly that to pin a build.
That same user also found Install Specific Version failing for openai.chatgpt with “requested version was not found.” Test a rollback before you actually need one.
Do previous chats survive a VS Code restart?
Not reliably. An August 2025 forum request reported local chats disappearing after a restart, and a May 2026 thread describes the extension breaking while opening previous chats.
Current docs let you reference recent chats directly from the composer.
When Should the Codex Extension Use an API Key?
Run it on a ChatGPT plan first. An API key only wins once local work keeps hitting the plan’s usage limit and you’ve stopped caring about cloud tasks.
The order I’d go in:
- Plan allowance
- Credits (Plus and Pro for individuals; Business, Edu and Enterprise workspaces on flexible pricing buy workspace credits)
- API key for local overflow
Credits come before the key because they keep cloud delegation working. Plus and Pro subscribers can buy additional credits once they reach their usage limit.
An API key gets rid of the five-hour window. You pay for that with per-token billing on every local session.
Pricing on the fast models is also shifting. As of November 20, 2026, eligible overages on GPT-6.2 Astra and GPT-6.2 Sol in Ultrafast mode, paid with purchased credits, cost 3x the Standard rate through February 28, 2027, then 6x from March 1, 2027 (Pacific time). Ultrafast mode is available only on the $500 Pro tier. Put that date on your calendar, because it’s when comparing credit overage against API rates is worth doing again.
- How to Choose a Digital Transformation Consulting Partner - November 30, 2026
- Is Notepad++ Safe? Official Download, Updates, CVEs - November 29, 2026
- How to Evaluate an AI Code Reviewer on Your Own Pull Requests - November 29, 2026



