# Claude Code in the Cloud: Cloud Sessions or a VM

> Run Claude Code in the cloud: Anthropic's cloud sessions or your own VM over SSH. Limits, how each is billed, what persists between runs, which to pick.

- URL: https://flockvm.com/learn/claude-code-in-the-cloud
- Last updated: 2026-11-10

There are two ways to run Claude Code in the cloud. Anthropic's **cloud sessions** run each task in an Anthropic-managed VM that clones your GitHub repository; they come with Pro, Max, Ultra and Team plans at no extra charge, but you get no shell, a VM of about 4 vCPUs and 16 GB, and a machine that pauses when idle and can be reclaimed. **Your own VM over SSH** runs the same `claude` you use locally, on a machine you control: any repository, any tool, a shell, processes that stay up as long as the VM does. You pay for the VM, and you secure it.

| If you… | Pick | Why |
|---|---|---|
| Want to hand off a task on a GitHub repo and check on it from your phone | Cloud sessions | Nothing to set up; included in the plan |
| Need a shell, your own services, or more than 16 GB of RAM | Your own VM | Anthropic's VM has no shell and fixed ceilings |
| Keep a dev server or database running between prompts | Your own VM | An idle cloud VM pauses and can be reclaimed; only files survive that |
| Use GitLab, Bitbucket or another git host | Your own VM | Cloud sessions clone and open pull requests on GitHub only |
| Want GitHub credentials kept out of the agent's machine | Cloud sessions | A proxy holds them; in your own VM, the agent can read what you put there |
| Pay through an API key instead of a plan | Your own VM | Cloud sessions always use your subscription login |

Everything about cloud sessions below comes from Anthropic's documentation, read on 5 November 2026, and only what it states. Plan prices were read on claude.com the same day. Anthropic calls the resource ceilings approximate and says they "may change over time".

## What is a Claude Code cloud session?

In Anthropic's words, "a Claude Code session that runs on cloud infrastructure instead of on your machine". By default it runs on infrastructure Anthropic manages. Each session gets "a fresh virtual machine (VM) running Ubuntu 24.04 on x86_64", with your repository cloned and common toolchains installed: Python, Node.js 20 to 22, Ruby, PHP, Java, Go, Rust, C/C++, Docker, PostgreSQL 16, Redis 7.0 and Chrome for Testing.

The session "keeps running after you close your laptop, and you can check on it or steer it from any device". You start one from:

- the browser, at claude.ai/code ("Claude Code on the web");
- the **Code** tab of the Claude mobile app;
- the Desktop app, by picking a **Cloud** environment;
- the terminal: `claude --cloud "Fix the authentication bug in src/auth/login.ts"`;
- cloud scheduled tasks, each of which runs as a cloud session.

From the terminal, the VM "clones your current directory's GitHub remote at your current branch, not your local checkout, so push first". Each `--cloud` command creates its own session, so three commands run three tasks in parallel. When one is done, `claude --teleport` pulls it into your terminal: it fetches and checks out the session's branch and loads the conversation. It needs a checkout of the same repository with no uncommitted changes (it offers to stash them), a branch pushed to the remote, and the same claude.ai account.

Team and Enterprise organizations can also route cloud sessions to a self-hosted environment, runners on their own infrastructure. That is in public beta and off by default. The rest of this page is about the Anthropic-hosted default.

## What do Claude Code cloud sessions cost?

Nothing on top of your plan. Anthropic: "It counts toward your plan's usage limits alongside the rest of your Claude and Claude Code usage, and there's no separate charge for the cloud VM." Several sessions in parallel consume those limits "proportionately".

| Plan (claude.com, 5 November 2026) | Price | Cloud sessions |
|---|---|---|
| Free | $0 | No (no Claude Code) |
| Pro | $20 a month, or $17 a month billed annually ($200 upfront) | Yes |
| Max | $100 a month | Yes |
| Ultra | $200 a month | Yes |
| Team, standard seat | $25 per seat a month, or $20 billed annually | Yes |
| Team, premium seat | $125 per seat a month, or $100 billed annually | Yes |
| Enterprise | $20 per seat a month billed annually, plus usage at API rates | Premium seats or Chat + Claude Code seats |

