# Codex CLI (Server)

> Deploy the Codex CLI on a WSL2 or SSH server and connect to the LMU AI API: install Node 20 with volta, then write config.toml and auth.json in one command.

URL: https://docs.lmuai.ai/docs/tools/codex-cli-server



For configuring the Codex CLI in a WSL2 or SSH remote server environment.

***

## Configuration steps [#configuration-steps]

### Step 1 — Install the Node.js environment (with volta) [#step-1--install-the-nodejs-environment-with-volta]

In the server terminal, run:

```bash
curl https://get.volta.sh | bash
```

### Step 2 — Install Node 20 [#step-2--install-node-20]

<Callout type="warn" title="Note">
  After volta installs successfully, you **must open a new terminal window** before running the following command:
</Callout>

```bash
volta install node@20
```

### Step 3 — Install the Codex CLI [#step-3--install-the-codex-cli]

```bash
volta install @openai/codex
```

### Step 4 — Create the config files [#step-4--create-the-config-files]

Run the following in the server terminal to write both `~/.codex/config.toml` and `~/.codex/auth.json` at once (**remember to replace the key in auth.json with the `sk-` key generated in the console**):

```bash
mkdir -p ~/.codex

cat > ~/.codex/config.toml <<'EOF'
model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
sandbox_mode = "danger-full-access"
windows_wsl_setup_acknowledged = true
approval_policy = "never"
file_opener = "vscode"
model_provider = "codex"
web_search = "cached"
suppress_unstable_features_warning = true

[history]
persistence = "save-all"

[tui]
notifications = true

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = false

[sandbox_workspace_write]
network_access = true

[features]
plan_tool = true
apply_patch_freeform = true
view_image_tool = true
unified_exec = false
streamable_shell = false
rmcp_client = true
elevated_windows_sandbox = true

[profiles.auto-max]
approval_policy = "never"
sandbox_mode = "workspace-write"

[profiles.review]
approval_policy = "on-request"
sandbox_mode = "workspace-write"

[notice]
hide_gpt5_1_migration_prompt = true

[model_providers.codex]
name = "codex"
base_url = "https://api.lmuai.ai"
wire_api = "responses"
requires_openai_auth = true
EOF

cat > ~/.codex/auth.json <<'EOF'
{
  "OPENAI_API_KEY": "your sk- key generated in the console"
}
EOF
```

The config contents are identical to the [Codex CLI (Mac/Linux) guide](/docs/tools/codex-cli-mac) — you can also create the two files by hand with `vim` / `nano`.

### Step 5 — Launch the Codex CLI [#step-5--launch-the-codex-cli]

```bash
codex --dangerously-bypass-approvals-and-sandbox
```

Or:

```bash
codex --yolo
```

***

## Enabling the 1M context (optional) [#enabling-the-1m-context-optional]

`gpt-5.4` supports a 1M-token long context, but it's off by default. Edit `~/.codex/config.toml`, add two lines at the **top level** of the file (before any `[section]`), and re-enter Codex:

```toml
model_context_window = 1000000
model_auto_compact_token_limit = 900000
```

For field meanings, how to verify, and caveats, see [Enabling the 1M context in Codex](/docs/tools/codex-cli-mac#enabling-the-1m-context-in-codex-optional).
