> ## Documentation Index
> Fetch the complete documentation index at: https://docs.4096bytes.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex VS Code extension

> Reuse the Codex CLI 4096bytes config in VS Code

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](/en/clients/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](/en/quickstart/create-account).
* You have completed [Get an API Key](/en/quickstart/get-api-key).
* VS Code is installed.
* You have completed the Codex CLI setup on the [Codex](/en/clients/codex) page.
* The **Use key** dialog is open for the API Key you want to use.

<Warning>
  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.
</Warning>

## Install the Codex CLI config

Complete the [Codex CLI setup](/en/clients/codex) 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` |

Use the `model`, `review_model`, `base_url`, and API Key values shown in the dashboard. See the [Codex](/en/clients/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

<Steps>
  <Step title="Open Extensions">
    Open the **Extensions** panel in VS Code.
  </Step>

  <Step title="Install the Codex extension">
    Search for the Codex extension published by OpenAI, then click **Install**.
  </Step>

  <Step title="Restart VS Code">
    After installation, close all VS Code windows and reopen your project.
  </Step>

  <Step title="Use Codex">
    Open the Codex entry in VS Code. The extension reads the local Codex config.
  </Step>
</Steps>

## Verify

Open a local project and send a low-risk task in the Codex extension:

```text theme={null}
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

<AccordionGroup>
  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="The extension reports authentication failure">
    Check that `auth.json` is valid JSON. Confirm the API Key has no missing characters, newlines, or extra spaces.
  </Accordion>

  <Accordion title="Remote - WSL config does not take effect">
    If the project runs in WSL, configure WSL's `~/.codex/`, not only `%USERPROFILE%\.codex\` on Windows.
  </Accordion>
</AccordionGroup>