Cloud sessions "always use your subscription credentials". An `ANTHROPIC_API_KEY` set in the cloud environment "doesn't override" them, so there is no pay-per-token route through cloud sessions.

On your own VM, the bill has two parts: the VM, and the model. The model part can be the same plan: sign Claude Code in with `/login` inside the VM and its usage counts against the same limits as a cloud session. Or use an API key, billed per token. Either way the difference between the two options is the price of the VM, against what you get for it.

## What are the limits of cloud sessions?

From Anthropic's documentation:

- **Resources**: "approximate resource ceilings that may change over time": 4 vCPUs, 16 GB of RAM, 30 GB of disk. "The VM may stop tasks that need significantly more memory, such as large build jobs or memory-intensive tests."
- **No shell**: "You don't get a shell into the session VM. Claude runs every command for you." Tests, services and installs are things you ask for in the prompt.
- **GitHub only**: "repository cloning in Anthropic-hosted environments and pull request creation require GitHub". A GitLab or Bitbucket repository can be uploaded as a bundle with `CCR_FORCE_BUNDLE=1`, "but the session can't push results back to that remote".
- **Command time limits**: the Bash tool waits 2 minutes for a foreground command by default and up to 10 minutes on request; a command that times out moves to the background and "can keep running for up to 30 more minutes" before it is stopped. `BASH_DEFAULT_TIMEOUT_MS` and `BASH_MAX_TIMEOUT_MS` raise those.
- **Fixed base image**: you add packages with a setup script or run your own image with `docker compose`; "replacing the base image entirely isn't supported yet".
- **IP allowlists**: if your organization restricts Claude access by IP, "every Anthropic-hosted cloud session fails with an authentication error", because sessions call the API from Anthropic's infrastructure. Support can grant an exemption.
- **HIPAA**: under Anthropic's HIPAA configuration, "cloud sessions, Remote Control, Claude Code in the Claude mobile app" and a few other surfaces "aren't covered".

## What persists between cloud sessions?

Less than on a machine of your own, and the docs are precise about it:

- **While you're away**: "after a few minutes without activity, a session's VM pauses with its files saved", and your next message restores the same VM. You can't pause it yourself.
- **After a longer absence**: "a paused VM can later be reclaimed". Reopening the session provisions a fresh VM. Your conversation history is restored; shell commands that were still running, subagents and session-scoped scheduled tasks are not.
- **Between sessions**: a setup script runs on the first session of an environment. If it finishes in "roughly five minutes", Anthropic snapshots the filesystem and starts later sessions from it. "The cache is a filesystem snapshot, so it keeps what the setup script writes to disk and loses anything that was only running": a database or a `docker compose up` stack has to be started again each session. The cache is rebuilt after "roughly seven days". Packages Claude installs mid-session "don't carry over to other sessions".
- **Your work**: it leaves the VM as a branch pushed to GitHub, a pull request, or a teleport to your terminal.

Anthropic stores the session transcript so you can return to it; deleting a session "permanently removes the session and its data".

## What can a cloud session reach on the network?

Each cloud environment has one of four access levels:

| Level | Outbound connections |
|---|---|
| None | No outbound network access through the session's network |
| Trusted (the default) | Allowlisted domains only: package registries, GitHub, cloud SDKs |
| Full | Any domain |
| Custom | Your own allowlist, optionally including the defaults |

Some traffic bypasses the allowlist at every level: GitHub, through its own proxy; MCP connectors you enable, which travel through Anthropic's servers; the hosts of the environment's network secrets; and the Anthropic API, "even at None", which "may allow data to exit the VM". All outbound traffic also goes through a security proxy "for audit logging and abuse prevention".

The part a VM of your own doesn't give you out of the box is credential handling. "Your GitHub credentials stay encrypted on Anthropic's servers and never enter a session's VM": git inside the VM uses a scoped credential that the proxy swaps for your token. The proxy rejects branch deletions and tag pushes, and serves only the repositories attached to the session. Network secrets work the same way, "attached to matching requests after they leave the session". Environment variables, on the other hand, can be read by "anyone who uses the environment".

