ivebenfreed:官方 @cloudflare/codemode 的 Dynamic Workers 账单接近 $80,按 10 月节奏约 $155
Ben Freed(@ivebenfreed)称,用于 code mode 的 Dynamic Workers,包括 Cloudflare 官方 @cloudflare/codemode 包,每次调用都会拉起新实例。每月超过首 1,000 个 unique Worker 后按每个每天 $0.002 计费;10 月最差的一天超过 12,000 个,账单接近 $80。按 10 月节奏一个月约 $155。改成静态的 bash / Pyodide / QuickJS Worker 后,unique Worker 数量从每天约 2,600 降到自 11 月 13 日起为 0。以上金额为作者自述,不计入指南合计;相关案例已记录约 $80 的账单。
- 适用产品
- Workers
- 来源
- 作者经验𝕏 帖子
- 作者
- Ben Freed(ivebenfreed)
要点
- 作者停用了 Dynamic Workers:bash 在一个普通 Worker 里用 just-bash 跑,python3 在 Pyodide 的 Python Worker 里跑,node 则在同一 bash Worker 里用编译成 wasm 的 QuickJS 跑,必要时再回退到 Linux 容器。
- 替换后的 bash Worker 用 2.4 秒 CPU 处理了 70 个请求,作者称费用不到一分钱的百分之一。另有 5 项任务基准里的模型费用(每次从 $0.107 降到 $0.0215)不属于 Cloudflare 用量费用。
- FlareCost 回复称,调用 .load(code) 或在没有稳定 ID 的情况下加载会创建新的 Dynamic Worker;用稳定 ID 调用 .get() 时,同一段代码每天只计一次,启动 CPU 仍计费。该串文有两条回复,第二页没有更多帖子。
原始来源
发布
原帖
到 𝕏 阅读Ben Freed(@ivebenfreed)称,用于 code mode 的 Dynamic Workers,包括 Cloudflare 官方 @cloudflare/codemode 包,每次调用都会拉起新实例。每月超过首 1,000 个 unique Worker 后按每个每天 $0.002 计费;10 月最差的一天超过 12,000 个,账单接近 $80。按 10 月节奏一个月约 $155。改成静态的 bash / Pyodide / QuickJS Worker 后,unique Worker 数量从每天约 2,600 降到自 11 月 13 日起为 0。以上金额为作者自述,不计入指南合计;相关案例已记录约 $80 的账单。
Ben Freed
@ivebenfreed · 𝕏 原帖
Attention! Be careful using dynamic workers for codemode in your @CloudflareDev workers based app!! My bill for dynamic workers came to nearly $80 last month because every time you call codemode it spins up a new instance, and Cloudflare's official @cloudflare/codemode package works the same way. Cloudflare charges $0.002 per unique worker per day past the first 1,000 a month. On my worst day in October I had over 12,000 of them. The fix was to stop using dynamic workers altogether. Bash now runs in one ordinary Worker using just-bash. python3 runs in a Python Worker on Pyodide, and node runs in QuickJS compiled to wasm inside the same bash worker. That covers most of your code mode needs and you can fall back to a Linux container if you really need it. The Dynamic Worker count went from roughly 2,600 a day in October to zero since Nov 13. October's pace would have come to about $155 a month. The bash worker that replaced them handled 70 requests on 2.4 seconds of CPU, which costs less than a hundredth of a cent. While I was in there I also moved rordi's tools behind a search step, so the full tool list stays out of every prompt. On the same 5-task benchmark, model cost per run went from $0.107 to $0.0215 and the scores held. A batch test that pulled 250 items through a single bash call came out around $0.0001 per fetch, against $0.0003 when the agent made the calls directly. There's still a lot of optimization to do when you're trying to build a system of record for agents and you really need all the options out there. Maybe CF should shift their official code mode to static workers since it's way cheaper?
其他推荐阅读
Workers 与 Durable Objects 硬性费用上限:早期访问预告
Cloudflare 员工 Sid 与 Brayden 预告硬性费用上限,首批覆盖 Workers 和 Durable Objects。Sid 称目前约有 10 分钟延迟,达到上限的 80% 会告警。
igorrizzom:一个被遗忘的 Durable Object 警报产生了 US$ 2,038 账单;支持退还 US$ 1,533.29,余下 US$ 505。
X 用户 @igorrizzom(Igor Rizzo)亦以 igorarm(urnaaovivo.com)在 Cloudflare 社区发帖,称一个收集巴西公开选举数据的个人、非商业原型在 October 25 决选后仍在运行。一个 Durable Object 通过警报每约 5 秒重新调度自身并写入 SQLite,发票达到 US$ 2,038,几乎全部来自写入的 DO 行,约 10k 次页面浏览。作者称已设置预算警报,但发到了一个从未查看的旧收件箱,且警报不会停止用量。Workers 和 Durable Objects 的支出限额直到 November 13 才宣布,当时几乎所有用量已经发生;作者随后设置了 US$ 1 的支出限额,关闭了收集器,并移除了 Cron Triggers。作者称支持以一次性善意退还了 US$ 1,533.29。余下 US$ 505(作者后来描述为 US$ 500 用量加上 US$ 5 Workers Paid 费用)被作为最终决定结案;作者在案例 #02442826(#02435308 的后续)中请求主管复核,并询问 @SidChatterjee 对于上线前案例是否仍有善意处理途径。公开 X 帖和社区帖中均没有 Cloudflare 员工回复。公开的支持处理由作者报告。
风易:免费档日志不要全量记,全量记会先烧掉 D1 写行数
2026-11-14,X 用户 @Michael_liyang(风易)写道:免费档里日志别全量记,全量记先烧掉的是 D1 写行数。做法是:错误全记,带 trace id 和错误码;成功只采样 1%,够看趋势就行;采样率写配置,排查时临时调高再降回来。链路是请求→定级→错误全记/成功抽样→脱敏→落 D1。作者判断:日志是给排查用的,不是攒着养老的,省下的写行数留给真正的错误。