Sign in

Run Codex in the cloud

Updated

Keep Codex working with your laptop closed: Codex Cloud, or the Codex CLI on a box that stays on with a ChatGPT sign-in of its own, the sandbox and approvals to set before you leave it, the ChatGPT app on your phone, and what it costs.

On this page6

A sleeping laptop runs nothing, so closing the lid stops the Codex CLI mid-task, and the ChatGPT app's remote access stops whenever the computer it connects to sleeps (OpenAI's docs). To keep Codex working, run it on a machine that stays on:

  • Codex Cloud. Tasks run on machines OpenAI manages, from an environment Codex prepares out of your GitHub repositories; each task gets its own workspace and keeps working while your computer sleeps (OpenAI's docs).
  • The Codex CLI in tmux on a server you run. You maintain the machine, set up Codex's sandbox on it, and move your code there with git.
  • A Prized box. A Linux machine that stays on, with the Codex CLI preinstalled, your project folder synced both ways, and its ports on your localhost; what Codex installs and builds stays on its disk. The steps follow.

1. Start Codex on a box

New to Prized? Sign up: the tour starts a box on $30 of free credit and gives you the command that installs the CLI (Quickstart). Then, in your project folder:

cd ~/code/myproject
prized setup --sync --agent codex --attach

Setup syncs the folder with ~/code/myproject on the box, copies your config.toml with its MCP servers, signs Codex in on the box, starts it in a tmux session named codex, and opens that session in this terminal.

Rather have Codex set it up? Paste the prompt from /codex into it. It copies your project to the box once, without sync.

2. A ChatGPT sign-in of the box's own

A ChatGPT sign-in can't be shared between machines: its refresh token rotates, so two machines using one auth.json sign each other out (OpenAI's docs). Setup runs codex login on the box and opens its sign-in page in your browser instead, and your laptop stays signed in (Credentials). prized agents run codex offers the same sign-in when Codex isn't signed in on the box yet, and prized agents handoff codex signs it in that way whenever it isn't.

Codex's own Sign in with ChatGPT, on its first screen on the box, can't finish there: it sends your browser back to the box's localhost, which your machine can't reach. Other ways in:

  • Device code: codex login --device-auth on the box prints a code to enter at the page it names, on any device. It is in beta, and you turn on device code sign-in in ChatGPT's security settings first; in a workspace, the admin does (OpenAI's docs).
  • An API key: setup copies an API-key sign-in from your laptop as is. Codex then bills the key's OpenAI account, not your ChatGPT plan.

3. Sandbox and approvals before you leave it

Codex runs commands in a sandbox, and on Ubuntu 24.04 that sandbox needs bubblewrap with a user-namespace allowance (OpenAI's docs). A box comes with both, so there is nothing to install.

In a folder it hasn't opened before, Codex first asks whether to trust it, and a session started without --attach waits at that question until you answer it (prized ssh -s codex). In a git project Codex then starts in its Auto preset: it edits and runs commands in the project, and asks before network access or touching anything outside it. A question waits until you come back, so pick what it may do before you go: /permissions in the session, or quit Codex and start it again with flags after --:

prized agents run codex --attach --dir code/myproject -- --sandbox workspace-write --ask-for-approval never

That keeps the sandbox and never asks: Codex makes its best effort within the sandbox's limits. Set the same as defaults with sandbox_mode and approval_policy in ~/.codex/config.toml on the box, and network_access = true under [sandbox_workspace_write] lets commands reach the network (OpenAI's docs). A later prized setup or handoff copies your laptop's config.toml over the box's, so make the same change there.

4. Close the lid, and check on it

Give Codex its task and close the laptop: the codex session belongs to the box, and its edits reach your laptop when it wakes (Sync).

  • The ChatGPT app on your phone: add the box as an SSH host with a phone password from the box's settings, and start Codex chats on it with no computer awake; they are separate from the codex session (Codex remote).
  • Any browser: open the box on the dashboard and pick Codex from the arrow beside Open terminal; it works on a phone too (Use Claude Code and Codex from your phone).
  • A terminal: prized ssh -s codex. If the session is gone, prized agents run codex --attach --dir code/myproject starts Codex again, and codex resume --last there picks the last conversation back up.
  • The Codex CLI on your laptop: codex --remote attaches its terminal UI to a Codex server on the box, and you can attach again after closing the lid (Codex remote environments).

On the free credit an idle box sleeps after 2 hours. Codex printing in its session counts as use, and prized box auto-pause BOX off keeps the box up through a quiet stretch of up to 12 hours, and with no limit on a plan or after a top-up (Auto-pause).

Hand it a task without a terminal

prized prompt --provider codex --cwd code/myproject --auto --detach "run the test suite and fix what fails"

This runs codex exec on the box and returns at once; prized events --follow follows it. Without --auto it runs in the workspace-write sandbox, which edits and runs commands in the project with no network; --auto runs codex exec --dangerously-bypass-approvals-and-sandbox. --effort sets model_reasoning_effort (Prompt an agent remotely).

What it costs

Codex runs on your ChatGPT plan or OpenAI API key, as on your laptop. Prized bills the box: a Small (4 vCPU, 16 GB) is $0.137 an hour awake, $1.37 for a 10 hour run overnight, and only its disk while it sleeps (Billing).

Running Claude Code too? Keep Claude Code running with your laptop closed covers it, and Run multiple Claude Code and Codex agents in parallel puts several on one box.