How to run Claude Code (or Codex) 24/7 in the cloud
Closing your laptop stops Claude Code, because a sleeping computer runs nothing. To keep an agent working through the night, or through the week, it has to run on a machine that stays on. There are four ways to get one: let Anthropic or OpenAI run it, rent a server, keep a Mac on at home, or use a cloud dev box. Each costs something different: money, setup, or what is kept between runs.
The options at a glance
| The machine, a month | What you run yourself | Kept between runs | |
|---|---|---|---|
| Claude Code on the web | Nothing beyond your plan | Nothing | A fresh clone each session |
| Codex Cloud | Nothing beyond your plan | Nothing | A task’s VM, for 7 days |
| A VPS | €19.99 (Hetzner, EU) or $24 (DigitalOcean) | The server, sign-in, updates | Its disk |
| A Mac mini at home | $899 once, plus about $0.53 of power | The Mac, your network, power cuts | Its disk |
| A Prized box | $25 (Micro), less while it sleeps | Nothing | Its disk |
| An Upstash Box | $8 kept alive (Small) | Nothing | Its files |
On top of the machine, the agent needs its own plan, wherever it runs. Claude Pro is $20 a month ($17 billed yearly), Max $100 and Ultra $200 (Anthropic). ChatGPT Plus is $20 a month and Pro starts at $100 (OpenAI). Claude Code asks for 4 GB of memory or more (Anthropic), so the prices above are for machines with 4 GB.
1. Let the vendor run it: Claude Code on the web and Codex Cloud
Both run the agent in a VM the vendor manages, keep working with your laptop closed, and cost nothing beyond your plan’s usage.
- Claude Code on the web is on Pro, Max, Ultra and Team, and on Enterprise with premium or Chat + Claude Code seats, with no separate charge for the VM: about 4 vCPU, 16 GB of memory and 30 GB of disk. Each session starts in a fresh VM with your GitHub repository cloned (or a local one uploaded); after a few idle minutes the VM pauses with its files saved, and a paused VM can later be reclaimed (Anthropic).
- Codex Cloud is on ChatGPT Plus, Pro, Business and Enterprise, and its tasks share your plan’s usage with local Codex. A task gets 2 vCPU, 8 GiB of memory and an 8 GiB disk on Plus, and 4 vCPU, 16 GiB and 32 GiB on Pro and up; its saved VM state is recoverable for up to seven days after you last start a turn. It works from GitHub repositories; GitLab and computer or browser use are not supported yet (OpenAI).
Fits when the code is on GitHub and each task can start clean. Falls short when a run needs what isn’t in the repo (a database with data in it, a build cache, a tool you installed), pushing to a git host other than GitHub, or a machine you can open a shell on.
2. A VPS with tmux
Rent a Linux server, install Claude Code or Codex, and run it inside tmux so it outlives your SSH connection: tmux new -s claude, start the agent, and detach with Ctrl-b d; tmux attach -t claude brings it back. At 2 vCPU and 4 GB, Hetzner’s CPX22 is €19.99 a month before VAT in Nuremberg and Helsinki (Hetzner); its US locations have no plan of that size, and its cheaper CX23 (€5.99) was marked not available (Hetzner). A DigitalOcean Droplet of that size is $24 a month (DigitalOcean).
Fits when you want a low monthly price and full control. Falls short when you don’t want to run a server: the SSH keys, firewall, sign-in (/login over SSH, pasting the code back), updates, and moving your code with git are yours.
3. A Mac mini at home
The current Mac mini starts at $899, with an M6 chip and 16 GB of memory (Apple). Apple measures it at 4 W idle and 70 W at most (Apple). At the US average home electricity price for August 2026, 18.16 cents a kWh (EIA), idling around the clock costs about $0.53 a month (4 W × 730 hours = 2.92 kWh), and flat out about $9.28. Spread over three years, our own assumption, the Mac is about $25 a month.
To keep it working with the display off, turn on Prevent automatic sleeping when the display is off in System Settings > Energy, and set the Mac to start up again after a power failure, in the same place (Apple). Claude Code’s Remote Control then lets you follow and steer a session from the Claude app, as long as that computer stays on and claude keeps running (Anthropic).
Fits when you already own one, or need macOS, say for iOS builds. Falls short when you’re away from home: a power cut or an update that restarts the Mac ends the session until you start it again, the agent works only while your home connection does, and reaching the Mac from outside your network is yours to set up.
4. A cloud dev box
A machine that someone else runs and you keep: the disk stays between runs and the agent runs in your own terminal session. Several are built for agents, and they differ in what happens when nothing is happening:
- Prized: a Linux VM with Claude Code and Codex preinstalled, no maximum run time, and auto-pause off by default on a plan. A Micro (2 vCPU, 4 GB, 80 GB disk) is $25 a month around the clock; asleep, it bills only its disk ($0.008 an hour).
- Upstash Box: a container with Claude Code and Codex built in. Kept alive, a Small (2 vCPU, 4 GB, 10 GB disk) is $8 a month flat, CPU and disk included; otherwise an idle box pauses after 6 hours on a paid plan, keeping its files but not its processes (Upstash).
- boxes.dev: $19 per user a month with 50 hours, then $0.40 an hour, on 4 vCPU and 8 GB; a box sleeps after about five minutes without activity, and nothing runs while it sleeps (boxes.dev).
- Replicas: $50 a month with $50 of usage included and $100 free to start; a workspace sleeps after 30 minutes without activity (Replicas).
- Northflank Cloud Harnesses: run until you pause or delete them, and a free project holds one (Northflank).
- GitHub Codespaces: stops after 30 idle minutes by default (4 hours at most) and after 12 hours however busy it is, so a longer run has to be restarted (GitHub).
Fits when you want a VPS’s persistence without running one. Falls short when price is all that matters: an Upstash Box kept alive or a VPS in the EU costs less than a Prized Micro, and a Mac you already own costs only its power.
How to do it on Prized
We ran these steps on November 6 on a Micro, with a small Python project whose two tests failed. To start, sign up: the tour starts a box on $30 of free credit, with no card, and shows one command that installs the CLI and signs it in (Quickstart).
Start the agent on the box
In your project folder:
cd ~/code/myprojectprized setup --sync --agent claude --attachSetup syncs the folder with ~/code/myproject on the box both ways, copies your Claude Code sign-in and settings (if you’re signed in on this machine), starts Claude Code in a tmux session named claude, and opens it here. For Codex, use --agent codex. Give it a task, then close the laptop: the session belongs to the box.
Come back to it
prized ssh mybox claudeHere and below, mybox is your box’s name; prized box ls lists them. That opens the same session. On the dashboard, the box’s Claude Code terminal opens it in a browser, on a phone too.
Hand it a task without a terminal
prized prompt mybox --provider claude --cwd code/myproject --auto --detach "run the tests and fix what fails"prized events mybox --followThis runs Claude Code headless on the box and returns at once; --auto lets it run commands without asking (it runs claude --dangerously-skip-permissions). On our run, Claude Code ran the tests, found a rounding bug, fixed it and ran them again in about 20 seconds, and the fixed file was in the laptop’s folder moments later. We then started a second task and stopped the laptop’s Prized background service right away, as a closed lid would; the task finished on the box anyway, and prized events showed all of it when we looked.
Keep it up, or let it sleep
prized box auto-pause mybox off # on the free credit, keep it up through quiet stretchesprized box pause mybox # stop paying for compute; only the disk billsprized box rm mybox # done with it; type its name to confirmOn the free credit a box pauses after 2 idle hours, so turn auto-pause off before you leave a long task: off holds it up through 12 idle hours there, and with no limit on a plan or after a top-up. On a plan, auto-pause is off unless you set it. A paused Micro bills $0.008 an hour for its disk and, for up to 3 days, keeps its running sessions; on ours, prized ssh woke it in 16 seconds with the tmux sessions still there (Auto-pause).
What it costs on Prized
A Micro awake all month is $25 ($0.034 an hour), enough for one agent; a Small (4 vCPU, 16 GB) is $0.137 an hour, for several agents or heavier builds. The $30 of free credit runs a Micro around the clock for about five weeks. Claude Code and Codex still use your own Claude or ChatGPT plan, as on your laptop (Billing).
Common questions
What is the cheapest way to run Claude Code 24/7?
If your code is on GitHub and each task can start clean, Claude Code on the web, which adds nothing to your plan. For a machine that stays on at 2 vCPU and 4 GB, an Upstash Box kept alive ($8 a month) or Hetzner’s CPX22 in the EU (€19.99 a month before VAT). A Mac mini you already own costs only its power.
Does Claude Code keep running when I close my laptop?
Not on the laptop. It keeps running on a machine that stays on: a vendor’s cloud session, a server or box with Claude Code in tmux, or a Mac set not to sleep.
Can I use my own Claude or ChatGPT plan?
Yes, on every option here. On a Prized box, setup copies your sign-in, and Prized bills only the machine.
More in the docs
Keep Claude Code running with your laptop closed covers sign-in, permission modes and plan limits for long runs, and Run Claude Code in the cloud compares more hosted options side by side.
Sources
Every page here was read on November 6, 2026.
- Anthropic: Claude Code on the web, cloud environments, Remote Control, system requirements, plans.
- OpenAI: Codex cloud environments, Codex pricing, ChatGPT plans.
- Hetzner: Regular Performance, Cost-Optimized.
- DigitalOcean: Droplet pricing.
- Upstash: Box pricing, how Box works, built-in agents.
- Apple: Mac mini, power consumption, Energy settings.
- U.S. EIA: residential electricity price, August 2026.
- GitHub Codespaces: lifecycle, idle timeout.
- Northflank: Cloud Harness quickstart.
- boxes.dev: home page, sleep and wake.
- Replicas: pricing, workspaces.
- Prized: Billing, Machines, Boxes; the commands are our own run on November 6.