In June 2026, one event threw a lot of developers' routines into chaos: Anthropic's flagship models, Fable 5 and Mythos 5, went dark overnight for users worldwide due to export controls — a ban that lasted a full 20 days. Even though it was lifted in July, the episode drove home a real risk: tying your entire workflow to a single tool is expensive when things go wrong. Around the same time, OpenAI Codex shipped a wave of key updates in June — Codex Remote reached GA, mobile monitoring launched, and Amazon Bedrock integration landed — pushing weekly active developers from 3 million to 5 million. This piece pulls together every key step for migrating from Claude Code to Codex, including the relay setup that matters most to developers outside the US.

Why Are More Developers Moving to Codex?

Different developers have different motivations, but they generally boil down to four things:

Main reasons for migrating

  • Availability risk: the 20-day Fable 5/Mythos 5 ban drove home an uncomfortable truth — depending on a single provider for your flagship-tier model carries unacceptable availability risk. Codex runs on GPT-5.5, which sits on a different export-control path, making it a genuinely useful backup.
  • A clear gap in token efficiency: in controlled tests, Claude Code consumed roughly 1.4–4x more tokens than Codex to finish the same task. GPT-5.5's output is more concise and doesn't over-explain its own plans — a gap that compounds further over long agentic chains.
  • Safer sandbox isolation: Codex executes commands inside a sandbox by default, without touching your local filesystem directly — a clear advantage for security-sensitive work or multi-project isolation. Claude Code, by contrast, runs directly in your local environment by default.
  • Async cloud tasks: Codex Remote/Cloud lets you hand a task off to a cloud backend and walk away from your machine, with results coming back as a PR. Claude Code is still mostly a local, interactive session today.

Before You Switch: Claude Code vs. Codex Core Differences

Dimension Claude Code OpenAI Codex
Default underlying model Claude Sonnet 5 / Opus 4.8 GPT-5.5 (codex-1)
Execution environment Direct local execution Sandboxed (default)
Async cloud tasks Limited (beta) Codex Remote is GA and stable
Token efficiency Higher consumption Roughly 30–75% savings
SWE-bench Verified Opus 4.8: 87.6% GPT-5.5: 88.7%
SWE-bench Pro (harder) Opus 4.8: 64.3% GPT-5.5: 58.6%
Config file CLAUDE.md + ~/.claude/ AGENTS.md + ~/.codex/config.toml
MCP support Native, JSON config Native, TOML config
Mobile No official app yet Codex iOS in public beta (2026-06-29)
Direct connect Requires VPN or a relay Requires VPN or a relay (OPENAI_BASE_URL)

The data tells one clear story: GPT-5.5 edges ahead on SWE-bench Verified, but on the harder SWE-bench Pro, Claude Opus 4.8 leads by about 6%. Each tool has its own strengths — we'll get into how to run both together later.

Step 1: Install Codex

There are two ways to install Codex — pick the one that fits how you work.

Option A: Codex CLI (terminal, closest to the Claude Code experience)

# Install (requires Node.js 18+)
npm install -g @openai/codex

# Verify the install
codex --version

After installing, running codex for the first time prompts you to log in — you can use a ChatGPT account (Plus/Pro/Business/Enterprise all work) or enter an OpenAI API key directly.

Option B: Codex desktop app (GUI, with auto-migration built in)

Download the macOS/Windows installer from openai.com/codex. The desktop app has a built-in "import config from another agent" feature (Settings → Import agent setup) that automatically scans your Claude Code config and migrates Skills, Hooks, MCP config, and 30 days of session history.

💡 Suggestion: install the CLI first, add the desktop app if you need it

The CLI is closest to Claude Code's workflow, so it has the lowest migration cost. If you want visual management and auto-migration, consider the desktop app on top of it. Both share the same account and API key config.

Step 2: Configure Your API Key

Accessing the official OpenAI API from outside the US typically requires a proxy. There are two paths here: direct connection (needs a VPN) or a relay (direct connect, no VPN).

Option A: Direct connection to the official OpenAI API (needs a proxy)

# macOS / Linux — add this to ~/.zshrc to persist it
export OPENAI_API_KEY=sk-your-openai-api-key

# Reload
source ~/.zshrc

# Launch Codex
codex
# Windows PowerShell
$env:OPENAI_API_KEY="sk-your-openai-api-key"

# Or set it permanently as a system environment variable:
# System Properties → Advanced → Environment Variables → New: OPENAI_API_KEY

