Cloudflare Workers AI Memory and Execution Timeout Sizing Calculator
Cloudflare Workers enforce a strict 128 MB memory limit per isolate and CPU time limits of 10 ms (Free) or 30 seconds to 5 minutes (Paid). AI requests are billed at $0.011 per 1,000 Neurons. Calculate your exact resource headroom and avoid Error 1102 limits.
Interactive Parameters & Live Verdict
Rule Diagnostics & Recommendations
Engineering Formula & Verification Notes
Calculations evaluate Cloudflare Workers V8 isolate boundaries (128 MB absolute limit per isolate), CPU execution time tracking (excluding network I/O wait times), and Workers AI pricing at $0.011 per 1,000 Neurons.
Worked Engineering Example
Consider a Workers AI function processing user prompts using an LLM. The JavaScript bundle and V8 heap consume 45 MB of memory. The CPU execution time takes 1.5 seconds, while network calls to fetch external context add 400 ms of wall time (which does not count against CPU limits). Each request consumes 15,000 Neurons at $0.011 per 1,000 Neurons ($0.165 per 15k requests).
- Memory headroom is 83 MB out of the 128 MB isolate ceiling.
- Network wait time does not decrement CPU time quotas.
- AI costs scale linearly with neuron usage.
Common Sizing & Compatibility Mistakes
Engineers frequently conflate wall-clock time with CPU execution time. Network operations like fetch() or database queries do not consume CPU time. However, buffering large responses into memory can trigger Error 1102 when isolate limits are breached.
- Attempting heavy computations on the Free tier (10 ms limit).
- Buffering large files entirely in memory instead of utilizing TransformStream.
- Failing to account for shared memory across concurrent requests inside a single V8 isolate.
Cloudflare Workers Plan Limits Reference
| Resource | Workers Free | Workers Paid |
|---|---|---|
| CPU Time / Request | 10 ms | 5 min (default 30s) |
| Memory per Isolate | 128 MB | 128 MB |
| Subrequests / Request | 50 | 10,000 |
| Workers AI Cost | $0.011 / 1k Neurons | $0.011 / 1k Neurons |
Frequently Asked Technical Questions
What happens when a Worker exceeds the 128 MB memory limit?
Cloudflare returns Error 1102 to the client with 'Worker exceeded resource limits', logged as exceededMemory in analytics.
Does waiting for fetch() or Workers AI responses count toward CPU time?
No. CPU time measures only active code execution in the V8 engine. Network wait time does not count against your CPU limit.
How are Workers AI Neurons calculated?
Neurons measure GPU compute across different AI models, priced at $0.011 per 1,000 Neurons on both Free and Paid plans.