Which is better, Modal or Cloudflare Sandbox?
It depends on where your code already lives. Agents that idle between model calls cost the least on Runtime: $0.64 for 1,000 one-minute runs, against $1.35 on Cloudflare and $3.97 on Modal. Runtime needs no App, Worker or plan from any backend. Pick Modal if your code runs on Modal, beside functions, endpoints and cron jobs, or if you need GPU sandboxes. Pick Cloudflare Sandbox if your code runs on Workers and should share their account, billing and bindings.
At a glance
Cloudflare's rates are those of Cloudflare Containers, the service under its Sandbox SDK. Modal counts two vCPUs as one physical core.
| Modal Sandboxes | Cloudflare Sandbox SDK | Runtime | |
|---|---|---|---|
| Isolation | gVisor, a user-space kernel that intercepts system calls | A container in its own VM | Firecracker microVM, own kernel |
| CPU | $0.1419 per physical core-hour (2 vCPUs), request or use | $0.072 per active vCPU-hour, metered in 10 ms steps | $0.025 per vCPU-hour of measured CPU, with a small floor |
| Memory | $0.0240 per GiB-hour, request or use | $0.009 per provisioned GiB-hour; at least 3 GiB per vCPU | $0.0075 per reserved GiB-hour |
| Plan fee | Starter $0 with $30 a month of compute; Team $250 a month | Workers Paid, at least $5 a month | None; prepaid credit from $10 |
| Free start | $30 of compute a month on Starter | No free tier; the plan includes 375 vCPU-minutes a month | 100 free hours of a 1 GB machine in the first 30 days, no card |
| Lifetime | 5 minutes by default, up to 24 hours | Filesystem-only snapshots; processes restart | Pause keeps files, memory and processes while you have credit |
| Where it runs | Region selection at 1.15 to 1.75 times base prices | The nearest location with the image, on Cloudflare's network | One US region |
| Called from | Modal's SDK, with an App outside Modal | A Durable Object inside a Cloudflare Worker | Any backend: API, CLI, MCP server, JavaScript and Python |
Do I have to build on their platform?
Largely, yes, for both rivals, in different ways.
- Modal: a sandbox created from outside Modal needs an App passed to
Sandbox.create. Named sandboxes live in an App, andfrom_namefinds one only while it is running. - Cloudflare: a sandbox is a Durable Object in your Worker that starts a
Cloudflare Container, set up with a Durable Object binding and a
containersentry. Since version 1.0, the Sandbox SDK adds only file operations and bucket mounts. It deploys with Wrangler, on the Workers Paid plan. - Runtime: one call from any server creates a sandbox. No App, Worker or
deployment comes first.
Sandbox.getOrCreate(name)finds a named sandbox whether it is running or paused.
If your application already runs on Workers, a Worker can call Runtime too.
Use SDK 0.4.0 or later and the nodejs_compat flag.
Runtime vs Cloudflare has the sample.
Cost for the same job
The job is 1,000 runs of 60 seconds on 2 vCPU (one physical core in Modal's
terms), each with 20 CPU-seconds of work. Modal and Runtime have 4 GiB.
Cloudflare's smallest custom 2 vCPU shape is 6 GiB. It also carries 12 GB of disk,
as Cloudflare's 6 GiB standard-2 instance type does.
- CPU
- 1,000 × 60 s × 1 core × $0.00003942
- $2.37
- Memory
- 1,000 × 60 s × 4 × $0.00000667
- $1.60
- CPU
- 1,000 × 20 s × $0.000020
- $0.40
- Memory
- 1,000 × 60 s × 6 × $0.0000025
- $0.90
- Disk
- 1,000 × 60 s × 12 × $0.00000007
- $0.05
- CPU
- 1,000 × 20 s / 3,600 × $0.025
- $0.14
- Memory
- 1,000 × 60 s / 3,600 × 4 × $0.0075
- $0.50
At 100,000 runs a month, the bills are $396.60 on Modal, $135.04 on Cloudflare, and $63.89 on Runtime. With both CPUs busy for the whole minute, the job costs $1.33 on Runtime, $3.97 on Modal, and $3.35 on Cloudflare. The Cloudflare figure treats each sandbox as destroyed once its run ends. Not counted: plan fees, Workers requests, Durable Object time, network and free credit.
Of the two rivals, Cloudflare is cheaper at both loads. Modal bills the full requested core through the waiting. Its sandbox rate is about three times its rate for functions: $0.00003942 a core-second, against $0.0000131.
gVisor, a container in a VM, or a microVM?
Modal isolates each sandbox with gVisor, a user-space application kernel that intercepts the sandbox's system calls. Cloudflare puts a container inside a VM of its own. Runtime boots each sandbox as a Firecracker microVM with its own Linux kernel. More in Firecracker vs gVisor and gVisor.
Which one to pick
| Where your code lives | Best fit |
|---|---|
| On Modal, beside functions, endpoints and cron jobs | Modal |
| Needs GPU sandboxes | Modal |
| On Workers, sharing account, billing and bindings | Cloudflare Sandbox |
| Any other backend | Runtime |
Runtime Cloud
Runtime is 84% cheaper than Modal and 53% cheaper than Cloudflare on the same job. It also asks you to adopt no platform. 1,000 one-minute runs at 2 vCPU cost $3.97 on Modal, $1.35 on Cloudflare, and $0.64 on Runtime. Runtime meters CPU as Cloudflare does, at 65% below its rate. It lets memory follow the job, and needs no App, Worker or plan. Rates checked 25 October 2026.
It gives each sandbox a microVM at 84% below Modal's price and 53% below Cloudflare's, with memory sized to the job and a pause that keeps memory and processes.
Start free with npx withruntime login. See the migration guide for moving code from either one.
Porting from each
Both map call for call. Modal: modal.Sandbox.create(app=...) maps to
Sandbox.create(), and sb.exec(*args) maps to exec. Cloudflare 0.x:
getSandbox(env.Sandbox, name) maps to Sandbox.getOrCreate(name), and
proxyToSandbox maps to box.previews.create(port).
Pythonfrom withruntime import Sandboxwith Sandbox.create() as box: box.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n") print(box.exec("python3 /workspace/invoice.py", check=True).stdout)Credit you add within 30 days of signing up is matched, up to $1,000 in total. The migration guide lets a coding agent port the project on a branch and test it on the free usage. Longer reads: Runtime vs Modal, Runtime vs Cloudflare.
Sources
Cloudflare sandbox lifetime, snapshot behavior checked 27 October 2026. Modal pricing and Modal Sandboxes pages were rechecked 26 October 2026. The rest were checked 25 October 2026.
Modal pricing, Modal resources and billing, Modal Sandboxes, Modal security
Cloudflare Containers pricing, Containers limits and instance types, Containers architecture, Sandbox lifecycle
Facts on this page were checked on 26 October 2026.