Option B: Access via an API relay (direct connect, no VPN needed)

This is the most practical option for developers outside the US. Relays that support GPT-5.5 (codex-1) only need two environment variables set — the rest of the config is identical to Option A:

# macOS / Linux
export OPENAI_API_KEY=your-relay-api-key
export OPENAI_BASE_URL=https://your-relay-domain.com/v1

source ~/.zshrc
codex
# Windows PowerShell
$env:OPENAI_API_KEY="your-relay-api-key"
$env:OPENAI_BASE_URL="https://your-relay-domain.com/v1"

Core things to check when picking a relay:

  • Explicit support for GPT-5.5 / codex-1: Codex uses the codex-1 model (an agentic-tuned variant of GPT-5.5) — the relay must have it in its model list
  • OpenAI format (/v1/chat/completions): Codex speaks the OpenAI protocol, so confirm the relay's endpoint path is compatible with the standard OpenAI SDK
  • Direct-connect nodes: prefer relays with nodes optimized for your region to reduce connection timeouts, e.g., on an office network
  • Stable function calling: Codex's agentic mode leans heavily on tool calls — if a relay mishandles this, agent behavior will misbehave

You can filter our AI API relay comparison list for relays whose "model coverage" includes GPT-5.5 — most of the listed ones have been verified to support Codex-compatible protocols.

Step 3: Migrate CLAUDE.md → AGENTS.md

Claude Code stores project-level AI instructions in CLAUDE.md; Codex's equivalent file is AGENTS.md. The simplest starting point is a straight copy:

# From your project root
cp CLAUDE.md AGENTS.md

That said, a plain copy is only a starting point. There are some meaningful semantic differences between the two files — after migrating, check the following:

AGENTS.md adjustment tips

  • Remove references to Claude-only slash commands: commands like /ultrareview, /rewind, and /status — built into Claude Code — don't exist in Codex, and need to be replaced with Codex equivalents or removed outright.
  • Adjust sandbox assumptions: the "don't run dangerous commands" reminders common in CLAUDE.md files can often be trimmed down in Codex, since the safety boundary is different thanks to default sandbox isolation.
  • Codex supports a global AGENTS.md: instructions placed in ~/.codex/AGENTS.md apply to every project, equivalent to Claude Code's ~/.claude/CLAUDE.md.
  • Skills: Claude Code's Skills files live in ~/.claude/skills/, and Codex has its own Skills mechanism. If you've built custom Skills, you'll need to reformat them per Codex's Skills documentation.

Step 4: Reconfigure MCP Servers

MCP is an open standard, and both Claude Code and Codex support it, so the servers themselves need no changes. What changes is the format of the connection config file: JSON for Claude Code, TOML for Codex.

Claude Code's MCP config (JSON, usually in ~/.claude/settings.json):

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "@myorg/mcp-server"],
      "env": {
        "MY_API_KEY": "sk-xxx"
      }
    }
  }
}

Migrated to Codex's TOML format (~/.codex/config.toml):

[mcp_servers.my-server]
command = "npx"
args = ["-y", "@myorg/mcp-server"]

[mcp_servers.my-server.env]
MY_API_KEY = "sk-xxx"

⚠️ API keys don't migrate automatically

Whether you migrate manually or use the Codex desktop app's "import" feature, the API keys and environment variables inside your MCP server config are never copied over automatically — that's a deliberate security decision. You'll need to re-enter each MCP server's secrets by hand in ~/.codex/config.toml.

Step 5: Verify Codex's Basic Workflow

Once configured, use these steps to verify Codex is working correctly:

# 1. Launch Codex inside a real project directory
cd ~/your-project
codex

# 2. Check the current config
/model        # Confirm the model is correct (should show gpt-5.5 / codex-1)

# 3. Test with a small task (use --dry-run first to preview without executing)
codex --dry-run "Find all hardcoded TODO comments under src/ and list the filenames"

# 4. Confirm tool calling works (MCP verification)
# If you have an MCP server installed, ask Codex to call an MCP tool in
# conversation and check that it responds correctly

Common Errors When Using a Relay

