Best VPS for Claude Code: Costs, Specs and Runtime Choices

Choose a Claude Code runtime with verified prices, explicit storage limits, and a test plan for builds, isolation, and recovery.

•

Published on

•

Do not index
The best VPS for Claude Code depends on whether you need a general-purpose Linux VM, Docker support, or a small hosted environment for the CLI. Agent37 is worth testing for the last two: its standard 2 vCPU, 4 GB RAM sandbox with 4 GB disk costs $4.76 for 730 running hours; a full VM with the same resources costs $11.36. For a conventional VPS with substantially more bundled disk, Vultr's $20 plan and DigitalOcean's $24 Basic Droplet are straightforward options.
Those are infrastructure prices. Your Claude subscription or model usage remains separate, and equal RAM does not mean equal CPU performance or storage. Below, we compare the actual shapes, explain the operating work each path leaves you, and give you a practical acceptance test before you commit.
We run Agent37. These are recommendations based on published specifications and prices checked October 20, 2026, not benchmark results or a claim that one provider wins every workload.
Conceptual Agent37 billing states: CPU and RAM stop billing when stopped; retained disk still bills.
Conceptual Agent37 billing states: CPU and RAM stop billing when stopped; retained disk still bills.

The best VPS for Claude Code: a practical shortlist

Start with the resource bundle you can actually buy. The table deliberately separates the two Agent37 runtimes and shows storage beside compute.
Option
CPU / RAM / disk
Infrastructure price
Best reason to consider it
Agent37 standard gVisor
2 vCPU / 4 GB / 4 GB
$4.76 per 730 running hours
Small CLI workspaces, low infrastructure cost
Agent37 full VM
2 vCPU / 4 GB / 4 GB
$11.36 per 730 running hours
Docker or software needing its own Linux kernel
Vultr Regular Cloud Compute
2 vCPU / 4 GB / 80 GB SSD
$20/month base rate
Conventional VPS with more bundled disk
DigitalOcean Basic, Regular CPU
2 vCPU / 4 GiB / 80 GiB SSD
$24/month cap
Existing DigitalOcean workflow and tools
Hostinger KVM 1
1 vCPU / 4 GB / 50 GB NVMe
$6.49/month advertised; $11.99 renewal
Upfront-term VPS purchase with bundled weekly backups
Agent37's figures assume compute runs for all 730 hours and the listed disk is retained throughout. Vultr's catalog lists a higher price in São Paulo. Hostinger requires upfront payment for the selected term; its monthly headline is the total divided by the term. Check the final region, taxes, renewal total, transfer allowance, and optional backups before ordering. None of these rows includes Claude usage.
My starting recommendation: test Agent37 standard for a compact repo and ordinary CLI tools; choose a full VM when the project needs Docker. Choose a conventional VPS if its larger disk, OS management, region, or existing cloud integration makes the whole deployment easier.

Size the project, not just the Claude process

Anthropic lists 4 GB or more RAM, an x64 or ARM64 processor, and internet access among Claude Code's requirements. Supported Linux choices include Ubuntu 20.04+, Debian 10+, and Alpine 3.19+. The native installer avoids a separate Node.js installation for Claude Code itself.
Your project can still require Node.js, Python, Java, browsers, or a database. Budget for everything Claude will launch. A successful CLI startup tells you little about a production build's memory peak.
Use 2 vCPU and 4 GB RAM as a starting test configuration for modest work. Move up when measurement shows memory pressure, slow builds, or competing sessions. A browser test runner and a compiler can need considerably more headroom than a single shell waiting for a model response. This is sizing advice, not a guarantee for every repository.
Disk deserves the same attention. Count the checkout, dependencies, build caches, downloaded browsers, logs, and any container images. A 4 GB persistent disk can fit a small workspace but is not equivalent to the 80 GB bundled with the VPS rows above. Agent37's 2 vCPU/4 GB shape permits 2–12 GB disk; larger storage requirements can require a different shape or provider. Check the current resource limits before choosing.
Do not buy a GPU merely to call a hosted Claude model. Buy local acceleration only if a separate tool in your workflow actually needs it.

