# Codex cloud explained: how to run OpenAI Codex in the cloud

Codex cloud is OpenAI's hosted way to run Codex. Replicas is another: it runs the Codex CLI in a dedicated cloud VM per task, alongside Claude Code and other agents. This guide explains how a Codex cloud task runs, how it compares with local Codex and Codex Remote, and the other ways to run Codex in the cloud.

- Canonical: https://replicas.dev/resources/codex-in-the-cloud
- Start a free trial: https://app.replicas.dev/auth?mode=signup
- What are cloud coding agents?: https://replicas.dev/resources/cloud-coding-agents

## What Codex cloud is, and what it is called now

OpenAI's documentation calls the hosted product Codex cloud. Some OpenAI pages and the Codex GitHub README call it Codex web, and the docs now call each task a cloud chat. Cloud chats are included with ChatGPT Plus, Pro, Business, and Enterprise and Edu plans, and they require signing in with ChatGPT rather than an API key.

Codex runs in four places, and searches for "Codex in the cloud" often mix them up.

- **Codex cloud:** Tasks run in an OpenAI-managed container. Start them from chatgpt.com/codex, the ChatGPT iOS app, the IDE extension, the CLI with codex cloud, @codex mentions in GitHub, GitLab, and Slack, or by assigning or mentioning Codex on a Linear issue.
- **Local Codex:** The Codex CLI, IDE extension, and desktop app run on your machine against your own checkout.
- **Codex Remote:** You start, approve, and review tasks from the ChatGPT mobile app, but the work runs on a Mac or Windows PC connected through the ChatGPT desktop app.
- **Codex on a server you run:** The open-source Codex CLI installed on a VPS, a cloud VM, or a CI runner, used interactively over SSH or non-interactively with codex exec.

## How a Codex cloud task runs

Each cloud chat runs in an environment you configure once at chatgpt.com/codex. The sequence is the same for every task.

- Codex creates a container from the universal image, which includes common languages and lets you pin runtime versions, and checks out your repository.
- Setup runs with internet access. Codex can install npm, yarn, pnpm, pip, pipenv, and poetry dependencies automatically, or run your own setup script. Secrets are available only during setup and are removed before the agent starts, while environment variables stay available for the whole task.
- The agent phase starts with internet access off. Each environment can allow common dependency domains, all domains, or a custom allowlist, and can restrict requests to GET, HEAD, and OPTIONS.
- Container state is cached for up to 12 hours, and an optional maintenance script runs when a cached container resumes. Changing the setup or maintenance script, variables, or secrets resets the cache.
- Codex returns a summary and a diff. You review it, ask for changes in the same chat, and open a pull request when the work is ready.

## Codex cloud vs local Codex vs Codex Remote

When you sign in with ChatGPT, all three draw from the same plan allowance, while local Codex signed in with an API key bills at API rates instead. OpenAI notes that cloud chats on ChatGPT plans use GPT-5.6 Sol and can use more of that allowance than local messages.

- Use Codex cloud for well-scoped tasks you want to hand off and review later, especially ones that start in GitHub, GitLab, Linear, or Slack.
- Use local Codex when the task needs local services, a private network, or quick back-and-forth.
- Use Codex Remote when the work has to happen on your desktop and you want to approve it from your phone.

| Compared on | Codex cloud | Local Codex | Codex Remote |
| --- | --- | --- | --- |
| Where the work runs | OpenAI-managed container | Your machine | Your Mac or Windows PC, controlled from the ChatGPT mobile app |
| Keeps running when your laptop closes | Yes | No | Only if the desktop machine stays on |
| Environment | universal image plus setup script, cached up to 12 hours | Whatever is installed locally | Whatever is installed on the desktop machine |
| Network during the task | Off by default, configurable per environment | Your network, subject to Codex sandbox settings | The desktop machine's network |
| Git hosts | GitHub, and GitLab in beta | Any | Any |
| Sign-in | ChatGPT account | ChatGPT account or API key | ChatGPT account |

## Other ways to run Codex in the cloud

Codex cloud has limits that push some teams elsewhere. OpenAI does not publish CPU or memory figures for the container beyond larger VMs on Business plans, API-key accounts cannot use it, the container is rebuilt from a cache rather than kept as a persistent machine, and it works with GitHub and GitLab only. The options below run the Codex CLI somewhere else. Replicas, which publishes this guide, is a strong fit when a team hits these limits.

