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.
Install the Codex CLI config
Complete the Codex CLI setup first. This writes the 4096bytes connection values into the local Codex config directory.| System | config.toml | auth.json |
|---|---|---|
| macOS / Linux | ~/.codex/config.toml | ~/.codex/auth.json |
| Windows | %USERPROFILE%\.codex\config.toml | %USERPROFILE%\.codex\auth.json |
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
Verify
Open a local project and send a low-risk task in the Codex extension:Common issues
I already configured Codex CLI. Do I need to repeat setup?
I already configured Codex CLI. Do I need to repeat setup?
No. The Codex VS Code extension reads the same
~/.codex/ config. Install the extension, then restart VS Code.The extension still uses the old model or address
The extension still uses the old model or address
Put the new config at the beginning of
config.toml. Save it, close all VS Code windows, and reopen the project.The extension reports authentication failure
The extension reports authentication failure
Check that
auth.json is valid JSON. Confirm the API Key has no missing characters, newlines, or extra spaces.Remote - WSL config does not take effect
Remote - WSL config does not take effect
If the project runs in WSL, configure WSL’s
~/.codex/, not only %USERPROFILE%\.codex\ on Windows.