Hivra
Most agents need a smaller server and a bigger firewall than the listicles tell you.

AI agent VPS guide: specs, providers, and setup that actually works (2026)

Most AI agents are API orchestrators that idle on 1 vCPU and 2GB of RAM. Sizing the server is the easy bit. Keeping a machine that holds your API keys and logins safe on the public internet is the hard part.

Short answer

Most AI agents only call a model over an API, so 2 vCPU, 4GB of RAM and 40GB of SSD is the comfortable spec. Hetzner runs roughly a quarter to a third of what DigitalOcean, Vultr or Linode charge for that size. Bind the agent to localhost, reach it over Tailscale or an SSH tunnel, and harden SSH first.

What an AI agent actually needs from a server

One split decides everything else. Agent workloads come in two kinds, and they need very different hardware:

  • API-orchestrator agents. Claude Code, Codex, Hermes, OpenClaw, and most agent frameworks. The model runs in Anthropic's or OpenAI's datacenter. Your server runs a loop: send context, receive a tool call, execute it, repeat. That loop is cheap. 1 vCPU and 1-2GB of RAM covers many agent processes, though Anthropic lists 4GB for Claude Code.
  • Local-model agents. You run the weights on your own hardware with Ollama or similar. Now RAM is what matters. A quantized 8B model wants 8GB+ just for weights and context. A 70B model wants 48GB+ and serious cores, and CPU inference is still slow. GPU boxes that do this well run $200-500/month.

Almost everyone reading this is in the first group, and the spec worth buying sits a step above the bare minimum. Size the server for what the agent does:

  • Terminal-only agent, external API: 1 vCPU, 2GB RAM, 20GB disk. Works, but swapping starts fast if anything else runs.
  • Comfortable single agent: 2 vCPU, 4GB RAM, 40GB SSD. Room for Docker, a gateway process, and log growth. This is the spec to actually buy.
  • Agent + browser automation: 4GB minimum, 8GB comfortable. A headless Chrome instance is heavier than the agent driving it, and an uncapped Chrome will eat every gigabyte you give it.
  • Local models: 8GB+ for small models, and check the token speed you'll actually get before you commit.

Disk fills slower than you fear but faster than zero. Session databases, JSONL logs, and files the agent downloads all accumulate. 40GB buys years for a single agent. 20GB buys months if browser downloads are involved.

Provider comparison: Hetzner, DigitalOcean, Vultr, Linode

For the 2 vCPU / 4GB class that most agents want, here's where prices sat in September 2026:

ProviderPlanvCPURAMSSDPrice/mo
HetznerCX2324 GB40 GB€5.49
HetznerCX3348 GB80 GB€8.49
VultrRegular Cloud Compute24 GB80 GB$20
LinodeShared 4GB24 GB80 GB$24
DigitalOceanBasic24 GB80 GB$24

Hetzner prices are for its Germany and Finland locations, excluding VAT, after its 15 June 2026 price change. Prices move, so check before you buy. The gap stays put, though: Hetzner costs roughly a quarter to a third of the US-brand trio for the same agent workload.

What the price gap does and doesn't buy:

  • Hetzner is the community default for agent hosting for a reason. The catch list is short but real: its cheapest shared plans are priced for its EU datacenters, signup verification is stricter, and its support culture assumes you know Linux.
  • DigitalOcean has the best documentation and tutorials in the business. If this is your first server, that's worth something, though not nearly four times the price forever.
  • Vultr has the widest location spread, useful if you need the box near a specific region. Pricing is otherwise DigitalOcean-shaped.
  • Linode (Akamai) is solid and boring in the good sense. Long-running boxes, predictable network. Same pricing problem as the other US brands.

For a personal agent where a few hours of downtime is annoying rather than fatal, take the Hetzner CX23 or CX33 and spend the savings on your API budget. To compare the full monthly picture including API costs, run your numbers through the AI agent hosting cost calculator.

Security: the section the listicles skip

An agent VPS is not a normal VPS. A normal server holds your app. An agent server holds credentials that act as you: API keys, OAuth sessions, shell access, sometimes a logged-in browser. Treat it like a machine that can spend your money, because it is one.

Rule 1: no public ports beyond SSH. The agent's web UI, gateway, and any dashboard should listen on localhost only. Don't bind them to 0.0.0.0 and rely on an obscure port number. Internet-wide scanners find every open port on every IPv4 address in hours, not weeks.

