Connect OpenAI to OpenClaw
Use your OpenAI API key or OpenAI OAuth credential to power OpenClaw Setup with GPT models. You can either use an API key (per-token billing) or OAuth (subscription-based: your ChatGPT Plus/Pro plan covers both the assistant and Codex CLI). The subscription path usually saves significantly on tokens and API costs — see our guide on saving on tokens and API costs. We recommend choosing an OpenClaw hosting provider that fully supports the OAuth method; OpenClaw Setup is one.
How to get API key
- Go to platform.openai.com/api-keys
- Sign in or create an account
- Click Create new secret key, name it (e.g. "OpenClaw"), and copy it
- Paste the key into the OpenClaw Setup wizard
Tip: Set usage limits in your OpenAI dashboard to control spend.
OpenAI OAuth (alternative to API key)
OpenAI OAuth is an alternative to an API key. Configure billing in your OpenAI billing settings first.
- Open this link: Authorize OpenAI OAuth
- Sign in with OpenAI and authorize the app
- After redirect, copy the full URL from your browser address bar
- Paste that URL into the OpenClaw Setup wizard as the credential when auth method is OAuth
Safety: Only use the official link above. Treat the resulting URL as a secret.
We recommend OAuth when you can: it uses your existing subscription (e.g. ChatGPT Plus) instead of per-token API billing, so you save on tokens and API costs. Codex CLI is charged as a subscription too, so one plan can cover your assistant and Codex. See our guide on saving on tokens and API costs.
Ready to launch?
Once you have your OpenAI credentials, continue with setup and install flow.
Then follow install OpenClaw and use setup troubleshooting if anything breaks.
Or compare MiniMax OAuth setup if you prefer MiniMax models.