# Modal vs Cloudflare Sandbox: pricing, isolation and limits Modal runs sandboxes under gVisor and bills requested CPU; Cloudflare runs a container in a VM from a Worker and bills active CPU. **Runtime is 84% cheaper than Modal and 53% cheaper than Cloudflare on the same job, and it 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 about a third of its rate, lets memory follow the job, and needs no App, Worker or plan. Rates checked 23 September 2026. ## 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 | 50 sandbox hours, no card | | Lifetime | 5 minutes by default, up to 24 hours | Sleeps after 10 idle minutes by default; files are lost | Pause keeps files, memory and processes, 1 to 365 days | | 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 TypeScript SDK 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, and `from_name` finds one only while it is running. - **Cloudflare:** the Sandbox SDK runs inside a Worker, which exports the `Sandbox` class with a Durable Object binding and a `containers` entry. It deploys with Wrangler and a local Docker build, on the Workers Paid plan. - **Runtime:** one call from any server creates a sandbox. No App, Worker or deployment comes first, and `Sandbox.getOrCreate(name)` finds a named sandbox whether it is running or paused. If your application already lives on Workers, a Worker can call Runtime too, with SDK 0.4.0 or later and the `nodejs_compat` flag; [Runtime vs Cloudflare](/docs/cloudflare-sandbox-alternative) 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 2 vCPU shape is 6 GiB, and it carries the 12 GB of disk from Cloudflare's own example. ``` Modal CPU 1,000 × 60 s × 1 core × $0.00003942 = $2.37 Memory 1,000 × 60 s × 4 × $0.00000667 = $1.60 Total $3.97 Cloudflare 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 Total $1.35 Runtime CPU 1,000 × 20 s / 3,600 × $0.025 = $0.14 Memory 1,000 × 60 s / 3,600 × 4 × $0.0075 = $0.50 Total $0.64 ``` Over 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, it is $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, and 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](/compare/firecracker-vs-gvisor) and [gVisor](/glossary/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 gives each sandbox a microVM at a sixth of Modal's price and under half of Cloudflare's, with memory sized to the job and a pause that keeps memory and processes. ## Porting from each Both map call for call. Modal: `modal.Sandbox.create(app=...)` to `Sandbox.create()`, `sb.exec(*args)` to `exec`. Cloudflare: `getSandbox(env.Sandbox, name)` to `Sandbox.getOrCreate(name)`, `proxyToSandbox` to `box.previews.create(port)`. ```python from withruntime import Sandbox with Sandbox.create(funding="trial") as box: print(box.exec("python3 -c 'print(6 * 7)'", check=True).stdout) ``` `npx withruntime switch --from modal` or `--from cloudflare` before the first top-up matches it with up to $100 of credit. The one instruction in [migration](/docs/migrate) lets a coding agent port the project on a branch and test it on the free trial. Longer reads: [Runtime vs Modal](/docs/modal-sandbox-alternative), [Runtime vs Cloudflare](/docs/cloudflare-sandbox-alternative). ## Sources Modal pricing and Modal Sandboxes pages rechecked 25 September 2026; the rest checked 23 September 2026. - [Modal pricing](https://modal.com/pricing), [Modal resources and billing](https://modal.com/docs/guide/resources), [Modal Sandboxes](https://modal.com/docs/guide/sandbox), [Modal security](https://modal.com/docs/guide/security) - [Cloudflare Containers pricing](https://developers.cloudflare.com/containers/pricing/), [Containers limits and instance types](https://developers.cloudflare.com/containers/platform/limits/), [Containers architecture](https://developers.cloudflare.com/containers/concepts/architecture/), [Sandbox lifecycle](https://developers.cloudflare.com/sandbox/concepts/sandboxes/) - Runtime [pricing](/docs/pricing) and [security](/docs/security) Facts on this page were checked on 25 September 2026.