OpenClawSkills
GitHub
Providers • TutorialHeader.readTime

OpenAI

Use OpenAI in OpenClaw: supports API keys or Codex subscription auth.

OpenAI provides developer APIs for GPT series models. Codex supports using <strong>ChatGPT login</strong> (subscription access) or <strong>API Key login</strong> (pay-as-you-go access). Codex cloud requires ChatGPT login.

Tutorial.step

Option A: OpenAI API Key (OpenAI Platform)

<strong>Best for:</strong> Direct API access and pay-as-you-go billing.

Get your API Key from the OpenAI console.

#

Tutorial.step

CLI Setup

Bash
openclaw onboard --auth-choice openai-api-key

openclaw onboard --openai-api-key "$OPENAI_API_KEY"

#

Tutorial.step

Config Snippet

Json5
{
  env: { OPENAI_API_KEY: "sk-..." },
  agents: { defaults: { model: { primary: "openai/gpt-5.2" } } },
}
Tutorial.step

Option B: OpenAI Code (Codex) Subscription

<strong>Best for:</strong> Using ChatGPT/Codex subscription access instead of API Key.

Codex cloud requires ChatGPT login, while Codex CLI supports ChatGPT login or API Key login.

#

Tutorial.step

CLI Setup

Bash
openclaw onboard --auth-choice openai-codex


openclaw models auth login --provider openai-codex

#

Tutorial.step

Config Snippet

Json5
{
  agents: { defaults: { model: { primary: "openai-codex/gpt-5.2" } } },
}
Tutorial.step

Notes

- Model refs use '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'provider/model'</code>' (see '<a href="/concepts/models" className="text-emerald-400 hover:text-emerald-300 transition-colors">'/concepts/models'</a>').

- See '<a href="/concepts/oauth" className="text-emerald-400 hover:text-emerald-300 transition-colors">'/concepts/oauth'</a>' for auth details and reuse rules.