# Set Up OpenAI Codex

Genie uses OpenAI Codex as its AI provider. This guide walks you through the onboarding flow to connect your OpenAI account to your Genie server.

***

## Prerequisites

* A Genie account with a running server
* An OpenAI account with a ChatGPT subscription

***

## Step 1: Start the Onboarding

Open the terminal in your Genie dashboard and run:

```bash
openclaw onboard --auth-choice openai-codex
```

![Terminal with the onboarding command](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-43b61ea874c526624dc893f037f2e5ee43028bff%2Fcodex-start-onboard.png?alt=media)

***

## Step 2: Accept the Security Notice

The onboarding wizard shows a security baseline notice. Read through the recommendations — pairing/allowlists, sandbox configuration, secrets management — then confirm with **Yes** to continue.

![Security warning and confirmation prompt](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-fc69e130a281f8470524840fd692e0a7339a019e%2Fcodex-security-warning.png?alt=media)

***

## Step 3: Choose Onboarding Mode

Select **QuickStart** to use sensible defaults (you can fine-tune settings later with `openclaw configure`), or **Manual** for full control over every option.

![Onboarding mode selection — QuickStart or Manual](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-8167de2c32345a1b2e4c6baa92bb2ba816e31550%2Fcodex-onboard-mode.png?alt=media)

***

## Step 4: Handle Existing Config

If an existing configuration is detected, you will be asked how to proceed:

* **Use existing values** — keep your current settings
* **Update values** — modify specific fields
* **Reset** — start fresh

![Existing config detected with handling options](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-15a4b8a75db91f3697ff594ac2c8f1376d5117cf%2Fcodex-existing-config.png?alt=media)

***

## Step 5: Authenticate with OpenAI

The wizard generates an OAuth URL. Since your server runs in a remote/VPS environment, you need to:

1. Copy the URL displayed in the terminal
2. Open it in your **local browser** (on your own machine, not the server)

![OAuth URL displayed in terminal](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-6b25c00777ef85a9f511aa2d2b624c9c387c2f51%2Fcodex-oauth-url.png?alt=media)

***

## Step 6: Consent in Browser

In your browser, you will see the OpenAI consent page. Review the details — Codex will be linked to your ChatGPT account and use your plan's rate limits. Click **Continue**.

![OpenAI Codex consent page — Sign in with ChatGPT](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-7bd9021f000531981f7fbd3e8441b604693a2a4b%2Fcodex-openai-consent.png?alt=media)

***

## Step 7: Copy the Redirect URL

After consenting, your browser redirects to a `localhost` URL. On a remote server, this will show a **connection error** — this is expected.

Copy the **full URL** from your browser's address bar (it contains the authorization code).

![Browser showing localhost connection error — copy the full URL](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-3a8b98ea4ec10833657984dcf985093f77993ef2%2Fcodex-redirect-url.png?alt=media)

***

## Step 8: Paste the Redirect URL

Go back to the Genie terminal. At the "Paste the redirect URL" prompt, paste the URL you copied and press Enter.

![Terminal prompt to paste the redirect URL](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-f7fe2d6aa044c8b751af5eea646a65e5a69e1f6e%2Fcodex-paste-redirect.png?alt=media)

***

## Step 9: Select Channel (Optional)

You will be asked to select a messaging channel for OpenClaw (Telegram, Discord, Slack, etc.). You can choose one now or select **Skip for now** — channels can be added later with `openclaw channels add`.

![Channel selection list](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-63c2d57371a12db74fd8b1f5e389198e795f8b1e%2Fcodex-channel-select.png?alt=media)

***

## Step 10: Complete Onboarding

The wizard saves your configuration and runs through final checks:

* Config is written to `~/.openclaw/openclaw.json`
* Workspace and sessions are verified
* Skills status is displayed

![Config saved and skills status](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-a5042d7080fd759598b8e5a0117bd26d0f613746%2Fcodex-config-saved.png?alt=media)

You will see **"Onboarding complete"** and the OpenClaw gateway will start automatically.

![Onboarding complete — gateway started](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-0d5f9b590ef9c53ed1739c03ea790af2c1c1514a%2Fcodex-onboarding-complete.png?alt=media)

***

## Step 11: Set the Model

Run the following command to set OpenAI Codex as your active model:

```bash
openclaw models set openai-codex/gpt-5.3-codex
```

![Model set to openai-codex/gpt-5.3-codex](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-7a18ad3cf7461175b5d8e5bde63472e028fdf0f4%2Fcodex-set-model.png?alt=media)

***

## Verifying the Connection

1. Go to **Chat** in your Genie dashboard
2. Send a prompt to Genie
3. If you receive a valid response, OpenAI Codex is connected and ready to use

***

## Tips

* The localhost connection error in Step 7 is expected on remote/VPS environments — just copy the URL from the address bar
* You can reconfigure settings at any time with `openclaw configure`
* Channel setup can be done separately via `openclaw channels add`
* Your OpenAI plan's rate limits apply to all interactions through Genie