Choose the isolation boundary before the provider

A VPS gives you a machine to operate. It does not automatically restrict what a coding agent can read, change, or send from that machine. Keep production credentials and unrelated customer data outside the environment where you let an agent work.
Claude Code's built-in shell sandbox is a separate layer. It is off by default and restricts shell commands when enabled; file tools and hooks run outside that boundary. Putting the entire Claude Code process inside a container or VM provides a broader outer boundary. Permissions, network policy, and the secrets you expose still matter.
On Agent37, standard gVisor sandboxes share host resources and cannot run a Docker daemon. Full VMs have their own Linux kernel and support Docker and Compose. VM compute costs 2.5 times standard compute; disk uses the same rate. The VM reference also documents a practical difference from a conventional VPS: the entrypoint runs as PID 1, without a systemd init system.
For example, a repo that runs tests directly with Python can be a good standard-sandbox candidate. A repo that starts Postgres through Docker Compose needs the VM path. Do not discover that distinction after copying your entire workspace.
Our Claude Code sandbox guide covers the layers in more detail. For container setup, Anthropic's development-container guidance also warns that credentials accessible inside the container can still be exposed by malicious code. Isolation helps limit damage; it does not make every repository trustworthy.

When the other VPS options make sense

Hetzner: consider it when its available region and machine fit your requirements. The public cloud page currently labels the Cost-Optimized line unavailable. Confirm the exact machine in the console before budgeting around a cheap CX price from an older comparison. Hetzner cloud options.
Contabo: compare its current Core, Performance, and Storage VPS families if RAM or disk capacity dominates your shopping list. Its documentation distinguishes shared vCPU plans from dedicated-core products. Use the current regional checkout instead of an old plan name or promotional euro price. Contabo VPS documentation.
Oracle Always Free: its A1 allowance is currently 1,500 OCPU-hours and 9,000 GB-hours per month, equivalent to 2 OCPUs and 12 GB memory for Always Free tenancies. Capacity can be unavailable, and Oracle documents reclamation of idle instances. That can suit an experiment whose files you back up elsewhere; it is a poor dependency for a deadline you cannot miss. Oracle's free-resource conditions.
AWS or a Mac host: keep existing network and identity requirements in the decision. If your company already operates the workload inside an AWS VPC, fitting that environment can matter more than a small hosting discount. If the build requires Xcode, choose a supported Mac environment; a Linux VPS does not remove that dependency.
For short jobs, also compare sandbox APIs with persistence and session limits matched to your workload. Do not assume that every sandbox is disposable or that every provider supports an uninterrupted month-long session. Our sandbox cost comparison explains why aggregate runtime and session length are different inputs.

Calculate running time, retained disk, and model spend separately

A useful monthly estimate has four lines: compute, retained storage, model/tool usage, and operational extras. Backups, transfer, taxes, plan fees, and your own administration time can change the result.
Agent37's standard monthly-equivalent compute rate for 2 vCPU and 4 GB is (2 × $0.80) + (4 × $0.70) = $4.40. Four GB of retained disk adds $0.36 for 730 hours. The VM calculation multiplies compute by 2.5, giving $11.00 compute plus $0.36 disk.
These worked examples use the same 4 GB disk, retained for the full 730-hour period:
Usage assumption
Standard gVisor
Full VM
730 running hours
$4.76
$11.36
60 running hours, stopped or sleeping otherwise
About $0.72
About $1.26
Stopped throughout, disk retained
$0.36
$0.36
The 60-hour line is our calculation: monthly-equivalent compute multiplied by 60 / 730, plus the full month's disk. It excludes models and tools. An awake but idle instance still bills compute. Enable auto-sleep or explicitly stop it to reach the lower-runtime scenario; deleting the instance ends its meter. See the billing rules.
That is also why the pricing calculator's roughly $0.37 example is not an always-on monthly bill. It assumes about 57 running hours and deletion afterward. Keeping the disk for the rest of the month produces a different total.
For a practical VM starting point, agent37-ubuntu defaults to 12 GB disk, making its 2 vCPU/4 GB estimate $12.08 for 730 running hours. The $11.36 table example explicitly selects 4 GB. Choose enough disk for your software, rather than forcing the smallest quoted figure.
Your Claude allowance remains independent of these numbers. A smaller infrastructure bill does not increase subscription limits, and leaving a machine awake does not purchase more model capacity. Estimate an API-backed workflow from measured token use and the model's current rates; do not turn a hosting quote into a claim about total agent cost.

