Servers

Claude Code on a VPS: why keep the agent on a server, which plan to take and how to set it up

accsly editorial 14 min read
Node Proxy
In this piece
  1. Why keep Claude Code on a server rather than a laptop
  2. Which server fits your work?
  3. Five mistakes that make an agent on a server work badly
  4. How to set up the server in 20 minutes
The short answer
  1. Claude Code runs in the terminal while the model answers from Anthropic's servers, so you do not need a GPU. You need Linux on KVM: the documentation asks for at least 4 GB of RAM, an x64 or ARM64 processor and Ubuntu 20.04+ or Debian 10+.
  2. For one agent take 2 cores, 4 GB and an SSD of 40 GB or more. Half of such plans cost less than $22.78 a month, about $273 a year, and a quarter cost less than $14. Docker and parallel sessions need 8–16 GB.
  3. Run the agent as a separate user inside tmux, keep the key in a file with 600 permissions and leave only SSH open to the outside. The session then survives a closed laptop, and an agent's mistake does not touch the rest of the system.

Plans with these specs under $6 almost always come with a catch: a year paid up front, a setup fee or a server without its own IPv4 address. That is why they are not in the list above, and in the section on traps I will show how to spot these terms on a host's website.

01 · Why

Why keep Claude Code on a server rather than a laptop

On a laptop the agent lives only while the lid is open. Close it in the middle of a long task — a test run, a dependency upgrade, moving a module to a new library version — and the work stops. On a server the session runs inside tmux: you disconnect, reconnect in the morning and see where the agent stopped. The TransIP guide to Claude Code on a VPS recommends the same approach.

The second reason is isolation. The agent runs commands in a terminal: it installs packages, starts builds and edits files. Your work laptop also holds personal documents, keys to other projects and passwords saved in the browser. On a separate server the agent sees only what you put there, and a broken environment is easier to recreate than to repair.

The third is automation. In non-interactive mode, claude -p "task" runs one instruction and exits, and with --output-format json it hands the answer to a script, as the documentation describes. Such a call fits nicely into cron or a build step, which is why the agent's server often doubles as a server for a CI runner.

What runs where
Diagram: a laptop, a server with Claude Code and outside services The laptop connects to the server over SSH. The server holds a separate user, a tmux session, Claude Code, repositories, tests and Docker. Outgoing HTTPS requests go to the model API and to the Git host. The model does not run on the server, so no GPU is needed. Laptop ssh and tmux attach browser for sign-in close it — the work keeps going SSH VPS · Linux on KVM a separate user, dev tmux → claude, session stays up repositories, tests, Docker key in a 600 file, port 22 only HTTPS SSH key Model API where Claude thinks Git host a key for one repository No GPU needed: the server needs memory for builds and a fast disk for dependencies Diagram: a laptop, a server with Claude Code and outside services The laptop connects to the server over SSH. The server holds a separate user, tmux, Claude Code, repositories and tests. Requests go to the model API and the Git host. No GPU is needed. Laptop ssh, tmux attach, browser for sign-in VPS · Linux on KVM user dev, agent without sudo tmux → claude, session stays up repositories, tests, Docker key in a 600 file, port 22 only Model API over HTTPS Git host a key for one repo No GPU needed: what matters is memory for builds and a fast disk
Only the terminal side runs on the server: commands, files, tests. The model's answers arrive over HTTPS, so the server needs memory, disk and a stable network rather than a GPU. Our diagram, based on the Claude Code documentation.
02 · Configuration

Which server fits your work?

Claude Code itself weighs almost nothing. The official setup page asks for 4 GB of RAM, an x64 or ARM64 processor and Ubuntu 20.04+, Debian 10+ or Alpine 3.19+; the TransIP guide gives the same 4 GB floor. Everything above that is eaten by your project: npm install, compilation, a test database in Docker. So pick the server by the heaviest command the agent will run.

One agent, one project

Scripts, a Python or Node.js backend, a website without a heavy build.

  • 2 vCPU
  • 4 GB
  • SSD from 40 GB
  • KVM
$22.09/mo≈ $265 a year — median with hourly billingOne in ten such plans costs less than $8.28 (≈ $99 a year); 265 plans from 121 hosts.

This is exactly the documented minimum. There is enough memory for the agent, git and an editor, and a small project's tests run without swapping. If the frontend build dies from lack of memory, that is the first sign it is time for 8 GB.

Docker and a full test run

The project starts with docker compose, a database and a queue; tests take minutes.

  • 4 vCPU
  • 8 GB
  • NVMe from 80 GB
  • KVM
