提供案例
billflare.

Cloudflare 全景指南:每项服务的费用与坑在哪

在 Cloudflare 上运营多个产品的 Elia(@eliakuratli)逐项介绍开发者平台:每项服务的费用、Workers Paid 包含的额度,以及针对他认为唯一真正会伤人的风险——没有硬性费用上限——的预防清单。

适用产品
WorkersD1R2Durable ObjectsAI Gateway
来源
作者经验𝕏 文章
作者
Elia(@eliakuratli)

要点

  • 作者写到:Worker 提供的静态资源请求免费且不计数;Workers 按 CPU 时间而非墙钟时间计费,等待慢接口不花钱;只有代码执行计入每月 1,000 万次包含请求。
  • 他把 Workers Paid 描述为整个账号每月 $5 的最低消费(不是按项目),列出每月包含的额度,超出部分按单位计费。
  • 在“唯一真正会伤到你的事”一节,他写到没有硬性费用上限,写入 D1 的循环每次写入都会计费。他的十分钟预防清单:为每个 Worker 设置 CPU 上限、打开账单告警、上线前检查每条写入路径、在模型调用前接入 AI Gateway,让失控的 Agent 立刻可见。
  • 他的“短板”清单包括:D1 单库 10 GB、每库一次只跑一个查询;没有真正的 Postgres(Hyperdrive 只加速你已有的库);长时间或 CPU 密集的任务需要 Containers 或 Workflows,而不是 Worker。

