# Codex App (Desktop)

> Configure the LMU AI API base URL and key in the Codex App desktop client — works on both Windows and Mac.

URL: https://docs.lmuai.ai/docs/tools/codex-app



If you don't want to install the Codex CLI and just want to use the **Codex App desktop client**, follow this method.

<Callout type="warn" title="Note">
  * If you've previously signed in with your own account, first **sign out of the current account** in the Codex App, then reconfigure.
  * After you switch the API, your chat history will be gone (account-type chat history is stored in your GPT account's space, not locally).
  * **After you switch to the API login, all chat history from then on is saved locally and won't be lost!**
</Callout>

***

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

Config file location:

* **Mac/Linux**: the `.codex` folder in your home directory (`~`)
* **Windows**: `C:\users\your-username\.codex\`

If the folder already exists, it's best to delete the `config.toml` inside it (and any `auth.json` left over from the old guide) and recreate it, to avoid interference from old config.

**Create the folder with a terminal command:**

```bash
# Mac/Linux
rm -rf ~/.codex && mkdir ~/.codex
```

Create `config.toml` in the `.codex` folder.

### config.toml [#configtoml]

Configure the service provider; the API key goes in a request header at the very end of the file:

```toml
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"

[model_providers.codex.http_headers]
Authorization = "Bearer your sk- key generated in the console"
```

Replace the last line with your `sk-` key, keeping one space between `Bearer` and the key. Put the `[model_providers.codex.http_headers]` section at the very end of the file, with no other settings after it.

<Callout type="info">
  It's usually inside the `.codex` folder in your home directory. If you can't find the `.codex` folder there, you can create the folder manually, then create `config.toml` in it.

  The config file contents are identical to the [Codex CLI Mac/Linux setup guide](/docs/tools/codex-cli-mac) — you can follow that guide to create them in the terminal, and they take effect after restarting the Codex App just the same.
</Callout>

***

## Step 2 — Reopen the Codex App [#step-2--reopen-the-codex-app]

After saving the config files, reopen the Codex App and it will sign in and be ready to use automatically.

***

## 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. Add two lines at the **top level** of the `config.toml` above (before any `[section]`), then restart the Codex App:

```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).

***

## Common errors [#common-errors]

**Error 401, incorrect key:**

Cause: the request is still going to OpenAI's official endpoint rather than our API relay, or you didn't restart the tool to reload the config file.

Fix: follow the guide again to create or replace `config.toml`, then reopen the app.

**Error 401 API\_KEY\_REQUIRED:**

Cause: newer Codex versions may no longer read the key from `auth.json`, so the request carries no key.

Fix: add the `[model_providers.codex.http_headers]` section at the end of `config.toml` as shown above; see [FAQ · Issue 10](/docs/guide/faq#issue-10).