Install and authenticate without confusing the two bills

On a conventional VPS, use a supported Linux image, a non-root working account, SSH keys, and a firewall suited to the services you intend to expose. Keep recovery access working before tightening login rules. Then install Claude Code through Anthropic's current native installer and install the project's own dependencies.
Anthropic's authentication guide supports Claude-account login and Console/API routes. In an SSH session, open the displayed login URL in your browser and paste the returned code into the terminal when prompted. An API credential can use a different billing path from your subscription, so confirm which account is active before a long run.
For Agent37, the `agent37-claude-code` template already contains the CLI. Create it through the dashboard or instance API, then connect your own account with claude auth login, a CLAUDE_CODE_OAUTH_TOKEN obtained through claude setup-token, or ANTHROPIC_API_KEY. This template does not include a browser or desktop, and Agent37 does not supply Claude model usage for it.
If you only want an individual hosted agent, personal plans are a separate product and price schedule. They are not the sandbox API rates used in this comparison.

Test the failure cases before committing

Run the same small task on your shortlisted environment: clone the repository, install dependencies, run tests, and complete one representative build. Record peak memory, disk growth, elapsed time, and actual hosting usage. Avoid comparing one provider's empty shell with another's full browser workload.
Next, test recovery. A terminal multiplexer such as tmux can keep a shell alive across an SSH disconnect, but it cannot keep a process running through a reboot. Commit work frequently and verify that your files survive the provider's stop/start cycle. Save durable state on the persistent volume and test a backup restore before relying on it.
For multiple clients, separate workspaces and credentials from the start. An API can simplify provisioning, but you still need access controls, spending limits, review of generated changes, and a recovery plan. Do not put every client's secrets in one shared agent home directory.
Choose the environment that passes those checks at an acceptable total cost. A larger VPS can be the better value when you need its disk or OS behavior. A small metered sandbox can win when your agent mostly waits on model calls and you can stop compute between jobs.

Frequently asked questions

Can I run Claude Code on a $5 VPS?

Check the RAM and project footprint first. A cheap plan with 1 GB memory is below Anthropic's listed 4 GB requirement. Agent37's $4.76 example provides 4 GB RAM, but only 4 GB disk, and describes standard gVisor compute for 730 running hours. It is not a full VM or an all-inclusive Claude plan.

Do I need Docker?

No, the CLI can run directly on supported Linux. Docker is useful when the project depends on containers or you want a repeatable development environment. On Agent37, running a Docker daemon requires a full VM.

Does hosting include unlimited Claude usage?

No. Connect the account or API billing route appropriate to your workload and check its current limits. Provisioning more servers does not multiply a single subscription's allowance.

What should I try first?

For a small CLI workspace, create an Agent37 sandbox and run the acceptance test above. Start with the Claude Code template instructions; choose the VM path if Docker is a requirement. Check the current pricing against your actual disk and running hours before scaling.
Vishnu

Written by

Vishnu

Founder at Agent37, which runs managed hosting for OpenClaw and Hermes agents for 1,000+ users. Writes about what actually breaks when you leave an AI agent running.