| Option | Where Codex runs | How work starts | Sign-in | Best for |
| --- | --- | --- | --- | --- |
| Replicas | A dedicated Linux VM per task, built from an environment your team defines | Dashboard, Slack, Linear, GitHub, GitLab, schedules, webhooks, API, iOS app | ChatGPT subscription, OpenAI API key, OpenAI-compatible endpoint, or Microsoft Foundry | Teams running Codex, alone or alongside other agents |
| Codex cloud | OpenAI-managed container | chatgpt.com/codex, IDE, CLI, iOS, GitHub, GitLab, Linear, Slack | ChatGPT plan | Handing off tasks with no infrastructure |
| VPS or cloud VM | A server you rent and maintain | SSH into tmux, or codex exec from scripts and cron | ChatGPT device login or API key | A persistent machine you control |
| DigitalOcean for Codex | A Droplet in your DigitalOcean account | ChatGPT desktop app over SSH | Codex signed in on the Droplet | A persistent VM with less manual setup |
| GitHub Actions | GitHub-hosted runners | Workflow events through openai/codex-action | OpenAI or Azure OpenAI API key | CI checks and scheduled jobs |

### Replicas: best for teams running Codex in the cloud

Source: https://replicas.dev/

Replicas runs the Codex CLI in a dedicated Linux VM per task, built from an environment your team defines once. Tasks start from the dashboard, Slack, Linear, GitHub, GitLab, a schedule, a webhook, the API, or the iOS app, and come back as a pull request or an investigation your team reviews.

A Replicas workspace is a full development machine, where Codex cloud gives you a container and a diff. Every workspace includes a Linux desktop with Chrome that Codex can drive to test its own work, and that you can watch or take over with your own mouse and keyboard. You also get terminals, in-place file editing with code intelligence, and preview URLs for apps the agent starts. OpenAI's Codex cloud documentation describes none of these.

Tasks start faster because setup happens before you ask. Warm hooks run heavy setup such as dependency installs, builds, and Docker image pulls ahead of time, so each task claims a pre-warmed workspace. Codex cloud reuses a cached container for up to 12 hours and resets it whenever setup scripts, variables, or secrets change.

Workspaces are multiplayer. Teammates open the same workspace, see who else is there and who is typing, follow the plan and live session, and comment on diffs. Workspaces sleep when idle and can be woken later, so a reviewer can send the agent back to the same environment to address feedback.

Replicas also removes the sign-in limits of Codex cloud. Codex can use your ChatGPT subscription, an OpenAI API key, an OpenAI-compatible endpoint, or Microsoft Foundry, and the same workspace can run Claude Code, OpenCode, Cursor, and other agents. Analytics attribute agent time to people, agents, models, and credentials, and enterprise plans add SCIM, audit logs, static egress IPs, and dedicated or self-hosted deployment.

### A VPS or cloud VM: the Codex CLI on your own server

Source: https://learn.chatgpt.com/docs/non-interactive-mode

Install the Codex CLI with OpenAI's install script, npm, or Homebrew, clone the repository, and run Codex inside tmux so it survives SSH disconnects. On a machine without a browser, sign in with codex login --device-auth, a beta that you or your workspace admin enable in ChatGPT settings first, copy ~/.codex/auth.json from a machine where you already signed in, or pipe an API key to codex login --with-api-key.

codex exec runs a task without the interactive UI. It starts in a read-only sandbox, --sandbox workspace-write lets it edit files, and --json streams events as JSON Lines for scripts. The older --full-auto flag is deprecated, and OpenAI says to disable approvals and the sandbox only inside an isolated runner.

You maintain the server, the secrets, and the cleanup, and every task on the machine shares its credentials.

### DigitalOcean for Codex: a persistent Droplet that Codex sets up

Source: https://www.digitalocean.com/blog/run-codex-in-the-cloud

DigitalOcean for Codex, in public preview since June 2026, is a plugin that has Codex create a persistent Droplet in your DigitalOcean account with the Codex CLI and codex-universal tooling installed. You connect to it through SSH connections in the ChatGPT desktop app and can hand a chat off between machines, though not to a Codex cloud environment.

It removes most of the VPS setup, but the Droplet is still yours to pay for, secure, and shut down.

### GitHub Actions: Codex in CI

Source: https://learn.chatgpt.com/docs/github-action

The openai/codex-action workflow installs the Codex CLI on a GitHub Actions runner and runs codex exec with the permissions you set. It authenticates with an OpenAI or Azure OpenAI API key stored as a GitHub secret, and on Linux and macOS runners it drops sudo by default before Codex runs.

Use it for checks and scheduled jobs defined in workflows. For pull request review, Codex cloud's @codex review command and automatic reviews need no workflow file.

