
# Claude Code VPS: keep your coding agent running 24/7

**A Claude Code VPS lets your coding agent work for hours while your laptop is closed.** On 0x.cloud, the s2-4 plan (2 vCPU, 4 GB RAM, 60 GB NVMe) costs $15.99 a month and comes with an AI agents image that already has Node, Python, Git, tmux and Docker. Servers run in Warsaw and use your own model account.


[Create server: s2-4, $15.99/mo](https://0x.cloud/cabinet/create?plan=s2-4)



## Why run Claude Code on a VPS

Running Claude Code locally works until it doesn't: the laptop sleeps mid-task, the agent can see your personal files, and long refactors or test runs tie up your machine. Moving Claude Code to a VPS fixes all three:

- **Always on.** The session lives in tmux; check in from the web console in your dashboard.
- **Isolation.** The agent works inside the server, away from your home directory and credentials.
- **A disposable dev box.** Spin up Docker, databases and test stacks without cluttering your workstation.
- **Fast pipes.** Unmetered traffic at up to 1 Gbps for clones, package installs and image pulls.

## Claude Code VPS requirements and the best plan

The [official Claude Code requirements](https://code.claude.com/docs/en/setup) are 4 GB+ RAM, an x64 or ARM64 processor, and Ubuntu 20.04+ or Debian 10+. That makes s2-4 the natural starting point.

| Workload | Plan | Specs | Monthly |
|---|---|---|---|
| One agent, a typical web project, tests | **s2-4** | 2 vCPU, 4 GB RAM, 60 GB NVMe | $15.99 |
| Several sessions, a Compose stack, headless browser for e2e | s4-8 | 4 vCPU, 8 GB RAM, 120 GB NVMe | $31.99 |

s1-1 and s1-2 fall below the documented memory minimum, so we don't recommend them for Claude Code. Want to try before committing? Bill hourly for a day, then delete the server if it isn't right; the unused balance stays with you.

## Claude Code VPS setup in 5 steps

1. **Create a server:** s2-4 with the AI agents image (Ubuntu 24.04 with Node, Python, Git, tmux, Docker).
2. **Open the web console** of the server in your dashboard.
3. **Install Claude Code** with the official installer if the image doesn't already have it:

```bash
curl -fsSL https://claude.ai/install.sh | bash
claude --version   # confirm the install
```

4. **Run it inside tmux** so closing the console doesn't kill the session:

```bash
tmux new -s agent      # new session
cd ~/project && claude # log in and give it a task
# Ctrl+B, then D: detach while the agent keeps working
tmux attach -t agent   # come back later
```

5. **Authenticate.** On first run, `claude` prints a login link; open it in the browser on your own computer. Or set `ANTHROPIC_API_KEY` in the environment.

The full walkthrough with a non-root user and auto-start is at [deploy Claude Code](https://0x.cloud/deploy/claude-code). For long-running agents, read [how to run Claude Code 24/7](https://0x.cloud/blog/run-claude-code-24-7).

### Let Claude provision its own server

0x.cloud is built for agents. Claude Code connects to our MCP server, gets an exact price with `dry_run`, and creates the VPS itself. Its API key has scopes (read, create, delete) and a monthly spend limit: past it, the agent can't buy anything new (hourly servers it already runs keep billing). More on [hosting for AI agents](https://0x.cloud/ai).


```text
Using the 0x.cloud MCP server, get a dry_run price for an s2-4 server with the AI agents image. If it's under $16 a month, create it and tell me when it's ready.
```


## Where to run Claude Code: options compared

| Option | Runs without your PC | Isolated from personal files | Cost | Fits |
|---|---|---|---|---|
| Your laptop | no | no | $0 | short sessions next to your code |
| Home server or mini PC | yes | yes | hardware plus power | you already own spare hardware |
| Claude Code cloud sessions | yes | yes | within your Claude plan | repo tasks without a custom environment |
| 0x.cloud VPS | yes | yes | $15.99/mo or hourly | full control: Docker, databases, your own tools |

Running more than one agent? See [VPS for AI agents](https://0x.cloud/vps-for-ai-agents) for multi-agent setups and plans for browser automation.

## Claude Code VPS FAQ

**What are the Claude Code VPS requirements?**
Anthropic's docs list 4 GB+ RAM and an x64 or ARM64 CPU, with Ubuntu 20.04+ or Debian 10+ on Linux. On 0x.cloud that's the s2-4 plan: 2 vCPU, 4 GB RAM, 60 GB NVMe for $15.99 a month.

**What is the best VPS for Claude Code?**
One that meets the 4 GB minimum, ships with Git, Node and tmux, and stays online. For a single agent, s2-4 with the AI agents image. For several sessions or browser testing, s4-8.

**How do I log in to Claude Code on a headless server?**
Run claude and open the login link it prints in the browser on your own computer, or set ANTHROPIC_API_KEY in the environment and approve it on first run.

**How do I keep Claude Code running after I disconnect?**
Start it inside tmux. Detach with Ctrl+B then D, and reattach later with tmux attach. The session keeps working on the server.

**Do I need a Claude subscription?**
Yes. Claude Code requires a paid Claude plan or a Console (API) account. The free claude.ai plan doesn't include it. You bring your own account; we don't resell model access.
