# ChatGPT desktop app (/docs/code-cli/chatgpt-desktop)

The ChatGPT desktop app for macOS and Windows has a **Codex** side that reads the same `~/.codex/config.toml` as [Codex CLI](/docs/code-cli/codex). Add an OhMyGPT provider to that file and save your key next to it, and every Codex chat in the app sends its requests to OhMyGPT. The ChatGPT side of the app, both **Chat** and **Work**, keeps sending requests to OpenAI on your ChatGPT plan.

## Configure [#configure]

1. Add the provider to `~/.codex/config.toml`. On Windows the file is `%USERPROFILE%\.codex\config.toml`.

   ```toml title="~/.codex/config.toml"
   model = "openai/gpt-5.5"
   model_provider = "ohmygpt"

   [model_providers.ohmygpt]
   name = "OhMyGPT"
   base_url = "https://api.ohmygpt.com/v1"
   env_key = "OHMYGPT_API_KEY"
   wire_api = "responses"
   ```

2. Save your key in `~/.codex/.env`. On Windows the file is `%USERPROFILE%\.codex\.env`.

   ```bash title="~/.codex/.env"
   OHMYGPT_API_KEY=sk-...
   ```

3. Quit the app completely, not only its window, and open it again.
4. Choose **Codex** and start a new chat.

Codex loads `~/.codex/.env` each time it starts. An app opened from the Dock or the Start menu does not see variables exported in `~/.zshrc` or in a terminal, so `export OHMYGPT_API_KEY=...` does not reach it.

Keep `model_provider` and `[model_providers.ohmygpt]` in the `config.toml` in your home directory. Codex ignores both in a project's `.codex/config.toml`.

## Check the connection [#check-the-connection]

Codex sends Responses requests. Send one to the free test model `ohmygpt/mock`:

```bash
curl https://api.ohmygpt.com/v1/responses \
  -H "Authorization: Bearer $OHMYGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ohmygpt/mock", "input": "ping"}'
```

```json
{
  "id": "resp_hC1CMOi7mwfldv2Wymxj3kVl",
  "object": "response",
  "status": "completed",
  "model": "ohmygpt/mock",
  "output": [
    {
      "type": "message",
      "id": "msg_0",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "This is a mock reply from OhMyGPT. Your integration works; switch to a real model when ready."
        }
      ]
    }
  ],
  "usage": { "input_tokens": 15, "output_tokens": 17, "total_tokens": 32 }
}
```

To check the app itself at no cost, set the model to the mock and turn off web search, which the mock does not support:

```toml title="~/.codex/config.toml"
model = "ohmygpt/mock"
model_provider = "ohmygpt"
web_search = "disabled"

[model_providers.ohmygpt]
name = "OhMyGPT"
base_url = "https://api.ohmygpt.com/v1"
env_key = "OHMYGPT_API_KEY"
wire_api = "responses"
```

Quit and reopen the app, then send any message in a new Codex chat. The reply is the mock text shown above. The mock is available once your account has been topped up.

## Choose a model [#choose-a-model]

The model picker in the app lists OpenAI's GPT models, such as `gpt-6.2-sol` and `gpt-5.5`. With this setup, each of them runs on OhMyGPT. The picker does not list other OhMyGPT models. To use one, set its ID as `model` in `config.toml`, then quit and reopen the app.

List the models you can use with Codex:

```bash
curl -s https://api.ohmygpt.com/v1/models \
  | jq -r '.data[] | select(.available and any(.protocols[]?; .id == "openai-responses")) | .id'
```

Prices for each are on the [Models](https://www.ohmygpt.com/models) page.

Codex adds a `web_search` tool to every request. Models from other creators, such as `zhipu/glm-5.3`, reject it, so turn web search off when you use one:

```toml title="~/.codex/config.toml"
model = "zhipu/glm-5.3"
model_provider = "ohmygpt"
web_search = "disabled"

[model_providers.ohmygpt]
name = "OhMyGPT"
base_url = "https://api.ohmygpt.com/v1"
env_key = "OHMYGPT_API_KEY"
wire_api = "responses"
```

Put `web_search` above the `[model_providers.ohmygpt]` line. A key below that line belongs to the provider, and Codex does not read it as a setting.

## Troubleshooting [#troubleshooting]

| Symptom | Cause | Fix |
|---|---|---|
| ``Missing environment variable: `OHMYGPT_API_KEY`.`` | `~/.codex/.env` is missing, is in another folder, or was saved after the app started | Save the key as in [Configure](#configure), then quit and reopen the app |
| `400` saying ``The `web_search` tool is not available for the model`` | The model does not support web search | Add `web_search = "disabled"` above `[model_providers.ohmygpt]` |
| `failed to load configuration` followed by a line and column in `config.toml` | The file has a TOML syntax error at that position | Fix the line, then quit and reopen the app |
| Codex replies, but [Usage](https://www.ohmygpt.com/usage) shows no requests | The app did not load the provider. `config.toml` is in another folder, or the app was not fully quit | Move the file to your home directory's `.codex` folder, then quit and reopen the app. If nothing changes, end the ChatGPT processes left in Activity Monitor or Task Manager |
| The app reports a usage limit and does not send | The app checks the Codex allowance of the signed-in ChatGPT account, even when requests go to OhMyGPT | Wait for the ChatGPT allowance to reset |
| `401` with `Invalid API key` | The key is mistyped or was deleted | Copy a key from [API keys](https://www.ohmygpt.com/keys) |
| `404` saying the model does not exist | The ID is misspelled | Copy the ID from `GET /v1/models` |
| `402` | The balance or the key's spending limit is used up | Top up at [Billing](https://www.ohmygpt.com/billing) |

Every response carries an `X-Request-ID` header, and [Usage](https://www.ohmygpt.com/usage) shows what each request cost.
