India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Netherlands Nederlands

OpenClaw OpenAI Integration: Setup and Configuration Guide

Build Something Beautiful

With a .Co.za Domain

Just R50 (Back to R99 in 7 days)

You finally want to run your own AI assistant, one that never sleeps, never leaks your data, and answers you right inside Telegram or WhatsApp.

That AI assistant is OpenClaw. It gives you a 24/7 autonomous AI assistant; your conversations stay private, and your API key is yours. No middlemen.

This guide is written for developers, small businesses, and tech-savvy users in South Africa who want to learn OpenClaw OpenAI integration and get it running properly, not just ‘kind of working.’

Already know you want a VPS to run this? We at Truehost offer pre-configured OpenClaw VPS plans from R285/mo, Node.js and OpenClaw pre-installed, so you skip the setup entirely.

Prerequisites

Before touching any config, make sure you have these in place.

A running OpenClaw instance. You have two paths here:

  • VPS (recommended): Keeps your assistant online 24/7, isolated from your personal machine. Our Truehost OpenClaw Hosting plans come pre-configured to skip the 30–60 minute manual VPS setup entirely.
  • Local (Node.js): Requires Node 24 (recommended) or Node 22.19+. Install globally with npm install -g openclaw.

An OpenAI account with one of the following:

  • An OpenAI Platform API key (usage-based, pay-per-token billing), or
  • An active ChatGPT Plus or Pro subscription (for the Codex OAuth path)

Access to OpenClaw’s dashboard or CLI.

That’s the full list. If you’re setting up on a local machine, budget 25–30 minutes. A pre-configured VPS cuts that to under 5.

How OpenClaw Connects to OpenAI (Architecture Overview)

This is worth getting right before you configure anything. It saves a lot of troubleshooting later.

openclaw openai integration

OpenClaw keeps model routing and authentication as separate layers. That’s the main insight.

