Persistent VMs are now available.Learn more

Cloudflare Sandbox Pricing Explained: Real-World Costs

Engineering
Eli Mernit11 min read
Cloudflare Sandbox Pricing Explained: Real-World Costs

Cloudflare Sandbox has no price list of its own. A sandbox is a Cloudflare Container started by a Durable Object, so it bills at the Containers rates: $0.072 per vCPU-hour of CPU the code uses, $0.009 per GiB-hour of provisioned memory and $0.000252 per GB-hour of disk, on top of the $5 a month Workers Paid plan. A 2 vCPU, 8 GiB sandbox costs between $0.076 and $0.22 an hour, depending on how busy its CPU is.

Cloudflare Sandbox pricing at a glance

A Cloudflare Sandbox bill has up to six meters. Three come from the container: CPU, memory and disk. The others come from the Worker that receives requests, the Durable Object that owns each sandbox, and network egress. Sandboxes need the Workers Paid plan, which has a $5 monthly minimum for the account and includes some usage of every meter.

MeterIncluded with Workers Paid each monthRate after that
Container CPU, active use only375 vCPU-minutes$0.000020 per vCPU-second ($0.072 an hour)
Container memory, provisioned25 GiB-hours$0.0000025 per GiB-second ($0.009 an hour)
Container disk, provisioned200 GB-hours$0.00000007 per GB-second ($0.000252 an hour)
Durable Object duration400,000 GB-seconds$12.50 per million GB-seconds
Durable Object requests1 million$0.15 per million
Worker requests10 million$0.30 per million
Worker CPU time30 million CPU-milliseconds$0.02 per million CPU-milliseconds
Egress, North America and Europe1 TB$0.025 per GB

Containers bill in 10 ms steps while an instance runs. Memory and disk are charged for the size of the instance type you chose, and CPU is charged only for the CPU time the code used. Egress is $0.05 per GB from Oceania, Korea and Taiwan and $0.04 per GB everywhere else, each with 500 GB included.

The older Sandbox SDK 0.x, the Sandbox class in @cloudflare/sandbox, bills the same way: its pricing page points to the Containers rates.

Cloudflare Containers pricing per hour by instance type

The hourly cost of a sandbox depends on its instance type, because the type fixes the memory and disk you pay for and caps the CPU you can use. There are six predefined types. The table multiplies each one by the per-second rates, before the included usage is taken off.

Instance typevCPUMemoryDiskIdle hour: memory and disk onlyHour with every vCPU busy
lite1/16256 MiB2 GB$0.0028$0.0073
basic1/41 GiB4 GB$0.0100$0.0280
standard-11/24 GiB8 GB$0.0380$0.0740
standard-216 GiB12 GB$0.0570$0.1290
standard-328 GiB16 GB$0.0760$0.2200
standard-4412 GiB20 GB$0.1130$0.4010

For standard-3, the idle figure is 8 GiB × $0.009 plus 16 GB × $0.000252, and the busy figure adds 2 vCPUs × $0.072. A sandbox that spends its session waiting on a model or a network call bills close to the idle column.

The types are heavy on memory: one vCPU comes with 6 GiB, and two come with 8 GiB. A custom instance type sets vCPU, memory and disk separately, with minimums of 1/16 vCPU, 256 MiB and 2 GB. The default ceiling for one instance is 4 vCPUs, 12 GiB of memory and 20 GB of disk, and Cloudflare raises account limits on request. The instance types list CPU, memory and disk only; there is no GPU option.

What the Workers Paid plan includes for sandboxes

The $5 Workers Paid plan covers a small amount of sandbox time each month, and the memory allowance runs out first. 25 GiB-hours is 25 hours of a basic instance or a little over 3 hours of a standard-3. The 375 vCPU-minutes are 6.25 hours of one fully busy vCPU. The 200 GB-hours of disk are 50 hours of a basic instance's 4 GB.

The allowances belong to the account, not to each sandbox, and other Containers on the account draw from the same pool. Sandboxes are not available on the Workers Free plan.

Does Cloudflare charge for an idle sandbox?

Yes, for memory and disk. While an instance runs, Containers bill its provisioned memory and disk whether or not anything inside it does work, and only the CPU charge falls to zero. Once the instance stops, nothing is billed for it.

