Skip to main content
The Codex VS Code extension can reuse the local Codex CLI configuration. Configure config.toml and auth.json first, then install the Codex extension in VS Code. If you already completed the Codex setup, install the extension and restart VS Code. You do not need to create another API Key.

Prerequisites

  • You have completed Create an account.
  • You have completed Get an API Key.
  • VS Code is installed.
  • You have completed the Codex CLI setup on the Codex page.
  • The Use key dialog is open for the API Key you want to use.
The API Key in auth.json is stored as a local plaintext credential. Do not commit ~/.codex/auth.json, screenshots, or terminal output to a repository or chat.

Install the Codex CLI config

Complete the Codex CLI setup first. This writes the 4096bytes connection values into the local Codex config directory.
Systemconfig.tomlauth.json
macOS / Linux~/.codex/config.toml~/.codex/auth.json
Windows%USERPROFILE%\.codex\config.toml%USERPROFILE%\.codex\auth.json
Use the model, review_model, base_url, and API Key values shown in the dashboard. See the Codex page for field meanings. If you use VS Code Remote - WSL, write the config into WSL’s ~/.codex/ directory.

Install the VS Code extension

1

Open Extensions

Open the Extensions panel in VS Code.
2

Install the Codex extension

Search for the Codex extension published by OpenAI, then click Install.
3

Restart VS Code

After installation, close all VS Code windows and reopen your project.
4

Use Codex

Open the Codex entry in VS Code. The extension reads the local Codex config.

Verify

Open a local project and send a low-risk task in the Codex extension:
Describe the purpose of the current project in one sentence. Do not modify files.
If the extension responds without authentication or model errors, the config is active.

Common issues

No. The Codex VS Code extension reads the same ~/.codex/ config. Install the extension, then restart VS Code.
Put the new config at the beginning of config.toml. Save it, close all VS Code windows, and reopen the project.
Check that auth.json is valid JSON. Confirm the API Key has no missing characters, newlines, or extra spaces.
If the project runs in WSL, configure WSL’s ~/.codex/, not only %USERPROFILE%\.codex\ on Windows.