原始来源

  1. 发布

    在 Cloudflare 上运营多个产品的 Elia(@eliakuratli)逐项介绍开发者平台:每项服务的费用、Workers Paid 包含的额度,以及针对他认为唯一真正会伤人的风险——没有硬性费用上限——的预防清单。

    Elia

    @eliakuratli · 𝕏 原帖

    https://t.co/MO9Oqx79sO
    阅读全文归档于

    Elia · @eliakuratli

    The Ultimate Cloudflare Guide

    The whole developer platform, what each piece is for, what it costs, and where it bites. Written by someone who runs everything on it. Most Cloudflare guides are either marketing or a wall of docs links. This is the version I wish I'd had: every part of the platform in plain language, the price of each, the rules for picking between them, and the things that will annoy you. I run several products on this stack. Three of them show up below as examples, not as the point. The mental model One idea makes everything else click. A Worker is your application. Everything else is a binding. There's no network to configure, no VPC, no connection string in an env var. You declare in one config file that this Worker can reach that database, that bucket, that queue. The platform wires it up. A binding is a direct, authenticated handle to another service. Your whole stack ends up living in one file, usually under thirty lines. Compute Workers run JavaScript, TypeScript, Python or WebAssembly in V8 isolates across Cloudflare's network. Cold starts are effectively zero because there's no container to boot. This is where your app lives. Static assets are served by the same Worker as your app, and requests for them are free and uncounted. This one fact demolishes most Cloudflare bill estimates. A note on Pages. Start new projects on Workers, not Pages. Once Workers learned to serve static assets and render server-side, the roadmap moved there: Durable Objects, Cron Triggers, Queue consumers, Tail Workers, gradual deployments and real observability are Workers-only. Pages still works and isn't going away, so don't migrate a happy project for the sake of it. Just don't start anything new there. Durable Objects give you one single-threaded, strongly consistent instance of something, addressable by name, with its own storage. WebSockets, collaborative editing, rate limiters, locks, per-user coordination. If the question "which instance handled this?" matters, the answer is Durable Objects. Workflows are for multi-step processes that must survive failure: a step runs, the result is persisted, and a crash resumes from where it stopped rather than the beginning. Onboarding sequences, long imports, anything with retries and a state machine. Containers exist for the work that genuinely doesn't fit a Worker. A real container image, started on demand, billed by the second. Video processing, heavy binaries, legacy code that needs a filesystem. Queues move work off the request path. The Worker accepts the job, returns immediately, a consumer does the slow part after. This is the single biggest architectural upgrade most apps can make, on any platform. Cron Triggers are scheduled jobs. They're free. Use them liberally. Dynamic Workers (open beta) spin up sandboxed isolates on demand in milliseconds, which is how you run code an AI generated without handing it your machine. Live example. heydecks is a deck API: one POST returns a live URL, a PDF and an editable PPTX. The Worker takes the request and returns instantly, a Queue does the rendering, Durable Objects track job state, and R2 holds the output. Nothing about that shape is unusual, which is the point. Data Picking storage is where people stall, so here's the decision rule before the descriptions. Relational data, queries, joins → D1 Files, images, uploads, backups → R2 Small values read constantly, written rarely → KV State tied to one entity, needing consistency → Durable Objects Existing Postgres you're not giving up → Hyperdrive Embeddings and similarity search → Vectorize D1 is SQLite as a service. The counterintuitive part: you get up to 50,000 databases per account, 10 GB each. Cloudflare expects many small databases rather than one large one, so a database per tenant or per customer is the intended design, not a hack. Limits worth knowing: it's single-threaded per database, and 1 TB across the account. R2 is object storage with an S3-compatible API and no egress fees ever. Be honest about when that matters: S3 also gives you 100 GB of egress free per month, so at small volume the saving is zero. At 1 TB a month it's roughly $83 on S3 and $0 on R2. It isn't a reason to switch today. It's a reason growth doesn't punish you later. KV is an eventually consistent key-value store, replicated for fast reads everywhere. Perfect for config, feature flags, cached lookups. Wrong for anything you need to read back immediately after writing. Hyperdrive pools and caches connections to a Postgres or MySQL you already run elsewhere. It makes an existing database usable from Workers. It does not replace it, and it doesn't make it cheap. Vectorize is the vector database for embeddings and semantic search, billed per dimension queried and stored. AI Workers AI runs open models on Cloudflare's GPUs, called through a binding like anything else. Billed in neurons, with a daily free allocation. AI Gateway sits in front of any model provider, yours or Cloudflare's, and gives you caching, rate limiting, retries, logging and cost visibility from one place. Free. If you're spending real money on model calls, this is the highest-leverage thing on the list. Browser Rendering is a headless browser as a service: screenshots, PDFs, scraping, anything that needs a real page rendered. Agents and MCP. Cloudflare has leaned hard into agents, and Workers plus Durable Objects is a good fit for them — an agent is mostly a loop with state, which is exactly what a Durable Object is. Remote MCP servers run on Workers too. Live example. mrkr is cookieless analytics with session replay and revenue attribution, script under 6 kB. Analytics is a write-heavy edge problem: the Worker takes the beacon, D1 holds the data, KV fronts the reads that repeat. It also tracks which AI crawlers read a site, which is a category that didn't exist two years ago and doesn't appear in Google Analytics at all. The free half nobody talks about Most of Cloudflare predates Workers and a lot of it costs nothing. Tunnel makes any machine reachable from the internet with zero open ports. You install one small program, it dials out to Cloudflare, nothing dials in, you point a domain at it. No port forwarding, no static IP, no certificate renewals. Free, unlimited tunnels, unmetered bandwidth. Zero Trust Access puts a login screen in front of anything — an internal tool, a staging site, that tunnel. Free up to 50 users. Turnstile is a CAPTCHA replacement that usually shows users nothing at all. Free. DNS, CDN, WAF, DDoS protection, SSL are the original product and remain free on any plan. Unmetered DDoS mitigation is not a small thing to get for nothing. Email Routing forwards mail on your domain to wherever you read mail, and Email Workers let a Worker process inbound mail as code. Cloudflare Email Service handles the outbound direction, sending transactional email straight from a Worker. It's in beta, so treat it as such. Live example. skilessonfinder compares Swiss ski schools by resort and lesson type. It's mostly generated pages, a cron job keeping them fresh, and email carrying inquiries to schools. Technically the dullest thing I run, and that's fine — the work is in the content, not the infrastructure. What it actually costs The Workers Paid plan is a $5/month minimum for the whole account, not per project. It includes: Included each month Worker requests 10 million CPU time 30 million ms Static asset requests unlimited, uncounted D1 rows read 25 billion D1 rows written 50 million D1 storage 5 GB, across up to 50,000 databases R2 storage 10 GB, zero egress KV 10 million reads, 1 GB stored Queues 1 million operations Durable Objects 1 million requests Logs 20 million events, 7 day retention Cron triggers free Past those, you pay per unit: $0.30 per additional million requests, $0.75/GB-month for D1 storage, $0.015/GB-month for R2. Bandwidth is never billed. Two things follow from this table. First, you are not billed for wall-clock time, only CPU time, so a Worker waiting on a slow API costs nothing while it waits. Second, and this is the one that changes people's minds: the free static assets mean a normal website barely touches the 10 million requests. Only code execution counts. Most people quoting themselves $200 a month would land inside the included tier. What it's bad at The honest list, so you find these out now instead of in week three. D1 caps at 10 GB per database and runs one query at a time per database. There is no real Postgres. Hyperdrive accelerates yours, it doesn't replace it. Long-running or CPU-heavy work needs Containers or Workflows, not a Worker. Anything assuming a long-lived server process holding state in memory has to be rewritten. Next.js runs through the OpenNext adapter rather than first-party support. It works, but it's a layer. Astro, SvelteKit, Nuxt and Remix have a smoother path. Local development is good but not identical to production, so test bindings against the real thing before you ship. The one thing that can actually hurt you There is no hard spend cap. A loop that writes to D1 will bill you for every write. One developer hit $4,868 that way. Ten minutes of prevention: set CPU limits per Worker turn on billing alerts review every write path before it ships put AI Gateway in front of model calls so a runaway agent is visible immediately Cheap infrastructure. Not free infrastructure. Starting today Pick a small project, not your main one. Deploy it to Workers with static assets. Use your framework's Cloudflare adapter. Move the database to D1 and rewrite Postgres-specific SQL as SQLite. Move uploads to R2. Push anything slow into a Queue. Add a cron trigger for the maintenance you keep forgetting. Set your billing alerts before you go to bed. A weekend, roughly. The reason it's worth it isn't the $5. It's that the bill stops being a thing you think about while the products on top of it grow. I build heydecks, mrkr and skilessonfinder on this stack, and post the numbers as they change.
  2. 另一位作者 François Altwies(@francois352)回复称,据他所知 Cron 任务并不免费,而是按微秒计费——对文章“Cron Triggers 免费”的说法提出质疑。

    到 𝕏 阅读

    François Altwies

    @francois352 · 𝕏 原帖

    @eliakuratli Nice but cron jobs are not free and billed my microseconds, AFAIK
  3. 作者回复这条评论,反问它们是否免费。

    到 𝕏 阅读

    Elia

    @eliakuratli · 𝕏 原帖

    @francois352 They are free, no?
  4. 另一位作者 Filip(@aladicf)指出:免费 Workers 方案约能用到 300 万次 Durable Object 请求,而付费方案只包含 100 万次;他问是否应是 300 万次后再额外计费,并说按月计算的时长计价看起来没问题。

    到 𝕏 阅读

    Filip

    @aladicf · 𝕏 原帖

    something seems off with Durable Object pricing.. free worker plan can get like 3 mil requests while requests included within paid plan are only 1 mil? shouldnt it be 3 mil and then extra pricing? Duration pricing seems fine when you work it out on a monthly basis.. thats how workers pricing is 🧐🤷🏻‍♂️