Rule 2: reach the box over a private network, not the open internet. Tailscale is the easy version: install it on the VPS and your laptop, and the agent UI is reachable at a private 100.x address that only your devices can see.

bash
# On the VPS curl -fsSL https://tailscale.com/install.sh | sh tailscale up # Then bind the agent UI to the tailnet address or localhost # and close the public firewall down to SSH only ufw default deny incoming ufw allow OpenSSH ufw enable

An SSH tunnel (ssh -L 8080:localhost:8080 user@vps) does the same job with zero new software if you only ever connect from one machine.

Rule 3: API-key hygiene. Keys live in the environment or a root-owned env file with chmod 600, never in the agent's working directory where a tool call can read or commit them. Use a separate key per box so you can revoke one machine without rotating everything. Set spend limits on the provider side, so a runaway loop hits a $25 cap before it gets near your card limit.

Rule 4: know the OAuth-on-a-VPS ToS trap. Claude Code and Codex both support signing in with your consumer subscription instead of an API key. Those subscriptions are personal logins, and putting a personal OAuth session on shared or third-party-managed infrastructure can sit badly with provider terms, which generally prohibit sharing account access. A VPS that only you control and only you access is the defensible setup: one person, one login, one machine. Don't park a shared team login on a box five people SSH into. If the account matters to you, read the current terms yourself before deciding.

Rule 5: contain the agent itself. The agent executes code and shell commands as part of normal operation. Run it as a non-root user, and prefer the Docker install where the agent offers one, so a bad tool call trashes a container instead of the host. It's also a strong argument for one agent per machine: a hardware boundary beats hoping nothing goes wrong. Before you run Claude Code's skip-permissions flag on that VPS, read what the flag skips. Whatever you sign in to on the server stays within the agent's reach.

Setup checklist: from fresh box to durable agent

The order matters. Harden first, install second.

bash
# 1. First login: update, create a user, lock down SSH apt update && apt upgrade -y adduser agent && usermod -aG sudo agent # copy your key, then in /etc/ssh/sshd_config: # PasswordAuthentication no, PermitRootLogin no systemctl restart ssh # 2. Firewall before anything listens ufw default deny incoming && ufw allow OpenSSH && ufw enable # 3. Docker for agents that ship an image curl -fsSL https://get.docker.com | sh usermod -aG docker agent # 4. Unattended security updates apt install -y unattended-upgrades dpkg-reconfigure -plow unattended-upgrades

Then make the agent survive reboots. A tmux session dies with the machine, but a systemd unit comes back on its own:

bash
# /etc/systemd/system/agent.service [Unit] Description=AI agent After=network-online.target [Service] User=agent EnvironmentFile=/etc/agent/env ExecStart=/usr/local/bin/your-agent-command Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target
bash
systemctl enable --now agent

Finally, backups. The irreplaceable part of an agent box is small: config, memory files, session database. A nightly restic or rsync job to storage that lives somewhere else takes ten minutes to set up. The VPS provider's disk is not a backup. A deleted server takes its disk with it.

Per-agent notes: Claude Code, Codex, Hermes, OpenClaw

Claude Code installs with Anthropic's native installer (curl -fsSL https://claude.ai/install.sh | bash), or with npm install -g @anthropic-ai/claude-code on Node.js 22 or later. It is interactive, so on a raw VPS you run it inside tmux and reattach over SSH. The headless mode (claude -p "...") suits cron-driven jobs. Anthropic's system requirements list 4GB of RAM, so add headroom if the agent will drive a browser. Details on the Claude Code agent page.

Codex follows a similar shape: Node.js, npm install -g @openai/codex, sign in with your ChatGPT login (codex login --device-auth on a headless box), run in tmux. Before you rent a server for it, check whether OpenAI's own cloud already does the job. If your ChatGPT plan lists Codex cloud and the work is one self-contained change to a GitHub repo, try OpenAI's cloud first: OpenAI's pricing page says local messages and cloud chats share one allowance. When Codex cloud is enough has the rest. See the Codex agent page.

Hermes is a full agent platform rather than a coding CLI: gateway, memory system, Telegram and Discord connections, scheduled tasks. It wants the 2 vCPU / 4GB spec as a working minimum and 40GB of disk for state growth. The self-hosting guide covers the install end to end, and the VPS comparison for Hermes goes deep on provider specifics.