What decides the bill is how long the instance stays up after the last request:

  • Inactivity timeout. After the Durable Object goes inactive, the instance keeps running for the time you set with setInactivityTimeout(), up to 6 hours. Without a timeout, Cloudflare stops the instance shortly after.
  • Work inside the sandbox doesn't count as activity. A build or an agent task that runs with no requests arriving is stopped when the timeout ends. A Durable Object alarm that fires more often than the timeout keeps the instance up until the work is done.
  • A stop clears memory and disk. The next start creates a new instance from the image or from a snapshot.
  • Snapshots save files, not processes. A snapshot holds the writable root filesystem, up to 20 GB, and expires 30 days after it was created or last restored. Snapshots are in public beta and free for now; Cloudflare says it will publish a price when they reach general availability.

So a coding agent that waits an hour between instructions has two options. A timeout longer than the wait keeps its dev server alive and bills the instance's memory and disk for that hour: $0.076 on a standard-3. A short timeout stops the instance, and a snapshot brings the files back on the next request, without the running processes. Our guide to what a microVM is covers why a memory pause is a different feature from a filesystem snapshot.

Durable Objects, Workers requests and egress charges

For most sandbox workloads these three meters stay inside what the plan includes, but they are on the bill and one of them rounds up.

Durable Object duration. Each sandbox is a Durable Object, and a Durable Object bills wall-clock time at 128 MB while it is active: handling a request, running an alarm, streaming a response or holding an open WebSocket it accepted. One active hour is 460.8 GB-seconds, so the included 400,000 GB-seconds cover about 868 active hours a month across the account. Past that the rate is $12.50 per million GB-seconds, and Cloudflare rounds billable usage up to the next million. A browser terminal that holds a WebSocket open keeps both the Durable Object and the instance billing, even when nobody types.

Requests. Each inbound request to the Worker counts toward 10 million included requests, and each call from the Worker to the Durable Object counts toward 1 million included Durable Object requests. An alarm that fires every minute to keep one sandbox alive is 43,200 Durable Object requests in a 30-day month.

Egress. Data a sandbox sends out is $0.025 per GB in North America and Europe after 1 TB a month. Container logs go to Workers Logs and bill at its rate when observability is on.

Dynamic Workers pricing for JavaScript-only sandboxes

Cloudflare's second sandbox environment, Dynamic Workers, has no container and no per-hour charge. It loads generated JavaScript, Python or WebAssembly as a new Worker and bills three things: unique Dynamic Workers created per day, requests and CPU time.

MeterIncluded each monthRate after that
Dynamic Workers created1,000 unique Dynamic Workers$0.002 per Dynamic Worker per day
Requests10 million, shared with Workers$0.30 per million
CPU time30 million CPU-milliseconds, shared with Workers$0.02 per million CPU-milliseconds

A Dynamic Worker is identified by its ID and its code, and loading code without an ID counts as a new one on every invocation. An app that runs 100,000 different generated snippets in a month, once each, pays for 99,000 creations: 99,000 × $0.002 is $198, plus the $5 plan. The same snippet called again under a stable ID is counted once a day.

Dynamic Workers can't start child processes or load native add-ons, so anything that needs pip install, a shell or a test runner goes to a Container.

What a Cloudflare Sandbox costs per month: three worked bills

These three bills use the rates above, take the included usage off first, and assume nothing else on the account uses the allowances. Each one includes the $5 plan.

WorkloadInputsMonthly cost
Code interpreter10,000 sessions of 2 minutes on basic (1/4 vCPU, 1 GiB, 4 GB), CPU busy throughout: 333 instance-hours$13.61
Coding agent workspaceOne standard-3 (2 vCPU, 8 GiB, 16 GB) for 176 hours, averaging 0.3 vCPU$21.46
Always-on small agentOne standard-1 (1/2 vCPU, 4 GiB, 8 GB) for 720 hours, averaging 0.025 vCPU$32.94

Code interpreter: $13.61. Memory is 333.3 GiB-hours less 25 included, at $0.009: $2.78. Disk is 1,333 GB-hours less 200, at $0.000252: $0.29. CPU is 83.3 vCPU-hours less 6.25, at $0.072: $5.55. Durable Object duration is at most 153,600 GB-seconds, inside the included amount.

Coding agent workspace: $21.46. 176 hours is 8 hours a day for 22 working days. Memory is 1,408 GiB-hours less 25: $12.45. Disk is 2,816 GB-hours less 200: $0.66. CPU is 52.8 vCPU-hours less 6.25: $3.35. Memory is more than half of the bill, and it is charged for every hour the instance is up.

