Codex guide

Codex API: What Exists, What Doesn't, How to Call It

The current Codex API reality: OpenAI's seven Codex surfaces, what the Codex SDK actually is, why there is no hosted REST API for Codex tasks in current docs, and how to run Codex over HTTP today.

Short answer

As of August 2026, OpenAI ships Codex across seven surfaces, including a Codex SDK that runs on your own infrastructure, but its documentation describes no hosted REST API for running Codex tasks. To call Codex over HTTP today you have two paths: wrap the self-hosted SDK in a service you build and operate, or use a harness platform: HarnessRouter runs Codex behind one API, with tasks, sessions, streaming, files, and results, alongside Claude Code and Hermes.

  • What exists: Codex CLI, IDE extension, desktop app, web, Codex Cloud, GitHub integration, and a TypeScript/Python SDK that controls a local Codex app-server on your infrastructure.
  • What does not exist in current OpenAI docs: a hosted REST endpoint that accepts a Codex task over HTTP and returns the completed run.
  • The gap between an SDK on your machines and a multi-tenant service is the same four items every harness faces: an HTTP contract, tenant separation, per-task isolation, and product-level durability.

What OpenAI ships today

A senior engineer searching for a Codex API deserves the current inventory rather than a sales pitch. As of August 2026, OpenAI's Codex documentation covers these first-party paths:

Interactive surfaces
The Codex CLI, IDE extension, desktop app, and web give a developer direct, interactive access; Codex Cloud runs tasks in hosted browser workspaces a developer delegates to.
GitHub integration
Repository and pull-request workflows connected to Codex.
Codex SDK
TypeScript and Python libraries that run on your infrastructure: start, continue, and resume threads, drive Codex from CI/CD, or embed it in internal tools; the Python library controls the local Codex app-server over JSON-RPC.
Hosted task API
Not in the current documentation. There is no described REST endpoint that accepts a Codex task over HTTP and returns the completed run.

The SDK is not a service

The Codex SDK answers one real need: programmatic control of Codex on machines you operate, which is exactly right for CI pipelines and internal tools. Putting Codex behind a product for your users is a different job. The SDK process runs on your infrastructure, controlled by whoever operates it; a product needs an HTTP contract your servers call, tenant separation between your customers, an isolated sandbox per task, and sessions, files, and results held for each end user beyond one process's lifetime. Those four are the service layer, and a product needs them regardless of which harness sits underneath, whether Codex, Claude Code, or Hermes.

Separate the model API from the agent harness

QuestionCodex-optimized model APICodex agent run
Primary interfaceOpenAI API request and model response.A task executed by Codex in a working environment.
InfrastructureYour team builds the loop, tools, sandbox, files, and persistence.The harness provides the execution workflow around the model.
Product outputText, structured output, or tool-call data you assemble.Repository changes, test results, files, and a reviewable task outcome.

How to actually run Codex behind your product

HarnessRouter runs Codex as a managed harness behind one API: your server submits a task, an isolated sandbox spins up for the run, progress streams to your product UI, and the session, files, and reviewable results come back under one contract. The same contract runs Claude Code and Hermes, so a Codex integration is also a comparison instrument:

  • Send a product task with the codex harness selection and a model from the current catalog; building and integration are free, and credits are used only when tasks run.
  • Stream progress, then fetch diffs, files, test evidence, and artifacts as explicit product outputs.
  • Continue sessions for revise-and-retry flows; keep keys and execution server-side with ownership checks per tenant.
  • Run the same task on other configurations and read the recorded traces before committing a workload.

Use the smallest layer that completes the job

Choose the model API
When you need coding-oriented inference and already own the agent loop and runtime.
Choose the Codex SDK
When developers on your team drive Codex on infrastructure you operate: CI pipelines, internal tools, one trusted operator surface.
Choose a Codex agent run behind an API
When end users of your product expect completed repository work, commands, tests, and a reviewable change, delivered multi-tenant.
Choose a multi-harness backend
When the product must route between Codex and other agent harnesses behind one stable integration and compare configurations on evidence.

FAQ

Does Codex have a hosted REST API?
Not in OpenAI's current documentation as of August 2026. The Codex SDK runs on your own infrastructure and controls a local Codex app-server; Codex Cloud is delegated through OpenAI's own surfaces rather than a documented public task endpoint. To run Codex tasks over HTTP, use a harness platform such as HarnessRouter.
What is the Codex SDK and where does it run?
TypeScript and Python libraries for controlling Codex programmatically: starting, continuing, and resuming threads, typically for CI/CD and internal tools. It runs on machines you operate, with the Python library controlling the local Codex app-server over JSON-RPC.
Is the Codex API the same as the OpenAI Responses API?
Not exactly. OpenAI exposes Codex-optimized models through its API, while Codex as an agent also includes an execution workflow around the model. Choose based on whether you need inference or completed agent work.
Can I put Codex behind my own product UI?
Yes. Through HarnessRouter your server submits Codex tasks over HTTP, streams progress to your users, and returns diffs, files, and artifacts as reviewable results, with sessions persisting for continue-and-revise flows and each run isolated in its own sandbox.
Why route Codex with other agents?
Routing lets a product use the harness best suited to each task while preserving one task, session, streaming, file, and artifact contract, and it turns configuration comparison into a parameter change backed by recorded traces.

Run Codex behind your product

The hosted HTTP path to Codex, with sessions, streaming, files, and recorded traces, alongside Claude Code and Hermes.

Start building free