提供案例
billflare.

在 Cloudflare Containers 上的四个月 CI:按使用计费的 vCPU,以及一个让 CI 停下来的硬性上限

@kelvin_des 描述了把全部 CI 从 GitHub Actions 迁到每个任务一个 Cloudflare Container,并把同样 90 天的标价账单算为约 $1,608,对比 GitHub 托管 runner 的 $3,288–$6,502,因为 Containers 按使用对 vCPU 计费,而他的机器大约 41% 忙碌。他还报告了一个账本 bug,使他自己设定的每日分钟硬性上限拒绝了每一个容器,此后他以最大容器数 × 每任务截止时间来约束支出。

适用产品
ContainersWorkers
来源
作者经验𝕏 串文
作者
@kelvin_des

要点

  • 他描述的架构:每个 CI 任务一个容器,由 GitHub 的 webhook 启动,运行一个任务,然后退出并停止计费,空闲为 $0;它在 7 月替换了三台始终开启的 VM。
  • 他按标价对同样 90 天所作的比较:Cloudflare 约 $1,608,GitHub 托管 4-core $6,502,GitHub 2-core $3,288,Blacksmith $4,322。他把这一差距归因于 Cloudflare 按使用对 vCPU 计费,且 CI 机器大约 41% 忙碌。这些是他的标价计算,不是一笔意外收费。
  • 事件:他设定的每日分钟硬性上限因账本 bug 读成每天 9,002 分钟,拒绝了每一个容器,并使 CI 停止;他此后的规则是不设硬性上限,以最大容器数 × 每任务截止时间来约束支出。
  • 他列出的其他事件:「runner lost communication」失败,后来发现是他的拆除代码杀掉了错误的容器,以及一个 GitHub 侧的账户问题,使 511 次 Actions 运行在启动时失败,此后他的 Worker 自行接管了 pull_request webhook。
  • 他说,只有当托管 runner 的费用会超过 $1,000/month、有人负责它,并且你需要供应商不卖的东西时,做这件事才值得。
  • Cloudflare 的 Containers 定价页(阅读于 2026-11-13)称,容器在主动运行期间每 10 ms 计费,内存和磁盘按所预配的实例类型计,CPU 仅按活跃使用计。

