Skip to content
CLAWDBOOK
Popular searches
Private, static site search Open
ModelsGuides
Browse the OpenClaw handbook

Use OpenAI with OpenClaw

Connect OpenClaw to OpenAI through ChatGPT/Codex subscription sign-in or an API key, then select and verify an available model.

Last verified
August 9, 2026
Reviewed against
OpenClaw 2026.7.1-2 documentation
Difficulty
Beginner
Time
~8 minutes
Verified against the official documentation listed below

OpenClaw uses the openai/* model route for both ChatGPT/Codex subscription authentication and direct OpenAI API-key authentication. These are different billing paths, so choose the one you intend to use.

Option 1: ChatGPT or Codex subscription

Run onboarding and choose OpenAI, or start provider login directly:

openclaw models auth login --provider openai

On a headless host, the device-code flow avoids depending on a localhost browser callback:

openclaw models auth login --provider openai --device-code

Option 2: OpenAI API key

Use openclaw onboard and select OpenAI API-key authentication. Keep the key in OpenClaw’s credential flow or a protected service environment. Do not put a real key in a checked-in openclaw.json, shell history, screenshot, or support message.

API-key use is billed through the OpenAI Platform. Subscription OAuth and API usage are not interchangeable billing pools.

Select a model that is actually available

Do not copy a model ID from a dated article. Inspect the catalog for the authenticated account:

openclaw models list --provider openai
openclaw models status
openclaw models set <openai/model-id>

The canonical reference begins with openai/. The list can differ by account access and by the OpenClaw release, so the CLI output is the source of truth for selection.

Verify the connection

Run one plain prompt, then one harmless tool call. Check status again if the tool call uses a different route than expected.

Expected result

openclaw models status shows a usable OpenAI authentication profile and the selected primary model. A test turn completes without a 401, missing-profile error, or unavailable-model rejection.

Source notes

Technical facts on this page were checked against primary sources.

Related guides