## The other way: your own VM over SSH

The alternative is the Claude Code you already run locally, on a machine in a datacenter: SSH in, start `claude` in tmux, detach, come back later. [Claude Code on a remote server](/learn/claude-code-remote-server) walks through it: install, sign-in with `/login` in the session (never a token copied from your laptop), tmux and systemd, and headless `claude -p`. You get a shell, your own image, any git host, services that keep running between prompts, and as much RAM as you rent.

The costs are the server bill and the work of securing it. The agent's credentials live on that machine: the Claude login file, a git deploy key, anything in the environment. An agent that runs a bad command or follows a planted instruction can read and send them, so give the VM credentials you can revoke and nothing else. With several agents, give each its own VM rather than sharing one server; [choosing a Claude Code sandbox](/learn/claude-code-sandbox) compares the layers in between.

Anthropic points the same way for workloads past its ceilings: "use Remote Control to run Claude Code on your own hardware". With Remote Control, the session runs on your VM and you steer it from claude.ai/code or the Claude app, as you would a cloud session.

## Cloud sessions vs your own VM

| | Anthropic cloud session | Your own VM over SSH |
|---|---|---|
| Who runs the machine | Anthropic (or your own runners, Team and Enterprise beta) | You or your provider |
| Start a task | claude.ai/code, the apps, `claude --cloud` | `ssh`, then `claude` in tmux, or `claude -p` |
| Shell access | None: Claude runs every command | Full |
| Size | About 4 vCPUs, 16 GB RAM, 30 GB disk | What you rent |
| OS and image | Ubuntu 24.04 x86_64, base image fixed; setup script on top | Any |
| Repositories | GitHub (others as a bundle, no push back) | Any git host |
| Network | Trusted allowlist by default; None, Full or Custom | What you configure |
| Git and API credentials | Held by a proxy outside the VM | Inside the VM, readable by the agent |
| When idle | VM pauses after a few minutes, may be reclaimed | Keeps running, or pauses if your provider supports it |
| What survives | Files after an idle pause; conversation after a reclaim; setup-script snapshot between sessions | Disk until you delete the VM; processes while it runs |
| Billing | Included in Pro, Max, Ultra, Team; counts toward plan usage limits | VM price, plus the model through your plan (`/login`) or an API key |
| Steer from your phone | Yes | Yes, with Remote Control and a subscription login |

## Which should you pick?

**Cloud sessions fit** when the task is self-contained on a GitHub repository, the toolchain fits the preinstalled image plus a short setup script, 16 GB is enough, and you would rather not run a server. They also cost nothing extra if you already pay for a plan, which makes them the first thing to try.

**Your own VM fits** when you need to see and type in the machine; when the agent depends on services that must stay up between prompts (a dev server, a seeded database, a long test run); when the repository isn't on GitHub; when the build needs more than 16 GB; when your organization uses an IP allowlist or a HIPAA configuration; or when you want a specific region or your own network rules.

**Claude Code cloud vs local**, for completeness: local runs on your laptop with your files, tools and credentials, and stops when the lid closes. Cloud sessions and your own VM both keep going without your laptop; they differ in who runs the machine and how much of it you control.

## Where flockvm fits

flockvm is the "your own VM" column without the server work: one Firecracker microVM per agent, in France, on one OVHcloud server, with Claude Code, Codex, tmux, Git, Docker and Playwright preinstalled on the default Agent image. You SSH in as a non-root `user`, sign Claude Code in with `/login` or an API key, and run it in tmux. From your laptop:

```bash
flockvm vm create claude-api-fix --size default --wait
flockvm vm ssh claude-api-fix
```

Compared with the table above:

