Codex - The Complete Guide to Deploying OpenAI's Coding Agent to VSCode

Codex and VS Code

Want a fast, safe way to bring Codex into Visual Studio Code? This end-to-end guide shows you how to install the extension, choose the right safety mode, run local or cloud jobs, and write prompts that get reliable results. You do not need a separate API key; your ChatGPT login unlocks everything.

What You Will Learn

  • Installing the Codex extension and signing in
  • Picking the right operating mode for each task
  • Running work locally vs. delegating to the cloud sandbox
  • Troubleshooting common setup issues
  • Prompt templates you can adapt for your own repos

Meet Codex for VS Code

Codex is OpenAI's coding agent. Inside VS Code it can read entire projects, generate code, run tests, refactor files, and prepare pull requests. Light tasks execute directly in your workspace, while heavier jobs can run in an isolated cloud environment under your supervision.

Step 1: Install the Extension

  1. Open the Extensions view (Cmd/Ctrl + Shift + X).
  2. Search for Codex - OpenAI coding agent and click Install.
  3. A new Codex icon appears in the activity bar once the extension is ready.

Step 2: Sign In and Open a Project

Launch the Codex panel and sign in with the same account you use for ChatGPT. Then open the folder or repository you want Codex to assist with so it has the right context.

Step 3: Choose a Safety Mode

  • Chat: Text-only guidance. Codex will not touch files or run commands.
  • Agent (recommended default): Allows file edits and command execution inside the workspace. Any attempt to leave the workspace or use the network will trigger an approval prompt.
  • Agent - Full Access: Grants unrestricted access. Use it sparingly and only when you explicitly need background tasks to keep running.

Step 4: Try Your First Prompts

Start locally with tasks such as:

  • Remove unused TypeScript imports under src/ and show a diff.
  • Jest tests are failing. Identify the failures and fix them with minimal changes.
  • Improve the accessibility of components/Button.tsx and explain what changed.

Codex returns diffs, logs, and validation details so you can accept or reject its work.

Step 5: Send Heavy Work to the Cloud

For long-running commands, large dependency installs, or operations that need network access, launch a cloud run from the Codex sidebar. Your conversation history carries over, results sync back to VS Code, and you can apply only the changes you approve.

Optional: Codex CLI for Power Users

  • Install with npm install -g @openai/codex or brew install codex.
  • Start the interactive UI with codex, or run one-off jobs with codex exec "fix the CI failure".
  • Choose approval modes (auto, read-only, full-access) depending on how much autonomy you want to grant.
  • Windows users should run the CLI inside WSL for best stability.

Prompt Templates to Reuse

  • Bug fix: Tests in tests/ are failing. Identify the failures and make the smallest changes required to pass.
  • Refactor: Make components/Button.tsx accessible (ARIA and keyboard) and show a diff.
  • Quality: Enable strict TypeScript and ESLint, then update existing code to satisfy both.
  • PR prep: Bundle the changes into one commit and draft a PR summary with intent and test results.

Safety Checklist

  • Start in Agent mode; escalate to Full Access only when necessary.
  • Review every approval prompt and grant the minimum permissions required.
  • Inspect diffs and test logs before committing.
  • Move long or network-bound work to the cloud sandbox.

Troubleshooting Quick Answers

  • Extension missing? Open the Extensions view and search for Codex.
  • Can not sign in? Use your ChatGPT credentials; no GitHub login is needed.
  • Running on Windows? Use WSL for a smoother experience.
  • Need network access? Start a cloud run and approve the network request when prompted.

FAQ

  • Do I log in with GitHub? No. Use your ChatGPT account. GitHub comes into play only when creating pull requests.
  • Local or cloud? Run quick, incremental tasks locally. Offload heavy, long, or network-dependent jobs to the cloud.
  • Is Full Access safe to leave on? Keep it disabled until you specifically need it, then switch back to Agent mode.

Wrap-Up

Codex for VS Code is a powerful, safe coding partner once you understand its modes. Install the extension, sign in, start in Agent mode, and let Codex handle repetitive chores while you focus on product decisions.

Related article