The world’s first unified interface for agent harnessesOpen Source4.6kPowered by UHP

TutorialsNov 28, 202611 min read

Codex and Claude Code Integration: Four Ways to Combine Them

How to connect Codex and Claude Code: the official plugin, the Codex SDK and app server, and one API for both harnesses, with setup, limits and production controls.

Two distinct compute chambers connect to one shared interface dock while retaining separate workspace trays.
A common interface coordinates distinct harnesses; it does not automatically translate their internal session state.

Codex and Claude Code can be integrated at four levels: developer skills and documentation inside Claude Code, the Codex SDK or app server inside your own backend, a controlled MCP bridge, or a single API that treats both as interchangeable agent harnesses. The first suits a developer workstation. The other three suit a product, and the last removes the need to write a separate integration for each harness. This article walks through each option, what it requires and where it fails, so you can decide how to run both tools side by side, call one from the other, or move a workflow from one to the other.

A note on terms: an agent harness is the runtime around a model that supplies the loop, tools, file access, permissions and session state. Codex and Claude Code are both harnesses, which is why integrating them is mostly a question of interfaces rather than models.

TL;DR

  • For personal use, the OpenAI Developers plugin brings OpenAI developer skills and docs into Claude Code. For a product, call Codex from a server-side worker through the Codex SDK or app server.
  • Codex has an official TypeScript SDK (Node.js 18 or later) and a Python SDK (Python 3.10 or later) that start, continue and resume threads.
  • Combining agents can increase token spend, credentials and attack surface, so set turn limits, timeouts, cost ceilings and sandboxes before the first production run.
  • HarnessRouter exposes 30+ harnesses, including Codex and Claude Code, behind one API, so switching or mixing them is a routing decision instead of a rewrite.

Why developers combine Codex and Claude Code

The two tools can be assigned different jobs or compared on the same task. A common split is to let one agent plan and review while the other executes, or to run both on the same task and compare results. Our own same-task benchmark of Codex and Claude Code for product APIs and the head-to-head comparison cover how they differ in behavior. What matters for integration is that each has its own authentication, configuration format, permission model and session lifecycle. Every pairing strategy is a way of bridging those differences.

The approaches below are ordered by how far they move from a single developer's laptop to a multi-tenant product.

Option 1: Use the official plugin inside Claude Code

OpenAI publishes a Developers plugin with adaptations for Claude Code and Cursor. The Claude Code adaptation bundles portable developer skills and the public OpenAI Docs MCP server, and it leaves out the Codex-specific Platform connector. Its content covers API key setup, Agents SDK app-building guidance, Responses API migration guidance and troubleshooting skills.

This is the shortest path for one developer who wants OpenAI-specific knowledge available while working in Claude Code. Three limits apply:

  1. It runs on your machine, using your local installation, credentials and checkout. It does not give you a service you can call from an application.
  2. It extends what Claude Code knows. It is not a general mechanism for delegating whole tasks to Codex and getting structured results back.
  3. Anything you wire up beyond it, such as a loop where the two agents iterate until both agree, consumes usage on both sides quickly. Cap the number of rounds.

Option 2: Call Codex from your application with the SDK

For an application, the supported route is the official Codex SDK, which controls Codex programmatically for CI/CD, custom agents, internal tools and applications. The setup is short:

  • TypeScript: npm install @openai/codex-sdk, with Node.js 18 or later.
  • Python: pip install openai-codex, with Python 3.10 or later.

The SDK can start, continue and resume local Codex threads. The documentation's Python examples name a specific model, which must be available to the signed-in account. If you omit the model, the configured default is used, so pin a model explicitly in any shared code.

Choosing between exec, SDK and app server

OpenAI's Codex as a platform post separates three entry points, and picking the right one avoids rework:

InterfaceBest forWhat you get
codex execScripts, CI jobs, one-off background tasksStructured output from a single non-interactive run
Codex SDKApplication code that needs direct controlA programmatic interface for threads
App serverCases where the agent is part of the product itselfA protocol for clients that handle authentication, history, approvals and streamed events

The same post notes that the CLI, app server and SDK are open-source components. Because the harness is open, you can inspect the layer between your application and the model, and decide where the agent runs, which files and tools it can reach, and which actions need approval.

One removal matters if you are updating an older integration: according to the SDK documentation, the codex mcp-server command and standalone binary have been removed, and the app server replaces them for existing integrations.