## When Replicas is the right way to run Codex in the cloud

Replicas is strongest when Codex work is shared across a team rather than run from one person's ChatGPT account. Teams typically choose it when several of the following are true.

- You want to keep Codex as the agent and give each task its own cloud VM.
- You want the agent to test its work in a real desktop and browser, and to take over that desktop yourself when needed.
- Teammates should be able to join the same workspace, follow the live session, and review together.
- Your team pays for OpenAI through API keys, an OpenAI-compatible gateway, or Microsoft Foundry rather than ChatGPT seats.
- You want tasks from Linear, Slack, GitHub, GitLab, schedules, or webhooks to run against one environment definition.
- You want to use Claude Code or OpenCode for some tasks without maintaining a second setup.
- You want reviewers to wake a task's workspace and send the agent back to address feedback.
- You need audit logs, SCIM, and a record of who ran what, with which agent and model, at what cost.

## Set up Codex cloud in five steps

OpenAI's cloud environment documentation covers each step in detail. This is the short version.

- Sign in at chatgpt.com/codex with a plan that includes cloud chats. Accounts that use an email and password need multi-factor authentication first.
- Connect GitHub, or GitLab through the beta integration, and choose a repository.
- Create an environment on the universal image, pin runtime versions if you need to, and add a setup script if automatic dependency installation is not enough.
- Leave agent internet access off unless tasks need to fetch packages or call external APIs, then allow the smallest preset that works.
- Add an AGENTS.md with build, test, and review instructions, start a cloud chat, and review the diff before opening a pull request.

## FAQ

### What is the best way to run Codex in the cloud?
If you are on a ChatGPT plan and only use Codex, start with Codex cloud. For a team, Replicas is the better fit: each task runs Codex in its own VM from a shared environment, it works with ChatGPT sign-in, OpenAI API keys, OpenAI-compatible endpoints, and Microsoft Foundry, and the same workspace can run Claude Code or OpenCode.

### Is Codex cloud the same as Codex web?
Yes. OpenAI uses both names for the hosted product: the main documentation page is titled Codex cloud, while the IDE docs and the Codex GitHub README say Codex web. Tasks in Codex cloud are now called cloud chats.

### Which ChatGPT plans include Codex cloud?
OpenAI's Codex pricing page lists cloud chats for Plus, Pro, Business, and Enterprise and Edu plans. Local and cloud usage share the plan's allowance, measured per five-hour window with possible weekly limits. Accounts that use Codex with an API key cannot run cloud chats.

### Does Codex cloud have internet access?
During setup, yes, so dependencies can install. During the agent phase, internet access is off by default. Each environment can allow common dependency domains, all domains, or a custom allowlist, with an option to allow only GET, HEAD, and OPTIONS requests.

### Does Codex cloud support GitLab?
Yes, in beta, on plans that include Codex cloud. Self-managed GitLab 19.0 or newer and GitLab Dedicated connect through a service account set up by a workspace admin, and @codex review works on merge requests.

### How long does a Codex cloud container last?
OpenAI caches container state for up to 12 hours so follow-up tasks start faster, and resets the cache when setup scripts, variables, or secrets change. It is not a persistent machine. For one, run the Codex CLI on a VPS or use DigitalOcean for Codex.

### Can I start Codex cloud tasks from the command line?
Yes. The Codex CLI includes an experimental codex cloud command. codex cloud exec starts a cloud chat in the environment you pass with --env, and codex cloud list shows existing ones. codex exec, without cloud, runs the task locally instead.

## Run Codex in the cloud with your team

Replicas includes a 14-day free trial with no credit card required. Connect a GitHub or GitLab repository, define the environment once, connect Codex with your ChatGPT subscription or an OpenAI API key, and start a task from the dashboard, Slack, Linear, or a pull request comment. Each task runs in its own Linux VM and comes back as a pull request your team reviews.

## Related docs

- [Claude Code in the cloud](https://replicas.dev/resources/claude-code-in-the-cloud): Compare self-hosted, vendor-hosted, and managed options for running Claude Code off your laptop.
- [OpenCode in the cloud](https://replicas.dev/resources/opencode-in-the-cloud): Compare self-hosted and managed options for running OpenCode off your laptop.
- [Cloud dev environments for coding agents](https://replicas.dev/resources/cloud-dev-environments-for-coding-agents): Compare self-hosted dev environments, microVM sandboxes, and agent workspaces for running agents off laptops.
- [Codex cloud environments](https://learn.chatgpt.com/docs/environments/cloud-environment): OpenAI's reference for the universal image, setup scripts, secrets, and caching.
