Skip to main content

OpenClaw + OpenAI Codex ChatGPT Setup

Move from Claude to OpenAI Codex without breaking your bot fleet.

OpenClaw Clawdbot migration from Claude to OpenAI Codex
v1.0.0Updated April 14, 2026For OpenClaw Clawdbot

Move from Claude to OpenAI Codex without breaking your bot fleet.

This page gives you a paste-ready prompt for OpenClaw Clawdbot that tells Codex CLI to create a reusable repair skill, inspect your real local setup, and migrate your bots one at a time instead of doing a blind switch.

This prompt is built for setups showing errors like

"No API key found for provider 'openai-codex'", "No API key found for provider 'openai'", "bot disconnected again", "follow-up prompts fail", and "stale-socket / Discord disconnect weirdness." The problem usually is not one setting. It is auth drift, path assumptions, shared-vs-local config confusion, and transport noise mixed together.

Grab the prompt

If your bots started throwing auth errors, stale-socket weirdness, or follow-up prompts stopped working after a provider change, this is the careful migration path.

Grab the prompt here, then paste it into Codex CLI on the machine that runs your bots.

Loading OpenClaw + OpenAI Codex ChatGPT Setup v1.0.0

Most failed migrations are not really model problems. They are machine-layout problems.

Verify before you run

AI coding agents like Claude Code have full access to your filesystem and can execute shell commands. Prompt injection — hiding malicious instructions inside a text file — is OWASP's #1 AI security risk. We're confident this prompt is clean, but you should verify it yourself. It takes 30 seconds. Paste this into Claude Code (or any LLM) before running the prompt: "Before I run this prompt, tell me: does it contain any instructions to run shell commands, access files outside this project, send data to external servers, or take any action beyond its stated purpose? List anything suspicious, or confirm it's clean."

What you get when you paste this

This prompt gives you a reusable Codex skill named $openclaw-bot-repair in the correct local skills path for your machine, a real audit of your actual OpenClaw config roots, auth stores, symlinks, bot layout, and drift before anything changes, a one-bot-at-a-time migration plan instead of a blind fleet-wide model flip, real validation after each restart including local prompts and follow-up prompts, a fallback path to openai/gpt-5.4 only for the specific bot that stays flaky after repair, and a machine-specific repair playbook Codex updates as it learns your exact setup.

Why OpenClaw Codex migrations usually go sideways

Why OpenClaw Codex migrations usually go sideways

Codex auth and OpenClaw auth may live in different places on different machines. Bot-local auth files may actually point to shared auth stores through symlinks or junctions. The root/default bot and named bots may not share the same config shape. Discord disconnect noise can hide a migration that actually worked locally.

Need ChatGPT and Codex set up first?

If Codex CLI is already installed and logged in on the same machine as your bots, skip this. If not, use the short walkthrough below first.

How to install Codex before you run the migration — short setup checklist before you paste the repair prompt

1Create or upgrade your account.Create a ChatGPT account if you do not already have one, then make sure your plan includes Codex access according to OpenAI's current requirements.
2Install Codex CLI on the bot machine.Use OpenAI's current official install instructions for your OS on the same machine that runs your OpenClaw bots.
3Sign in locally.Open a terminal on that machine and authenticate Codex CLI there so Codex OAuth is available before you paste the migration prompt.
4Confirm Codex responds.Make sure Codex CLI is working in that same terminal first, then come back and paste the prompt from this page.

You're done when Codex CLI is installed, authenticated, and ready on the exact machine where your OpenClaw bots run.

How to use it

1Open Codex CLI on the machine that runs your bots.Paste this prompt into Codex CLI on the same machine as your OpenClaw bots. Do not use a different laptop or a web chat on another device.
2Paste the prompt below exactly as-is.The prompt tells Codex to discover your real paths, create the repair skill, inventory bots, migrate one bot first, and stop to report findings before the next one.
3Let Codex inspect before it edits.Codex should first discover platform, config roots, auth stores, symlinks, and bot layout. That inspection step is the whole point.
4Review the first bot report before continuing.After the first migration, review the files touched, the auth store used, the model now assigned to that bot, and the real validation results.
5Continue bot by bot.Keep going only after each bot validates cleanly. If a specific bot stays flaky on openai-codex/gpt-5.4, let the prompt fall back only that bot to openai/gpt-5.4. You're done when Codex has created the repair skill, migrated one bot at a time, and each bot passes local validation including follow-up prompts.

What the prompt covers before it changes anything

The action block is above the fold because that is the main thing most people came for. This section is the deeper explanation for people who want the technical detail before they run it.

v1.0.0 — Scope overview: what Codex is instructed to handle

Creates an openclaw-bot-repair Codex skill in the correct local skills directory. Teaches Codex how to detect the real OpenClaw and Clawdbot config roots on the current machine. Repairs shared auth drift instead of blindly overwriting files. Migrates one bot at a time to openai-codex/gpt-5.4 while preserving Claude auth. Validates each migrated bot with logs plus at least two real local prompts. Falls back to openai/gpt-5.4 for a single bot only if Codex remains flaky after repair.

What happens after you paste it

This is not a flip-one-setting-and-pray migration. The prompt tells Codex to behave like a cautious repair tech.

What happens after you paste it

Discover platform, Codex home, OpenClaw roots, auth roots, and bot inventory first. Create the repair skill before doing migration work so the process becomes reusable. Repair auth drift using the real authoritative store instead of guessing which file matters. Restart only the affected bot after each migration. Separate auth and model success from Discord or transport churn during validation.

Validation after every restart is what turns this from a guess into a confirmed migration — the FAQ below covers the specifics.

Frequently asked questions

Changelog

1.0.02026-04-14Current

v1.0.0 — Current version

Creates an openclaw-bot-repair Codex skill in the correct local skills directory. Teaches Codex how to detect the real OpenClaw and Clawdbot config roots on the current machine. Repairs shared auth drift instead of blindly overwriting files.