> ## Documentation Index
> Fetch the complete documentation index at: https://www.agent37.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI API

> Set up OpenClaw with an OpenAI API key in Agent 37

Follow the steps below or watch the video walkthrough:

## Video walkthrough

<iframe src="https://www.youtube.com/embed/QQVIDCEFVaA" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

<Info>
  **Prerequisites**:

  * An active [Agent 37 account](https://www.agent37.com/dashboard)
  * A running OpenClaw instance in Agent 37
  * An [OpenAI Platform](https://platform.openai.com/) account
  * A valid OpenAI API key
</Info>

## Step 1: Create your OpenAI API key

1. Go to the [OpenAI API keys page](https://platform.openai.com/api-keys) and sign in.
2. Click **Create new secret key**.
3. Enter a name for the key so you can identify it later.
4. If prompted, choose the project or permissions you want to use.
5. Copy the generated key and store it somewhere safe.

<Frame>
  <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-33.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=fca61483ef7f3b0e5bd4778223b452a8" alt="Image" width="2048" height="979" data-path="images/image-33.png" />
</Frame>

OpenAI API keys typically start with:

```text theme={null}
sk-...
```

<Warning>
  Keep this key private. OpenAI recommends treating API keys as secrets and not exposing them in client-side apps or public repos.
</Warning>

## Step 2: Open your Agent 37 instance

1. Go to the [Agent 37 dashboard](https://www.agent37.com/dashboard) and sign in.
2. Open an existing instance, or create a new one.
3. Open **Terminal**.

## Step 3: Configure OpenClaw to use OpenAI

In Terminal, run:

```bash theme={null}
openclaw configure
```

When prompted, choose the following:

1. **Where will the gateway run?** → `Local`
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-44.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=4fe5b58ca3e29614523e29478036b916" alt="Image" width="1490" height="754" data-path="images/image-44.png" />
   </Frame>
2. **Select Section to Configure?** → `Model`
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-43.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=1e413a8cdef45138d86995ff35993769" alt="Image" width="1606" height="1022" data-path="images/image-43.png" />
   </Frame>
3. **Model / Auth Provider** → `OpenAI`
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-42.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=8b5d1efd4369d5b1573447be12c88d87" alt="Image" width="1264" height="1446" data-path="images/image-42.png" />
   </Frame>
4. **OpenAI Auth Model** → `OpenAI API Key`
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-41.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=928a4393309b12008371fa224f861354" alt="Image" width="1310" height="836" data-path="images/image-41.png" />
   </Frame>
5. **How do you want to provide this API key now?** → `Paste API key now`
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-40.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=b2476743b5b1de36238bd04acebd4e40" alt="Image" width="1310" height="836" data-path="images/image-40.png" />
   </Frame>
6. **Enter OpenAI API key** → paste the key you copied in Step 1
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-34.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=67c3ec8aefcb4ae25688a8de6a559cfc" alt="Image" width="2048" height="879" data-path="images/image-34.png" />
   </Frame>
7. **Models in /models picker** → choose the model you want to use, for example `openai/gpt-5.4`
   <Frame>
     <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-35.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=73f23b642cced8e2fd080da18202e687" alt="Image" width="2048" height="752" data-path="images/image-35.png" />
   </Frame>
8. After selecting the model, choose `Continue`

<Frame>
  <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-39.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=6745ca04824821ccd2abadf54ba167e5" alt="Image" width="2048" height="398" data-path="images/image-39.png" />
</Frame>

<Tip>
  If you want a simple default, start with a general-purpose GPT model that matches your latency and cost needs, then adjust later after real usage.
</Tip>

## Step 4: Verify the configured model

Run:

```bash theme={null}
openclaw models list
```

You should see the model you selected marked as the default in the output.

<Frame>
  <img src="https://mintcdn.com/agent37/e1Gz4o2mW1yI7ca_/images/image-45.png?fit=max&auto=format&n=e1Gz4o2mW1yI7ca_&q=85&s=7a179d60ba866b144d5334febd8d7f97" alt="Image" width="1138" height="260" data-path="images/image-45.png" />
</Frame>

If you want to make that model the default, run:

Execute:

```text theme={null}
openclaw models set openai-codex/gpt-5.4 
```

You have successfully configured OpenClaw with your OpenAI API key inside Agent 37. Your instance is now ready to use the selected OpenAI model for future tasks.

## What to do next

Once OpenAI is configured, you can:

* connect a channel like WhatsApp or Telegram
* test your bot in Web Chat
* compare OpenAI and Anthropic for your workflow

<CardGroup cols={2}>
  <Card title="Documentation home" icon="map" href="/docs/">
    Browse the available channels, models, and networking guides.
  </Card>

  <Card title="Claude API" icon="key-round" href="/docs/models/how-to-setup-openclaw-claude-api">
    Compare the Anthropic setup flow with the OpenAI flow.
  </Card>
</CardGroup>