Where this route gets expensive

The SDK solves Codex. It does not solve the second harness. If your product also needs Claude Code, you build a second integration with its own session handling, file transfer, permission configuration and process lifecycle. Our guides on calling Codex from an app and on Claude Code integration through IDEs, CI, MCP and the Agent SDK describe what each of those two builds involves. Teams that do both end up maintaining two adapters that drift apart.

Option 3: Bridge the agents with MCP

Model Context Protocol (MCP) lets a server expose tools to an agent; a tool can invoke another agent. Claude Code can consume an MCP server, so a team can place a thin service in front of Codex and let Claude Code call it as a tool. This is the pattern behind the community setups that tell one agent to iterate with the other.

Treat the bridge as a security boundary. Content that passes through it, from repositories, documentation or other MCP servers, is untrusted input to both agents, and a prompt injection in one can steer the other. Run the bridge with restricted shell and network access, an allowlist of tools and human approval on destructive actions. For deeper reading on operational controls, see this piece on guardrails, telemetry and red teaming for AI agents.

For a product, the architecture that holds up is a server-side worker that invokes the second agent through the SDK, app server, CLI or a controlled bridge, with the user-facing model orchestrating. This gives the product control over worker placement, concurrency and task limits.

A Claude Code client calls a custom MCP service that exposes a tool invoking Codex.
Conceptual custom bridge. The MCP service must invoke Codex through a supported execution interface and enforce authorization; it is not the documentation plugin.

Option 4: One API for both harnesses

The fourth option removes the per-harness integration. HarnessRouter is an open-source unified interface and cloud platform that connects multiple agent harnesses, including Codex, Claude Code, Hermes, DeepSeek and Pi, into production applications through one API. It supports 30+ harnesses. HarnessRouter Cloud provides serverless execution in isolated sandboxes; Community Edition runs on infrastructure you operate and secure. The coding agent API guide explains how Codex, Claude Code and others run behind your product through that single interface.

What this changes in practice:

  • Session management and file handling are part of the platform, so your code does not reimplement thread resume and workspace upload for each harness.
  • Environment provisioning and the serverless agent runtime lifecycle in HarnessRouter Cloud are handled for each task rather than by processes you babysit.
  • Plugins and skills are modular configuration options for supported harnesses. Check the selected harness and package compatibility; a shared API does not make every plugin portable.
  • Benchmarking tools let you run the same task across harnesses and compare quality, latency and cost before you commit.

The interface rests on the open Unified Harness Protocol (UHP). For how it relates to MCP, which connects an agent to tools rather than standardizing the harness layer, see UHP vs MCP.

Running Codex and Claude Code side by side

Whether you build it yourself or use a unified API, define the task split and limits. HarnessRouter Cloud provides managed sandbox execution, sessions and file handling; a self-built integration must supply those runtime services.

  1. Define the split of work. Decide which agent plans, which edits, which reviews. Without a rule, both edit the same files and you spend time resolving conflicts. Give each run its own workspace.
  2. Isolate each run. Use one sandbox per task and per tenant. Never let two agents share a writable checkout without a merge step. Our article on running multiple coding agents covers the progression from local parallelism to production.
  3. Set permissions deliberately. Codex and Claude Code each have a mode that skips approvals. Use approval-bypass modes only within an independently enforced disposable sandbox with restricted filesystem and network access and narrowly scoped credentials, which is covered in Codex full auto and safer sandbox modes and Claude Code bypass permissions with isolation.
  4. Pass results, not whole contexts. Forward the diff or the summary to the second agent. Re-sending an entire repository context on every hop multiplies input tokens.
  5. Cap everything. Set a maximum number of turns, a wall-clock timeout, a cost ceiling and a cancellation path. A review loop with no ceiling can keep consuming budget.
  6. Record what happened. Keep per-run traces so you can tell which agent produced which change. HarnessRouter lists tracing as a $50 per month beta add-on on other plans and includes it with Scale. Task cost breakdowns are free on every plan.

Switching from Codex to Claude Code, or back

Moving a workflow between the two means translating four things: project instructions, tool configuration, permission settings and session handling. Codex reads project instructions from AGENTS.md, while Claude Code reads CLAUDE.md, and the permission models differ in concept: Codex separates what is technically possible from when it asks for approval, while Claude Code combines a permission mode with per-tool rules. Someone moving over has to decide consciously which commands may run unprompted.