作者经验Containers +1

青羽つむぐ:由 Durable Object 管理的 Containers 即使降低内存,若分到旧世代 CPU,费用仍可能升高

2026-11-24,X 用户 @aobane_tsumugu(青羽つむぐ)写道:Cloudflare Containers 按 CPU、内存和磁盘的使用时间计费。作者称,除了 Cloudflare 预先规定的 “scheduler-backed application” 组合外,9 月 30 日还发布了可让用户选择规格的 “Durable Object-managed application”;按理把内存从 3 GB 降到 1 GB,内存部分费用可以降到三分之一。作者又说,就自己的观测范围而言,Durable Object 管理的容器似乎更容易分到旧世代主机 CPU,同样工作会慢 1.1–3.6 倍;CPU 秒变长后,费用反而可能比降内存前更高。作者写明这是 2026 年 11 月下旬的所感,不是官方说明。短帖可见正文与 note_tweet 一致,全文完整。

D1

hiromsaeden:未建索引的 D1 查询循环计费 $2,129.00;一笔 $953.74 善意抵免后仍欠 $645.38。

Cloudflare 社区用户 hiromsaeden 在一篇关于 Workers 和 D1 的个人爱好项目事后分析中称,一条未建索引的 GROUP BY 聚合查询扫描了约 877,000 行以返回 30 行,一次非预期循环在两个计费周期内触发了约 315,000 次运行。仅在 Oct 15 – Nov 15 周期内,就读取了 1,447,580,203,670 行(1.44 万亿行),叠加在上一周期的用量之上。作者称 October 发票 IN-83890481 为 $529.88 USD,已自费全额支付;November 发票 IN-89082487 为 $1,599.12 USD($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax);总账单为 $2,129.00 USD,而预期预算约为 $20/month。在 Nov 2–3 发现问题后,作者删除了 Worker 和 D1 数据库;Support 确认所有读取已停止。在案例 #02408621 中,Support 为 October 提供了 $275.00 善意抵免,并建议保留至 Nov 15 开具 November 发票。在案例 #02434399 中,Support 应用了一次性善意抵免 $953.74(其中包含所保留的 $275.00),最终余额为 $645.38 USD,并称审查已完成,无法再做进一步调整。作者已支付 $529.88,称剩余的 $645.38 无力承担,账户将于 Nov 22 降级。作者还称预算警报曾在 $37 时触发一次,但并未阻止扣费,且 D1 目前没有硬性支出上限。公开帖中没有 Cloudflare 员工回复;Support 的处理由作者转述。

Workers AI

MrSaneApps:Workers AI 用量超出创业抵扣上限,仍需支付 $2,473.38;Cloudflare 拒绝调整发票。

MrSaneApps 发布了作者所称的客服回复:Cloudflare 无法调整发票 IN-85233588,仍需支付 $2,473.38;该计划在项目期内覆盖 Workers AI 最高 $2,500,$2,503.84 抵扣已用于 Workers AI 用量,其余按标准费率计费,创业抵扣不能挪用于超过该上限的 Workers AI。所引回复称控制台 Credits 页面显示的 $50,000 Workers AI 上限适用于 $350,000 档,工单 02359041 于 10 月 7 日的回复本应指出 $2,500 上限,对这两点表示歉意,并称已上报修正控制台文案,但不会更改项目条款。作者称自己在试图理解计划条款时被误导,请求人工复核截图,并请求 Cloudflare 原谅本月的失误。