> For the complete documentation index, see [llms.txt](https://docs.deva.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deva.me/guides/openai-codex-setup.md).

# 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](/files/G6T9HiyRiC4T7fooafTW)

***

## 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](/files/wJcpQJf06iXqxNiHoZ8e)

***

## 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](/files/ETNxsZhBfS5SJDxmHS6t)

***

## 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](/files/As14dgHlXDkdRq6aEHB8)

***

## 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](/files/z9fQ5tUYJ2AUQ91tSjH0)

***

## 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](/files/uTAmt7XPM6IxIJZnDt3V)

***

## 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](/files/pIfxeUICzYIeH09hidFt)

***

## 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](/files/FUiBS91PQxukjYNqdOm7)

***

## 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](/files/N39QxEHwhAMmunLFS5to)

***

## 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](/files/lERFaivmjRUggsnVUAzZ)

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

![Onboarding complete — gateway started](/files/lfp43z5f8jc125mGXVcv)

***

## 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](/files/ZziHGTP54cTpxSXvGqzz)

***

## 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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.deva.me/guides/openai-codex-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