- **Size**: `small` (2 vCPU, 4 GB) at $0.016 an hour, `default` (4 vCPU, 8 GB) at $0.032, `large` (8 vCPU, 16 GB) at $0.064, `xlarge` (16 vCPU, 32 GB) at $0.18, billed per second while the VM runs. The plan is $18 a month and comes back as $18 of VM time, with a [7-day free trial](/pricing): card required, nothing charged for 7 days, cancel anytime.
- **When idle**: you pause the VM yourself. Pause writes its memory to disk, so the dev server, the database and the tmux session are still running after a resume; paused VMs are not billed.
- **Network**: inbound SSH only; outbound open to any public IPv4 address except SMTP port 25, no IPv6.
- **Credentials**: inside the VM. flockvm has no egress allowlist and no secrets proxy today, so on that row cloud sessions do more.

[Run Claude Code in a VM](/docs/agents/claude-code) is the step-by-step guide; [running Claude Code agents in parallel](/learn/run-claude-code-agents-in-parallel) covers several at once.

### When flockvm is the wrong pick

- **Your tasks fit a cloud session**: a GitHub repo, a stock toolchain, 16 GB, no services to keep warm. It's included in a plan you may already pay for.
- **You want credentials kept outside the agent's VM**: cloud sessions' GitHub proxy and network secrets do that; flockvm doesn't yet.
- **More than 15 agents at once**: the host in France runs at most 15 small VMs at once today, across all customers (2 during the trial).
- **One agent all day, every day**: a monthly VPS usually costs less; see [Claude Code on a VPS or a microVM](/learn/claude-code-vps-vs-microvm).
- **A region outside Europe**: France is the only region today.

## FAQ

### Is Claude Code in the cloud free?

Not on the Free plan, which has no Claude Code. On Pro, Max, Ultra and Team, cloud sessions cost nothing beyond the plan, but they draw on its usage limits.

### Can I use an API key with cloud sessions?

No. Cloud sessions always use your claude.ai subscription credentials, even if `ANTHROPIC_API_KEY` is set in the environment. To pay per token, run Claude Code on your own machine or VM with the key.

### Do cloud sessions keep running when I close my laptop?

Yes. The session runs on Anthropic's VM, and you can check on it from the browser or the Claude app. If it sits idle for a few minutes, the VM pauses; your next message restores it, unless it has been reclaimed, in which case you get a fresh VM with the conversation restored.

### Can I SSH into a Claude Code cloud session?

No. Anthropic's docs: "You don't get a shell into the session VM." You can pull the session into your terminal with `claude --teleport`, which checks out its branch locally.

### How big is the cloud VM?

About 4 vCPUs, 16 GB of RAM and 30 GB of disk, approximate and subject to change.

### What's the difference between cloud sessions and Remote Control?

A cloud session runs on Anthropic's VM. Remote Control runs on your machine, laptop or VM, and lets you steer that local session from claude.ai/code or the Claude app; "your computer has to stay on and the `claude` process has to keep running". Remote Control needs a subscription login; API keys are not supported.

## Sources

- [Anthropic, Claude Code docs: Use Claude Code in the cloud (plans, surfaces, --cloud, --teleport, security, expiry, limitations)](https://code.claude.com/docs/en/claude-code-on-the-web) (accessed 2026-11-05)
- [Anthropic, Claude Code docs: Configure cloud environments (network access, GitHub proxy, installed tools, resource and time limits, setup scripts, caching)](https://code.claude.com/docs/en/cloud-environments) (accessed 2026-11-05)
- [Anthropic, Claude Code docs: Self-hosted environments (public beta, Team and Enterprise)](https://code.claude.com/docs/en/self-hosted-environments) (accessed 2026-11-05)
- [Anthropic, Claude Code docs: Authentication (cloud sessions always use subscription credentials)](https://code.claude.com/docs/en/authentication) (accessed 2026-11-05)
- [Anthropic, Claude Code docs: Data usage (cloud execution data flow)](https://code.claude.com/docs/en/data-usage) (accessed 2026-11-05)
- [Anthropic, Claude Code docs: Legal and compliance (HIPAA configuration exclusions)](https://code.claude.com/docs/en/legal-and-compliance) (accessed 2026-11-05)
- [Anthropic, Claude Code docs: Remote Control](https://code.claude.com/docs/en/remote-control) (accessed 2026-11-05)
- [Claude: Plans and pricing (Pro, Max, Ultra, Team)](https://claude.com/pricing) (accessed 2026-11-05)