原始来源

  1. 发布

    @kelvin_des 描述了把全部 CI 从 GitHub Actions 迁到每个任务一个 Cloudflare Container,并把同样 90 天的标价账单算为约 $1,608,对比 GitHub 托管 runner 的 $3,288–$6,502,因为 Containers 按使用对 vCPU 计费,而他的机器大约 41% 忙碌。他还报告了一个账本 bug,使他自己设定的每日分钟硬性上限拒绝了每一个容器,此后他以最大容器数 × 每任务截止时间来约束支出。

    kelvin desman

    @kelvin_des · 𝕏 原帖

    1/ GitHub says my repo used 554,030 CI minutes in 90 days. It can't see a lot of them. Since Oct 18 none of our CI touches GitHub Actions. Here's 4 months of running all CI on Cloudflare Containers, with the real bill and everything that broke 🧵 https://t.co/KKf3tBezr8
  2. 2/ 每个 CI 任务一个容器,由 GitHub 的 webhook 启动,任务结束后退出并停止计费;空闲为 $0;在 7 月替换了 3 台始终开启的 VM。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    2/ Setup: one container per CI job. Starts on GitHub's webhook, runs one job, exits, stops billing. $0 idle. Replaced 3 always-on VMs in July.
  3. 3/ 同样 90 天的标价账单:Cloudflare ~$1,608,GitHub 托管 4-core $6,502,GitHub 2-core $3,288,Blacksmith $4,322;Cloudflare 按使用对 vCPU 计费,且 CI 机器 ~41% 忙碌。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    3/ Bill for the same 90 days of work, list prices: Cloudflare: ~$1,608 GitHub-hosted 4-core: $6,502 GitHub 2-core: $3,288 Blacksmith: $4,322 Why: Cloudflare bills vCPU on use. Our CI boxes were ~41% busy.
  4. 4/ 账单是容易的部分:125 天内对 CI 有 433 次 commits,其中 54% 是修复。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    4/ The bill was the easy part. 433 commits to CI in 125 days. 54% were fixes.
  5. 5/ 「Runner lost communication」(每天 ~10–14 次失败运行)是他的拆除代码杀掉了错误的容器,因为 GitHub 不会把 JIT runner 绑定到它被创建时所对应的那个任务。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    5/ Incident: "runner lost communication", ~10-14 failed runs/day. Looked like a Cloudflare flake. It was my teardown code. GitHub doesn't bind a JIT runner to the job it was made for, so I kept killing the wrong container mid-build.
  6. 6/ 一个账本 bug 使每日分钟硬性上限读成 9,002 min/day,并拒绝每一个容器;此后的规则:不设硬性上限,以最大容器数 × 每任务截止时间约束支出。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    6/ Incident: a hard daily minute cap. A ledger bug read 9,002 min/day. The cap refused every container. CI stopped. Rule since: no hard caps. Bound spend by max containers × per-job deadline.
  7. 7/ 一个 GitHub 侧账户问题使 511 次 Actions 运行以 startup_failure 失败;次日他的 Worker 自行接管了 pull_request webhook,并在没有 Actions 的情况下运行 CI。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    7/ Incident: an account issue on GitHub's side. Every Actions run → startup_failure (511 of them). Self-hosted runners can't help when Actions won't start a run. Next day our Worker took the pull_request webhook itself and ran CI without Actions.
  8. 8/ 只有当托管 runner 的成本会超过 $1,000/month、有人负责它,并且你需要供应商不卖的东西时,才值得去做。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    8/ Should you build this? Probably not. Only if hosted runners would cost you over $1,000/month, someone owns it, and you need something vendors don't sell.
  9. 9/ 链接了一篇完整长文,其中有原始数据、每个数字所对应的脚本,以及开源 runner。

    到 𝕏 阅读

    kelvin desman

    @kelvin_des · 𝕏 原帖

    9/ Full write-up, raw data + script for every number, and the open-source runner: https://t.co/WzwuxlPRmG https://t.co/KcObQ4I9X2
作者经验R2 +1

风易:R2 公开桶免费档最容易被偷的是公开直链,而不只是额度本身

风易(@Michael_liyang)指出,R2 公开桶的直链谁都能引用,别人的流量会记在桶主账上。建议三步:静态资源走自定义域名、不要裸挂 r2.dev;用 Worker 查 Referer 白名单,不在名单则返回 403;图片使用带过期时间的签名 URL。

Workers

ivebenfreed:October 的 Dynamic Workers 账单在 unique-worker 收费后接近 $80。

X 用户 @ivebenfreed(Ben Freed)称,上月 Dynamic Workers 账单接近 $80,因为每次 Code Mode 调用都会启动一个新实例,包括通过 Cloudflare 官方的 @cloudflare/codemode 包,超过每月前 1,000 个后每个 unique worker 每天 $0.002;October 最糟糕的一天有超过 12,000 个。作者后来停止使用 Dynamic Workers(数量从 October 每天约 2,600 降至 November 13 以来的零)。“按 October 的速度将达到约每月 $155”是推算,不用作事件金额。该帖中的回复并非 Cloudflare 官方回应。

作者经验Workers +4

runes_leo:用 AI agent 申请 Cloudflare for Startups 的 $10k 无融资档

@runes_leo 描述了在没有融资的情况下申请 Cloudflare for Startups 的 $10k 档:三个档位、谁符合资格、四页表单,以及三个坑(Chrome 中登录按钮变灰、必须使用公司域名邮箱、关联账户必须有付款方式)。他后来更正了 $100k/$350k 的标准,表示审批和抵扣额度仍在待定,并在 11 月 10 日更新称,Workers AI 不再覆盖新成员(现有 $10k 档成员直到 12 月 1 日最多 $2,500)。