$37.57/mo≈ $451 a year — median with hourly billingA quarter of such plans cost less than $26.23 (≈ $315 a year); 110 plans from 57 hosts.

Images, layers and the dependency cache quickly take up tens of gigabytes, so the disk matters here as much as memory. NVMe noticeably speeds up installing dependencies. Docker runs on KVM, while under container virtualisation it often fails to start; more on the VPS for Docker page.

Several agents in parallel

Two or three agents on separate branches of one repository, each with its own tests.

  • 4+ vCPU
  • 16 GB
  • NVMe from 160 GB
  • KVM
$74.99/mo≈ $900 a year — median with hourly billingA quarter of such plans cost less than $51.93 (≈ $623 a year); 107 plans from 52 hosts.

Each session is a separate process with its own builds, and the load peaks add up. We would count it like this: one session with tests needs 4 GB, and each additional one another 4 GB. That is our rule of thumb, not a documented requirement, so check it with free -h while the work is in full swing.

How many plans pass each condition
How many VPS plans remain after each condition for Claude Code 29,231 VPS plans from 2,164 hosts in total. Linux on KVM: 25,208. With 4 GB of RAM or more: 19,827. With 2 cores or more: 19,333. With an SSD or NVMe of 40 GB or more: 16,382. With their own IPv4: 16,201. With hourly billing: 1,838 plans from 142 hosts. All VPS in the catalogLinux on KVMRAM from 4 GB2 cores or moreSSD/NVMe 40 GB+Own IPv4 Hourly billing 29,231 25,208 19,827 19,333 16,382 16,201 1,838 plans from 142 hosts — roughly one in nine No sold-out plans, GPU servers or hosts outside accsly.io ratings How many VPS plans remain after each condition 29,231 VPS plans from 2,164 hosts in total. Linux on KVM: 25,208. With 4 GB of RAM or more: 19,827. With 2 cores or more: 19,333. With an SSD or NVMe of 40 GB or more: 16,382. With their own IPv4: 16,201. With hourly billing: 1,838 plans from 142 hosts. All VPS in the catalog29,231 Linux on KVM25,208 RAM from 4 GB19,827 2 cores or more19,333 SSD/NVMe 40 GB+16,382 Own IPv416,201 Hourly billing1,838 from 142 hosts
Claude Code's requirements cut little: more than half of the catalog's plans meet them. Hourly billing narrows the choice the most. accsly.io catalog as of 17.11.2026, VPS plans without sold-out ones, GPU servers and hosts outside the ratings.

Hourly billing is handy when you need a server for an evening or for one overnight job. Create the server, give the agent its instruction, check the result and delete it — you pay only for the hours that passed. For 1,185 of the 1,838 hourly plans the host offers an API, so a script can create and delete the server. When this beats monthly billing is covered in the handbook: when paying by the hour is worth it.

What a server for the agent costs
a quarter of plans are cheaperup to the median
4 GB2,667 plans
$22.78$14.00
≈ $273a year
8 GB3,116 plans
$39.99$23.51
≈ $480a year
16 GB2,464 plans
$70.00$40.95
≈ $840a year
32 GB1,584 plans
$116.03$70.25
≈ $1,392a year
0$30$60$90$120
Chart data
RAMPlansA quarter cheaper thanMedianMedian, hourly
4 GB2,667$14.00$22.78$22.09 (265)
8 GB3,116$23.51$39.99$40.01 (311)
16 GB2,464$40.95$70.00$79.99 (289)
32 GB1,584$70.25$116.03$154.99 (216)
Going from 4 to 8 GB costs about $17 a month more, from 8 to 16 GB another $30. Linux on KVM, 2+ cores, SSD or NVMe from 40 GB, own IPv4, no multi-month prepayment and no setup fee. US dollars per month with monthly billing, accsly.io catalog as of 17.11.2026.

We would start with 4 GB on hourly billing and move up only when memory runs short. At 4 and 8 GB hourly plans cost the same as ordinary ones, while at 16 GB and above they are already 14–34% more expensive. If the server runs around the clock, a large plan is cheaper on monthly billing.

03 · Traps

