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

# Codex

> Configure a Codex provider, authorize local ~/.codex/, and add custom models and environment variables.

Codex uses `@openai/codex-sdk`. Config is written to `~/.codex/`. You can also authorize reading files you already have locally.

Install the Codex SDK in **Settings → SDK dependencies** first. If the install is incomplete (CLI integrity is missing), the status stays **Not installed**.

<img src="https://mintcdn.com/mossx-docs/kz4nt5KFSKzkAZwe/images/vscode/provider-codex.png?fit=max&auto=format&n=kz4nt5KFSKzkAZwe&q=85&s=32bb525a650aadc438a9d088da341bc7" alt="Codex provider page" width="100%" data-path="images/vscode/provider-codex.png" />

## Ways to connect

### Add a provider

Click **Add provider** and fill in a name and config JSON. The UI edits two blocks:

* **config**: `model_provider`, `model`, `model_providers`, and similar fields
* **auth**: auth fields such as `OPENAI_API_KEY`

You can also pick official OpenAI direct access, or a third-party / proxy preset. Official direct uses `https://api.openai.com`.

Saving writes to `~/.codex/` immediately.

### Authorize local config

If you already use the Codex CLI in a terminal:

1. Run `codex login` in a terminal and confirm you can ask a question
2. In CC GUI, authorize reading `~/.codex/config.toml` and `auth.json`
3. Restart VS Code

Authorization is read-only. It does not overwrite those two files. You can revoke it at any time.

## Custom models and environment variables

Each Codex provider can add models:

* Model ID is required. Letters, numbers, dots, hyphens, underscores, slashes, and colons are allowed
* Display name and description are optional
* You can set a context window separately (unit: K tokens)

You can also add environment variables for two kinds of child processes:

| Type                          | Use                                    |
| ----------------------------- | -------------------------------------- |
| Message environment variables | Sent to the Codex chat process         |
| MCP environment variables     | Sent to the MCP tool-discovery process |

A variable name must start with a letter or underscore. Built-in protected variables cannot be overwritten.

## How this differs from Claude

| Capability            | Codex                                        |
| --------------------- | -------------------------------------------- |
| Plan mode             | No                                           |
| Permissions / sandbox | Set separately in **Settings → Permissions** |
| Fast mode             | A switch under the input box                 |
| Abort a request       | Quiet interrupt. No ERROR bubble             |
| Some settings pages   | A few entries may not match Claude yet       |

For everyday code changes, use Default or Agent. If you want a plan before files change, switch to Claude Code plan mode.

## Usage

**Settings → Usage** can estimate cost only after you add input / output / cache prices on the model. Empty prices fall back to the default rates.

## Next steps

* [Provider overview](/en/vscode/providers/overview)
* [Detect and install](/en/vscode/providers/cli)
* [Send the first message](/en/vscode/start/first-task)