OpenClaw runs as a long-lived gateway process, and its default posture assumes a trusted network. So the no-public-ports rule is a must here: loopback binding plus Tailscale, exactly as above. The OpenClaw self-hosting walkthrough covers it step by step. Browser automation is core to OpenClaw workflows, so budget 8GB RAM, not 4GB.

All four, plus Aeon and Agent Zero, are also launchable as managed agents on Hivra.

When managed beats a raw VPS

The DIY route above works. Counted properly, it costs $5-10/month in server rent, 1-3 hours of setup, and a slow drip of maintenance: OS patches, agent updates, disk cleanup, and the occasional evening lost to a gateway that stopped restarting. If you enjoy that work, nothing here needs improving. (And if you're still deciding whether a VPS is even the right shape, the AI agent hosting guide compares all four options: own hardware, VPS, serverless, and managed.)

Hivra is the version where most of the checklist above is someone else's job. Each agent runs on its own private VM, and Claude Code and Codex are the vendors' official CLIs. Claude Code uses your own Anthropic login and Codex uses your own ChatGPT login, so usage bills through those accounts with no Hivra markup. Hivra is independent and is not affiliated with Anthropic or OpenAI. You get a browser view of the running session instead of a bare SSH terminal.

The plan math: the $9.99/month plan is 2 vCPU and 4 GB of RAM, and the $19.99/month plan is 4 vCPU and 8 GB of RAM, shared across the agents you run. Paid plans are not paused for inactivity, and they come with a 7-day money-back guarantee on card payments. Hermes, Claude Code, Codex, Aeon, OpenClaw, and Agent Zero all launch on Hivra. OpenClaw and Agent Zero need a paid plan. Full details on the pricing page.

A reasonable decision rule: if you were going to buy one Hetzner box for one agent and follow this guide carefully, the DIY route saves a few dollars and teaches you things. If you want several agents, want them reachable from your phone, or don't want to own the security section personally, managed is cheaper than your time. If you're not sure your usage justifies always-on hosting at all, the agent survival check is a two-minute sanity test.

Common questions

What VPS specs do I need to run an AI agent?

For agents that call external APIs (Claude Code, Codex, Hermes, OpenClaw), 2 vCPU, 4GB RAM, and 40GB SSD is the comfortable spec. The working minimum for many agents is 1 vCPU and 2GB RAM, though Anthropic lists 4GB for Claude Code. Add up to 8GB RAM if the agent drives a headless browser. Running local models is a different category: 8GB+ for small models, 48GB+ and many cores for 70B-class models.

What is the cheapest VPS that can run an AI agent well?

Hetzner's CX23 (2 vCPU, 4GB RAM, 40GB NVMe) at €5.49/month excluding VAT is the community standard. Equivalent plans at DigitalOcean, Vultr, or Linode run $20-24/month. The premium buys better docs and more locations, not better agent performance.

Is it safe to put my API keys on a VPS?

Yes, with basic discipline: keys in a root-owned environment file with restricted permissions, one key per machine so it can be revoked alone, spend limits set on the provider side, and no agent web UI exposed on a public port. Reach the box over Tailscale or an SSH tunnel instead of the open internet.

Can I use my Claude or ChatGPT subscription login on a VPS?

Claude Code and Codex both support subscription sign-in instead of API keys, and it works on a remote machine. Keep it defensible: one person, one login, one box you control. Sharing a personal login across a team or on shared infrastructure is where provider terms get uncomfortable. Read the current terms if the account matters to you.

Should my agent run in Docker or directly on the VPS?

Prefer Docker when the agent ships an image. Agents execute shell commands as part of normal work, so a container limits the damage a bad tool call can do and makes memory caps (--memory=4g) easy. Interactive CLIs like Claude Code more commonly run directly, inside tmux, as a non-root user.

How is managed agent hosting different from renting my own VPS?

Same underlying idea, different owner of the work. On your own VPS you handle hardening, updates, restarts and backups, and the server costs $5-10/month. On Hivra each agent gets a private VM with the official CLI for that agent, a browser interface, and no Hivra markup when you sign in with your own accounts. Hivra is independent and is not affiliated with Anthropic or OpenAI. Plans start at $9.99/month for 2 vCPU and 4 GB of RAM.

Give your agent a computer that stays on.

From $9.99/mo. Bring your own AI key. 7-day money-back guarantee on card payments.

Start Now