What's the pricing model for dynamic worker loader
is it counted as independent worker request with subrequest and cpu costs or is it charged only as part of compute on the worker calling it ?
I'm asking this because if we use it as interpreter for LLM generated code it'll be huge cost if it costs a seperate worker request per LLM call
2 Replies
Every request on a Worker is counted independently, regardless of where it comes from, and CPU time is measured separately for each triggered Worker.
Remember that in order to access a specific Worker A from another Worker B, you need to create a binding for the desired Worker:
Documentation: https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/http/
Also, if you're planning to build some kind of code sandbox or interpreter, Cloudflare already provides tools and SDKs for this purpose:
- https://developers.cloudflare.com/sandbox/get-started/ and https://github.com/cloudflare/sandbox-sdk (code sandbox sdk with dockerfile)
- https://github.com/cloudflare/sandbox-sdk to deploy yuour servelesse container on edge
also, take a look at this project, its a complete vide sdk platform (with llm code generation and sandbox running -> https://github.com/cloudflare/vibesdk
Cloudflare Docs
Getting started
Build your first application with Sandbox SDK - a secure code execution environment. In this guide, you'll create a Worker that can execute Python code and work with files in isolated containers.
GitHub
GitHub - cloudflare/sandbox-sdk: Run sandboxed code environments on...
Run sandboxed code environments on Cloudflare's edge network - cloudflare/sandbox-sdk
GitHub
GitHub - cloudflare/vibesdk: An open-source vibe coding platform th...
An open-source vibe coding platform that helps you build your own vibe-coding platform, built entirely on Cloudflare stack - GitHub - cloudflare/vibesdk: An open-source vibe coding platform that h...