Always-on small agent: $32.94. Memory is 2,880 GiB-hours less 25: $25.70. Disk is 5,760 GB-hours less 200: $1.40. CPU is 18 vCPU-hours less 6.25: $0.85. This one needs an alarm to hold the instance past the 6-hour timeout ceiling, and Cloudflare doesn't guarantee that an instance runs for a set time, so the agent has to tolerate a restart from its image or a snapshot.

Cloudflare Sandbox vs E2B, Daytona, Vercel Sandbox and Beam pricing

The sandbox platforms split into two billing models. Cloudflare and Vercel Sandbox charge CPU for active use and memory for the provisioned size. E2B, Daytona and Beam charge the provisioned vCPUs and memory for every second the sandbox runs. The table prices one hour of a 2 vCPU sandbox on each, at two levels of CPU use.

PlatformShape and inputsHour at 10% CPUHour with both vCPUs busy
Cloudflare standard-32 vCPU, 8 GiB, 16 GB disk: $0.076 for memory and disk plus $0.072 per vCPU-hour used$0.0904$0.2200
Vercel Sandbox2 vCPU with its fixed 4 GB: 4 × $0.0212 plus $0.128 per CPU-hour used$0.1104$0.3408
E2B2 vCPU, 8 GiB: 2 × $0.0504 + 8 × $0.0162, disk included$0.2304$0.2304
Daytona2 vCPU, 8 GiB, disk within the 5 GiB free allowance: 2 × $0.0504 + 8 × $0.0162$0.2304$0.2304
Beam, Shared tier (opt-in)2 vCPU, 8 GiB: 2 × $0.011 + 8 × $0.0055$0.0660$0.0660
Beam, Performance tier (default)2 vCPU, 8 GiB: 2 × $0.05 + 8 × $0.01$0.1800$0.1800

Vercel ties memory to CPU at 2 GB per vCPU, so its row has half the memory of the others, and its rates are for the default iad1 region. With 4 GiB of memory, E2B and Daytona are $0.1656 an hour, Beam's Shared tier is $0.044 and its Performance tier is $0.14.

The plan fees differ as well. Cloudflare needs the $5 Workers Paid plan. E2B's Hobby plan is $0 with a one-time $100 credit, 10 concurrent sandboxes and a 1-hour limit on continuous runtime, and Pro is $150 a month plus usage. Daytona has no plan fee and gives $200 of free compute. Vercel bills sandbox usage against the Pro plan's $20 monthly credit. Beam's Developer plan is $20 a month with $20 of credits and allows 30 concurrent vCPUs.

Our E2B pricing and Daytona pricing guides break those two bills down the same way, and Vercel Sandbox alternatives covers the other active-CPU platform.

Cloudflare Sandbox alternatives for GPUs, larger machines and a Python SDK

Three requirements point away from Cloudflare: a GPU, a machine beyond 4 vCPUs and 12 GiB without a limit request, or driving sandboxes straight from a Python backend. A Cloudflare sandbox is started from a Worker and a Durable Object that you write and deploy in TypeScript or JavaScript, which suits teams already on Workers and adds a service for everyone else.

A Beam sandbox is created from Python or TypeScript with one SDK call. It runs in a container by default, and use_vm=True runs a CPU sandbox in a microVM instead. This one runs on the Shared CPU tier, installs a package into the image, runs code and saves the filesystem as a reusable image:

python
from beam import Image, Sandbox

sb = Sandbox(
    cpu=2,
    memory="4Gi",
    cpu_tier="shared",
    image=Image(python_version="python3.11").add_python_packages(["pandas"]),
    keep_warm_seconds=1800,
).create()

try:
    result = sb.process.run_code("import pandas as pd; print(pd.__version__)")
    print(result.stdout)

    # Save the filesystem; Image.from_id(image_id) boots new sandboxes from it
    image_id = sb.create_image_from_filesystem()
finally:
    sb.terminate()

keep_warm_seconds is the sandbox's lifetime, not an idle timer, so 1800 ends it after 30 minutes unless you call update_ttl(), and -1 removes the limit. The cpu_tier argument needs beam-client 0.2.236 or later.