Five mistakes that make an agent on a server work badly

  1. A 2 GB plan "to start with"

    Claude Code will start on it, but the first build with npm install or compilation hits the memory ceiling, and the system starts killing processes. The documentation names 4 GB as the minimum.

    How to tell: dmesg shows "Out of memory: Killed process" lines, and tests break off with no error in the code.

  2. Container virtualisation instead of KVM

    On OpenVZ and LXC the server has no kernel of its own. The agent itself works, but Docker for a test database often will not start. Among plans with 4 GB or more the catalog has about 400 of these.

    How to tell: the plan description says OpenVZ, LXC or "container"; systemd-detect-virt answers openvz or lxc.

  3. A server without its own IPv4

    Such plans are cheaper but work over IPv6 only, and as of 17.11.2026 github.com has no IPv6 address — we checked with a DNS query. Cloning simply never starts. More in the handbook on IPv4 and IPv6 on a server.

    How to tell: "IPv6 only" or "NAT" in the plan name; curl -4 ifconfig.me gets no answer on the server.

  4. The agent running as root

    Root has no limits: one wrong command and the whole system is broken. The documentation specifically warns that the no-prompts mode --dangerously-skip-permissions refuses to run as root and is meant only for isolated containers.

    How to tell: the shell prompt ends in # rather than $.

  5. The API key in the repository or the shell history

    A line like export ANTHROPIC_API_KEY=… typed in the terminal stays in ~/.bash_history, and a .env file in the project can be committed by the agent by accident. A leaked key spends your money until it is revoked.

    How to tell: grep -r ANTHROPIC ~/.bash_history ~/projects finds something.

04 · Setup

How to set up the server in 20 minutes

The commands below are for Ubuntu 22.04 or 24.04. On Debian they are the same; on Alpine use apk instead of apt and install bash and curl first, because the installer will not work without them.

  1. Create a separate user

    The agent will run as this user, and root stays for system maintenance only.

    adduser dev
    mkdir -p /home/dev/.ssh && cp ~/.ssh/authorized_keys /home/dev/.ssh/
    chown -R dev:dev /home/dev/.ssh
  2. Close everything except SSH

    The agent often starts a dev server on port 3000 or 8000. Without a firewall the whole internet can see it. View it through a tunnel instead: ssh -L 3000:localhost:3000 dev@server. The other first steps are in the handbook on VPS security.

    ufw allow OpenSSH
    ufw enable
  3. Install git, tmux and Claude Code

    The official installer updates the program in the background on its own. The project's README marks the npm install as deprecated, and Claude Code itself does not use Node.js to run, though your project may of course need it.

    apt install -y git tmux
    su - dev
    curl -fsSL https://claude.ai/install.sh | bash
    claude --version
  4. Sign in or pass a key

    You need a Pro, Max, Team or Enterprise subscription or a Console account. When you sign in over SSH no browser opens: copy the link from the terminal into the browser on your laptop and paste the code back. For scripts, an API key or a long-lived token from claude setup-token is more convenient, stored in a file only your user can read.

    mkdir -p ~/.config && install -m 600 /dev/null ~/.config/claude.env
    nano ~/.config/claude.env      # ANTHROPIC_API_KEY=...
    set -a; . ~/.config/claude.env; set +a
  5. Give access to the one repository it needs

    Do not copy your personal SSH key to the server. Create a separate key and add it in the repository settings as a deploy key: if the server is broken into, only one project is affected.

    ssh-keygen -t ed25519 -f ~/.ssh/repo_deploy -N ""
    cat ~/.ssh/repo_deploy.pub
  6. Run the agent inside tmux

    To leave the session without stopping it, press Ctrl+B, then D. To come back, run tmux attach -t claude, and to continue the last conversation with the agent, claude --continue.

    tmux new -s claude
    cd ~/projects/app && claude
  7. Parallel tasks go into separate worktrees

    Two agents in one folder overwrite each other's files. The --worktree flag creates a separate copy of the repository on its own branch, as the documentation advises; the mechanism is also described in the git manual. Each tmux window gets its own task.

    claude --worktree fix-login        # window 1
    claude --worktree feature-export   # window 2
  8. Save work more often than you take snapshots

    The main copy of the agent's work is what it pushes to a branch. A server snapshot before big changes helps restore the environment, not the code. How a snapshot differs from a backup is covered in the handbook on VPS backups.

    git push -u origin HEAD

4 or 8 GB? If the project builds without Docker and the tests take less than a couple of minutes, start with 4 GB on hourly billing. If the project has docker compose or you want to keep two agents running at once, take 8 GB with NVMe.

Before ordering, look for the word KVM in the plan description: whether Docker works depends on it.

If you need the agent as a build step rather than in a terminal, see how to set up CI/CD on your own server, and read what VPS plans cost in 2026 across the whole catalog. A similar breakdown for a light load is the article on which server to take for a Telegram bot.

Prices are taken from hosts' websites and converted at the Central Bank of Russia rate. The live blocks refresh every hour, so their figures may differ from the text. Medians and plan counts are from the accsly.io catalog as of 17.11.2026. All matching plans are on the VPS for Claude Code page; requirements and commands follow the Claude Code documentation.

Share this piece Telegram

Read next