All OpenAI models use the openai/* Prefix in your config regardless of which auth method you use. What changes is how OpenClaw authenticates and where the billing goes.

Three paths at a glance:

GoalModel ReferenceAuth / Notes
Direct API billingopenai/gpt-5.5Set OPENAI_API_KEY
ChatGPT subscriptionopenai/gpt-5.5 via Codex OAuthBest for Plus/Pro subscribers
Native Codex executionopenai/gpt-5.5 + agentRuntime.id: codexAdvanced / power users

The core tradeoff:

  • API key = pay-per-token, no ceiling, full model access
  • Codex OAuth = fixed monthly cost tied to your ChatGPT subscription, subject to subscription limits

Pick the one that matches how you want to pay.

Connect via OpenAI API Key

Best for: flexible, usage-based billing; works with every OpenAI model

a) Generate your API key

  1. Go to platform.openai.com → API Keys → create a new key
  2. Name it clearly something like ‘OpenClaw Production’
  3. Copy it immediately. It won’t show again after you leave the page
  4. Before you do anything else, set a spending limit in your billing settings

Without a spending limit, a misconfigured agent can burn through credits fast.

b) Add the key to OpenClaw

You have three ways to do this:

  • Environment variable: OPENAI_API_KEY=your-key-here
  • Interactive wizard: run openclaw configure and follow the prompts
  • Onboarding flag: openclaw onboard --auth-choice openai-api-key

OpenClaw stores your config at ~/.openclaw/openclaw.json. Sensitive data like API keys goes into ~/.openclaw/.env.

c) Set your default model

openclaw config set agents.defaults.model.primary openai/gpt-5.5

d) Verify the connection

openclaw models list --provider openai
openclaw models status

Then start the gateway and send a test message through a connected channel. If the response comes back, you’re live.

Connect via Codex Subscription (OAuth)

Best for: ChatGPT Plus or Pro subscribers who want a predictable, fixed monthly cost

openclaw openai integration

Since May 2026, OpenAI has officially enabled ChatGPT subscription access for external tools like OpenClaw through the Codex OAuth path.

If you’re already paying for ChatGPT Plus or Pro, this means you can power your OpenClaw agent without separate API billing.

a) Run the OAuth flow

openclaw onboard --auth-choice openai

This opens a browser window for you to sign in to your ChatGPT account. Once you authorise, OpenClaw gets a subscription-backed Codex auth profile.

b) Headless VPS setup (no browser)

On a headless server, which is the typical VPS situation, add the --device-code flag:

openclaw onboard --auth-choice openai --device-code

This generates a code you authorize from your phone or a separate device. No browser on the server is required.

c) Set the model

openclaw config set agents.defaults.model.primary openai/gpt-5.5

d) Verify

openclaw models list --provider openai

Then send /codex status in chat to confirm the native runtime is active.

e) Auth priority chain (important for multiple credentials)

If you have more than one set of credentials configured, OpenClaw follows this order:

  1. Explicit OpenClaw profile
  2. App-server account
  3. CODEX_API_KEY
  4. OPENAI_API_KEY

If you want a specific agent to use a specific auth method, set an explicit profile. Don’t leave it to chance when you’re running multiple agents.

Native Codex App-Server Harness

Best for: multi-step code execution, automated file operations, and complex agent workflows

This is the advanced path and it’s what makes OpenClaw’s OpenAI integration genuinely powerful.

Set agentRuntime.id: codex in your config alongside openai/gpt-5.5. Then verify with /codex status and /codex models in chat.

Here’s what this does under the hood: OpenClaw passes its capabilities to Codex as dynamic tools.

Codex discovers the right tool on demand through native tool search, rather than loading every tool schema upfront.

That keeps the initial context window smaller and reduces first-call latency.

In plain terms, the agent is faster, more focused, and makes better decisions about which tools to use when.

Set Your Default Model

Once your auth is sorted, choose a default model that fits your use case.

GoalModel RefNotes
Stable productionopenai/gpt-5.5Recommended default
Latest ChatGPT aliasopenai/chat-latestMoving alias experiments only
Image generationopenai/gpt-image-2API key or Codex OAuth
Transparent-background imagesopenai/gpt-image-1.5Use outputFormat=png, background=transparent
Video generationopenai/sora-2Text-to-video and image-to-video

For most users in production: stick with openai/gpt-5.5. It’s stable, well-tested, and available across both auth paths.

Avoid openai/chat-latest in production. It’s a moving alias the underlying model can change without warning.

App & Messaging Integration

Your OpenClaw OpenAI integration isn’t fully useful until it’s connected to a channel you use.

This is where the autonomous potential becomes real. Instead of opening a chat interface, you message your own assistant in Telegram, Slack, or WhatsApp and it acts on your behalf.

Telegram setup:

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts to create your bot
  3. Copy the access token BotFather gives you
  4. Link it to your OpenClaw environment variables
  5. Approve the pairing code in your chat or container logs

Other supported channels: Slack, WhatsApp, Discord, Signal, iMessage, Microsoft Teams, and more.

Pick the channel your team already uses. There’s no point setting up a new app just for the assistant.

Main OpenAI Capabilities in OpenClaw

Once your OpenClaw OpenAI integration is live, here’s what you can do:

  • Chat / Responses: conversational AI across all connected channels
  • Image generation + editing: via openai/gpt-image-2
  • Video generation: via openai/sora-2
  • Text-to-speech (TTS): default model: gpt-4o-mini-tts
  • Batch and realtime speech-to-text: transcription at scale
  • Realtime voice: requires OpenAI Platform credits (not covered by Codex subscription)
  • Memory embeddings: via text-embedding-3-small, Let’s the agent remember context across sessions

Note on real-time voice: if you’re on the Codex OAuth path, you’ll need separate OpenAI Platform credits for this feature. It doesn’t draw from your ChatGPT subscription.

Azure OpenAI Configuration (Optional)

For: enterprise teams needing compliance, regional data residency, or Azure credit consumption

If your organisation runs on Azure, you can route OpenClaw through Azure OpenAI instead of the public OpenAI platform.

Set models.providers.openai.baseUrl to your Azure resource endpoint and add your Azure API key. Model names in your OpenClaw config must match your Azure deployment names, not the public OpenAI model IDs.

Main details:

  • Requires OpenClaw 2026.4.22 or later for the image-generation path
  • Pin your API version with AZURE_OPENAI_API_VERSION (default: 2024-12-01-preview)
  • Azure image generation is available in specific regions: eastus2, swedencentral, polandcentral, westus3, uaenorth

Note for enterprise teams: if your organisation already has GitHub Copilot licences, the GitHub Copilot provider is often the better fit. Check that path before committing to Azure configuration.

Security & Cost Guardrails

Don’t skip this section. A misconfigured OpenClaw instance is a real risk both financially and for your data.

Minimum steps before you go live:

  • Bind the gateway to localhost, not the open internet
  • Set a strict spending limit in OpenAI Platform billing before heavy use
  • Use OpenClaw’s chat prompt to apply recommended security scripts and approval gates
  • Run openclaw doctor --fix to catch and repair stale configuration
  • Validate your config: openclaw config validate

A note on exposure: researchers found over 42,000 exposed OpenClaw instances in the project’s first two months. Most were misconfigured gateways bound to a public IP without proper auth. Don’t be in that group.

If you’re running on a Truehost VPS, our network firewall adds an extra layer but you should still bind to localhost and configure approval gates.

Troubleshooting

IssueCauseFix
Model not on allowlistWrong auth profile selectedAdd model to allowlist in config
OAuth window won’t openHeadless serverUse --device-code flag
Legacy model refs failingOld openai-codex/* formatRun openclaw doctor --fix
API key not recognizedMissing env variableSet OPENAI_API_KEY explicitly
Auth picking wrong profilePriority chain conflictSet an explicit OpenClaw profile
Occasional auth failuresOAuth token rotationRe-run openclaw models auth login --provider openai

If you’re hitting the legacy model ref issue, it usually means you set up OpenClaw before the openai/* naming change. Run openclaw doctor --fix it rewrites the old openai-codex/* references automatically.

Get Started With Truehost

You now have three clear paths to connect OpenClaw to OpenAI:

  1. API key: pay-per-token, maximum flexibility
  2. Codex OAuth: fixed cost via your ChatGPT Plus/Pro subscription
  3. Native Codex harness: advanced agent workflows with dynamic tool search

The configuration itself isn’t difficult. But where people run into problems is infrastructure.

Running OpenClaw on your laptop means it goes offline when you close the lid. A poorly configured VPS means you spend your evenings troubleshooting systemd services instead of using your assistant.

Truehost South Africa removes that friction.

Our OpenClaw hosting plans come with Node.js, OpenClaw, and all dependencies pre-installed. You connect your OpenAI credentials, and you’re live, with no setup headaches.

Truehost opencla plans

Plan options:

  • KVM1: R285/mo, 1 vCPU, 2GB RAM, 50GB NVMe, 4TB bandwidth, pre-configured OpenClaw
  • KVM2: R380/mo, 2 vCPU, 4GB RAM, 100GB NVMe, 8TB bandwidth, pre-configured OpenClaw

KVM1 handles single-user personal assistants and small business bots comfortably. KVM2 is the right pick if you’re running multiple agents or heavy automation workloads.

OpenClaw OpenAI Integration FAQs

Do I need coding experience to set up OpenClaw with OpenAI?

Basic terminal comfort helps, you’ll run a few commands and edit a JSON config file. You don’t need to write code. The openclaw onboard wizard handles most of the setup interactively. If you want zero setup time, a pre-configured Truehost OpenClaw VPS means you skip even that.

What’s the difference between using an API key and the Codex OAuth path?

Which OpenAI models can I use with OpenClaw?

Is my data safe running OpenClaw on a VPS?

I’m on a headless VPS with no browser. How do I complete the Codex OAuth flow?

What happens if OpenClaw picks the wrong auth profile?

Can my business use Azure OpenAI instead of the standard OpenAI platform?

What’s the minimum VPS spec I need to run OpenClaw reliably?

Read More Posts

Using OpenClaw to Create a Family Assistant: A Complete Setup Guide

Using OpenClaw to Create a Family Assistant: A Complete Setup Guide

South African households run on WhatsApp, and with 96% of SA internet users on the app, it’s already…

How to Use OpenClaw as Your Coding Assistant

How to Use OpenClaw as Your Coding Assistant

Most coding assistants live inside a subscription editor and forget everything the moment you close the tab. OpenClaw,…

Openclaw OpenAI Subscription: What You Need to Know

Openclaw OpenAI Subscription: What You Need to Know

For a long time, using OpenClaw with OpenAI models meant dealing with API keys, usage-based billing, and the…

OpenClaw vs Hermes Agent: Features and Use Cases Compared

OpenClaw vs Hermes Agent: Features and Use Cases Compared

Self-hosted AI agents went from niche to mainstream fast. Two names now dominate every forum thread: OpenClaw and…