If you run into issues connecting through a relay, check these first:

  1. 401 Unauthorized: OPENAI_API_KEY is wrong, or the relay's key format isn't compatible with the OpenAI standard. Confirm the key starts with the right prefix and check the relay's docs for its key format requirements.
  2. 404 / model not found: the relay doesn't support codex-1 or gpt-5.5 as a model ID. Try manually specifying the model when launching Codex: codex --model gpt-5.5, or contact the relay to confirm the exact model ID string they expect.
  3. Tool call parsing fails / agent behaves oddly: the relay has issues passing through tool calls correctly. Switch to a relay with better function-calling support, or temporarily fall back to plain conversation mode (no tool calls) to confirm whether the relay is the culprit.
  4. Environment variables aren't taking effect: you edited ~/.zshrc but forgot to run source ~/.zshrc, or you changed variables in an already-open terminal session without restarting it. Open a new terminal tab and run echo $OPENAI_BASE_URL to confirm it loaded.

Codex Remote: Push Long Tasks to the Cloud

This is Codex's biggest differentiator versus Claude Code. Codex Remote (GA as of June 2026) lets you:

  • Submit a task from the ChatGPT web app or mobile app, close your laptop, and have it keep running in OpenAI's isolated cloud sandbox
  • Get results back automatically as a pull request on your GitHub repo — you just review and merge
  • Run multiple tasks in parallel without blocking each other or eating local machine resources
  • Use the mobile app (iOS public beta since June 29) to submit tasks on your commute, get PR notifications, and review code remotely

A typical use case: before you leave for the day, hand "write unit tests for feature X" to Codex Remote, and the next morning a PR is already waiting for review — with your machine never having to stay powered on.

Codex Remote quick start

# Connect your GitHub repo (one-time authorization)
codex connect github

# Submit a background task
codex remote "Add JSDoc comments to every function under src/auth/, with full type annotations"

# Check task status
codex remote status

# List PRs awaiting review
codex remote prs

You can also submit tasks directly from the ChatGPT web app (chatgpt.com → Codex tab) or the mobile app, no CLI required.

You Don't Have to Choose: Running Claude Code + Codex Together Is the Best Setup

The clearest community consensus over the past six months is this: the most productive developers run both tools, routing tasks based on their characteristics.

Task type Recommended tool Why
Understanding a 50,000-line legacy codebase and refactoring the Auth module Claude Code Stronger long-context reasoning and complex code comprehension
Batch-generating test cases / filling docs overnight Codex Remote Async cloud execution, no local resource usage
Everyday interactive debugging and code review Codex (token efficiency) GPT-5.5's output is concise, so long sessions don't burn through quota as fast
UI tasks involving screenshots / design mockups Claude Code Codex doesn't support image input
Architecture decisions needing SWE-bench Pro-level reasoning Claude Code (Opus 4.8) Opus 4.8 leads by about 6% on the harder benchmark
Kicking off tasks from your phone / mobile review Codex iOS app Claude Code currently has no official mobile app

In practice, a lot of teams reserve Claude Code for interactive, deep-thinking sessions, use Codex (especially Remote) for background batch work and automated PR generation, and manage keys and quota for both sides through a single API relay.

What You Lose After Switching — Know This Upfront

Must-read before migrating: Claude Code features Codex doesn't support yet

  • Image / vision input: the Codex CLI currently doesn't support image attachments. If your workflow involves handing UI screenshots or error screenshots to the AI for analysis, you'll need to keep Claude Code around for that.
  • Claude Code-only slash commands: commands like /ultrareview, /rewind, and Claude Code's version of /plan don't exist in Codex — you'll need to get used to Codex's own command set.
  • Claude-specific hook events: if you've built complex Hooks in ~/.claude/settings.json, some hook events (like PreCompact) have no equivalent trigger point in Codex, and you'll need to redesign that part of your automation manually.
  • Anthropic-proprietary protocol features: extended thinking's xhigh tier, the reasoning_content field, and other Anthropic-specific fields have no OpenAI-side equivalent — any instructions configured around these need to be cleaned up.

Summary

Migrating to Codex isn't a one-click affair, but it's less involved than it sounds. There are really only four core steps: install the CLI → configure your API key (relay users set OPENAI_BASE_URL) → rename and lightly edit CLAUDE.md into AGENTS.md → rewrite your MCP config from JSON to TOML. Give it 30 minutes and Codex is up and running — you can tune it further as you go.

The more important takeaway: you don't have to uninstall Claude Code. Each tool has its own strengths, and running both is the most productive setup in 2026. Adding Codex to your toolchain means that when one tool hits a ban, an outage, or runs out of quota, the other can pick up the slack — that's a more valuable engineering decision than optimizing around any single tool.


Sources