Beam bills the sandbox's provisioned size by the millisecond while it runs, with no egress fees. This 2 vCPU, 4 GiB sandbox is $0.044 an hour on the Shared tier ($0.011 per vCPU-hour plus $0.0055 per GiB-hour, for sandboxes up to 8 vCPUs and 16 GiB) and $0.14 an hour on the Performance tier ($0.05 plus $0.01), which is the default for new accounts. To use a GPU, pass gpu with a model name such as "RTX4090". A GPU sandbox bills the GPU rate plus GPU-attached CPU and memory: $0.69 an hour for an RTX 4090, $0.18972 per vCPU-hour and $0.0198 per GiB-hour. With 2 vCPUs and 8 GiB that is $0.69 + $0.3794 + $0.1584, or about $1.23 an hour.

For an agent that has to keep its processes between turns, a Beam VM is a named Linux machine with a persistent root disk. Pausing it keeps memory and running processes and stops compute billing. VMs are CPU-only. Our AI agent hosting guide compares VMs, sandboxes and serverless for agents in more detail, and E2B alternatives lists more sandbox platforms.

How to choose a sandbox by billing model

Start from how the sandbox spends its time, then check the limits.

  • Your app already runs on Workers and sessions are mostly idle: Cloudflare. Active-CPU billing and the 1 TB egress allowance fit, and the sandbox sits next to your Worker.
  • The code is JavaScript that only calls methods you pass in: Dynamic Workers, with stable IDs so repeat calls aren't counted as new creations.
  • The agent keeps state in running processes between turns: a platform that pauses with memory, such as E2B or a Beam VM. A Cloudflare snapshot restores files only.
  • CPU is busy for most of the session, as in builds, test suites and data jobs: compare the busy column. Flat per-second billing is $0.066 to $0.2304 an hour for 2 vCPUs and 8 GiB in the table above, against $0.22 on a Cloudflare standard-3.
  • The code needs a GPU: a Beam sandbox or a Daytona GPU sandbox.
  • You need more than 4 vCPUs or 12 GiB today: another platform, or a limit request to Cloudflare.
  • Your backend is Python and you don't want to run a Worker: E2B, Daytona or Beam.

FAQ

How much does Cloudflare Sandbox cost?

Cloudflare Sandbox bills at the Containers rates: $0.072 per vCPU-hour of active CPU, $0.009 per GiB-hour of provisioned memory and $0.000252 per GB-hour of disk. It needs the $5 a month Workers Paid plan, which includes 375 vCPU-minutes, 25 GiB-hours of memory and 200 GB-hours of disk.

How much do Cloudflare Containers cost per hour?

It depends on the instance type. A basic instance (1/4 vCPU, 1 GiB) is $0.010 an hour idle and $0.028 with its CPU busy. A standard-3 (2 vCPU, 8 GiB) is $0.076 idle and $0.22 busy, and a standard-4 (4 vCPU, 12 GiB) is $0.113 idle and $0.401 busy.

Is there a free tier for Cloudflare Sandbox?

No. Sandboxes and Containers aren't available on the Workers Free plan. The $5 Workers Paid plan includes a monthly allowance, which covers about 25 hours of a basic instance's memory.

Does Cloudflare charge for an idle sandbox?

Yes, for memory and disk. A running instance bills its provisioned memory and disk even when its CPU is idle, and billing stops when the instance stops. The inactivity timeout, up to 6 hours, sets how long an instance stays up after its last request.

Is Cloudflare Sandbox cheaper than E2B?

It depends on CPU use and memory size. A Cloudflare standard-3 with 2 vCPUs and 8 GiB is $0.0904 an hour at 10% CPU and $0.22 with both vCPUs busy. An E2B sandbox of that size is $0.2304 an hour at any CPU level, and E2B's Pro plan adds $150 a month against Cloudflare's $5.

Does Cloudflare Sandbox support GPUs?

Cloudflare's instance types list vCPU, memory and disk only, up to 4 vCPUs and 12 GiB by default, with no GPU option. For GPU code execution, use a sandbox platform that attaches GPUs, such as Beam or Daytona.

How long can a Cloudflare sandbox run?

An instance runs while its Durable Object is active and then for the inactivity timeout, which can be set up to 6 hours. An alarm can keep it running longer, but Cloudflare doesn't guarantee an instance runs for a set time, and a stop clears its memory and disk.

Run sandboxes with flat per-second pricing

A Beam sandbox bills one rate for the size you set, by the millisecond, with GPUs available and no egress fees. Create a Beam account and run the snippet above to price your own workload. Current rates are on the Beam pricing page.

Eli MernitPublished November 29, 2026

Pay as you go
billed by the second

Give your agents their own machines

Sign up, install the CLI, and launch a sandbox, VM, or GPU from your terminal or your coding agent.