If your workflow lives in a product rather than on a laptop, the cleaner approach is to avoid migrating at all. With harnesses behind one interface, switching a new task changes its selected harness while the application uses the same session and file API contract. An existing harness's internal conversation state is not automatically transferable to another harness. That also lets you keep both: use task evaluations to choose a supported harness and model by quality, latency or cost. This does not imply an automatic search for the optimal configuration.

What to check before production

Security. Treat repository content, documentation and MCP responses as untrusted. Use vault-managed credentials, workspace sandboxes, restricted network access, tool allowlists and human approval for risky actions.

Cost. Count input and output tokens for both agents, plus sandbox and infrastructure charges. Repeated forwarding of large contexts can increase bills. With HarnessRouter, BYOK routing is free up to $25,000 per month of model usage at listed prices, with a separate 5% routing fee above that volume. Top-up processing is 5.5%, with a $0.80 minimum. Short-term file storage without a paid plan is $0.0000840 per GB-hour, with lower paid-plan rates; long-term Harness Memory is $0.0019 per memory operation, including storage. Memory pricing is in beta and may change with advance notice.

Reliability. Use hard limits on turns and time, and make cancellation a first-class operation.

Data handling. Review provider, region, data processing agreement, retention and residency requirements for each vendor. A setup that was compliant with one provider can stop being compliant when data is also sent to a second.

Gateways. If you front Codex with your own gateway, it must speak the Responses API that Codex expects, not just an OpenAI-compatible chat endpoint. This is one more reason to use a layer that already handles protocol differences.

Production checks cover untrusted input, scoped credentials, sandbox and network limits, bounded runs and provider data review.
These checks apply to the configured integration. A disposable workspace alone does not constrain external actions or network access.

Starting with HarnessRouter

The Free plan costs $0 per month and includes agent-work minutes for initial tasks through the same API, using your own compatible model keys. Model-provider usage is billed separately; the free subscription does not mean free model inference. The Developer plan is $20 per month, Production is $200 per month and Scale is $1000 per month. Enterprise has no published price. Agent work is billed by usage, and the full list is on the pricing page. Teams that prefer to self-host can use the open-source Community Edition, and you can browse the supported harnesses before you decide which to route to.

HarnessRouter

For a product feature that calls an agent, the AI agent API guide shows the integration from request to result.

Our perspective

The agent harness is becoming infrastructure, not a choice you make once. Codex and Claude Code each improve on a different schedule, and the team that hard-wires one into its product inherits that vendor's session format, permission model and release cadence.

We built HarnessRouter on the premise that the harness layer should be open and interchangeable. That is why we initiated the Unified Harness Protocol: supported harnesses, models, providers, skills, tools, plugins, memory and environments can be configured through a shared contract. Compatibility and permissions still apply; task evaluations guide which configuration to use.

In that model, "integrating Codex with Claude Code" stops being a bridge project. It is a routing decision for a new task, using a consistent application API. Cloud handles isolated execution; switching does not automatically translate another harness's internal state. Our aim is that a team spends its time on the product the agent powers, not on adapters.

Sources

FAQ

Frequently asked questions

Can Claude Code run Codex directly?
The OpenAI Developers plugin for Claude Code supplies developer skills and the OpenAI Docs MCP server; it does not itself execute Codex tasks. Claude Code can invoke Codex through a separately configured CLI tool or custom MCP service, with appropriate permissions. For delegating full tasks from an application, call Codex through the Codex SDK or app server from a server-side worker, or route both through one API.
How do I integrate Codex into my own app?
Install the TypeScript SDK with npm install @openai/codex-sdk (Node.js 18 or later) or the Python SDK with pip install openai-codex (Python 3.10 or later), then start and resume threads from your code. Use the app server when the agent is part of the product and you need direct protocol control over authentication, conversation history, approvals and streamed events. The SDK can also stream events.
Should I use codex exec or the SDK?
Use codex exec for scripts, CI jobs and one-off background tasks that need structured output. Use the SDK when your application code needs direct, programmatic control of threads.
Is it safe to let both agents edit the same repository?
Only with isolation. Give each agent its own sandboxed workspace, restrict network and shell access, require approval for destructive actions and merge their changes through a reviewed step.

→Next

Combine Agent Harnesses Through One API

Run a first task, check its output and compare supported configurations on your own workload.