billflare.

cloudflare-cost-to-line: daily month-end cost forecasts sent to LINE

pych-ky’s MIT-licensed Worker sends the current month’s Cloudflare usage-based charges and a month-end forecast to LINE once a day or on demand, using the Billable Usage API.

Products
Workers
Source
Community resourceGitHub repository
Author
pych-ky

Key points

  • Data: the README says it reads self-serve usage-based charges (USD, daily UTC line items) from Billable Usage API v1, which differ from the final amount paid including taxes, credits and invoice corrections.
  • Forecast: charges so far plus the last 7 days’ average times the remaining days (including days not yet tallied) plus a configured monthly fixed cost. It holds the forecast back when data is missing, fewer than 7 days exist or the last 7 days were $0, and says free-tier overage, tiered pricing and sudden spikes cannot be forecast accurately.
  • Setup: it deploys through GitHub Actions with separate tokens, a deploy token (Workers Admin at first, then Individual Workers Editor for that Worker) and a Billing Read token for charges, plus LINE Messaging API credentials. The default daily cron is 0 15 * * * (UTC) and the reporting time zone defaults to Asia/Tokyo.
  • Delivery: temporary fetch failures are retried twice and then reported as an unconfirmed amount, and success means the LINE API accepted the message, not that it reached the device.

Original sources

  1. Undated

    cloudflare-cost-to-line

    Open original source

    pych-ky’s MIT-licensed Worker sends the current month’s Cloudflare usage-based charges and a month-end forecast to LINE once a day or on demand, using the Billable Usage API.

    Read originalArchived

    cloudflare-cost-to-line

    Cloudflare の当月従量料金と月末予測を、毎日または手動で LINE に通知する。 設定 設定値は GitHub の production Environment に登録する。 Secrets - CLOUDFLARE_ACCOUNT_ID - 対象の Cloudflare アカウントID - CLOUDFLARE_API_TOKEN - デプロイ用トークン。初回は Workers Admin、以降は対象 Worker の Individual Workers Editor - BILLING_API_TOKEN - 料金参照用トークン。対象アカウントの Billing Read - LINE_CHANNEL_ACCESS_TOKEN - LINE 送信用の Messaging API トークン - LINE_RECIPIENT_ID - 友だち追加済みユーザー/公式アカウント参加済みグループのID(通常の LINE ID とは別) Variables(任意) 括弧内は既定値を示す。 - WORKER_NAME - デプロイする Worker 名(cloudflare-cost-to-line) - TIME_ZONE - 集計期間・通知日付のタイムゾーン(Asia/Tokyo) - DAILY_CRON - UTCで1日1回の通知時刻(0 15 * * *)。TIME_ZONE と独立 - MONTHLY_FIXED_COST_USD - 月末予測に加える月額固定費(0 USD) 実行 GitHub Actions で main を対象に、次のワークフローを手動実行する。 - Deploy - コード・Secrets を反映 - Send cost notification now - 毎回送信。日次の重複判定とは独立し、Worker・Cron の検証には使えない 注意事項 npm run dev の /cdn-cgi/local/scheduled は接続設定があると実送信するため、検証用宛先を使う。 通知の制約 - 集計 - Billable Usage API v1 の self-serve 従量料金(USD・UTC 日次明細)。税・クレジット・請求訂正込みの確定支払額とは異なる - 月末予測 - 計上額+直近7日平均×残日数(未集計分含む)+設定固定費。欠測・7日分未満・直近7日0ドルなら保留。無料枠超過・段階課金・急増は正確に予測できない - 期間 - TIME_ZONE の暦月 - 再試行 - 一時的な取得失敗は2回再試行後に金額未確認として通知。LINE の一時失敗は最大23時間 - 成功 - LINE API の受理(端末到着は保証外)
    Open original source

    MIT License. Copyright (c) 2026 cloudflare-cost-to-line contributors. Plain text from the pinned README; formatting simplified. Chinese and English texts are translations. MIT

Author experienceDurable Objects +3

xiaomovps: sleep-while-waiting in Pi 1.6.1 and Agents SDK 0.34.0, Search for Agents billing, and enabling a subscription from the CLI

On 2026-11-27, 𝕏 user xiaomovps describes several billing-related changes in Pi 1.6.1 and Cloudflare Agents SDK 0.34.0. The author says ToolPark, while waiting for confirmation or a scheduled task, writes state into the Durable Object's built-in SQLite and then sleeps, and does not occupy background runtime; Search for Agents search usage is counted against the AI Search plan quota; after upgrading cf to above 1.0.0-rc.5 and logging in again, you can view the price in the terminal and confirm enabling Workers Paid, R2, or Zero Trust, provided a payment method is already bound on the account. The author also warns: once a session has run on Pi 1.6, the storage format is upgraded and old Pi 1.5 cannot read it; do not roll the Worker back to 1.5.

D1

Kun Save Point (@Savepoint_kk): a D1 bug rewrote unchanged data into a $2,739.12 bill; $2,141 goodwill credit granted.

Kun Save Point (@Savepoint_kk), an indie developer who says he recently lost his job, says a bug repeatedly rewrote unchanged data while inefficient queries amplified reads, producing a $2,739.12 Cloudflare bill already paid via PayPal (D1 rows written $2,641.00, rows read $64.06, other services $34.06); he says his bills were usually under $10 a month. Cloudflare granted a $2,141 goodwill account credit under case #02391058. He asks for it to be converted into a refund to the original PayPal payment, or at least for relief on the $2,641 write charges, and later writes that the initial request was declined and has been reopened for additional review. On October 25 he adds that he missed the only alert email Cloudflare sent, whose amount was not particularly high, and received no further warning before the large card charge; on October 26 he writes that the refund request to the original payment method is still under further review. On November 10 he posts a timeline saying that after following up on November 10–11, support again stated the $2,141 could only remain as account credit and the remaining $598.12 was still undecided while the ticket was being closed. On 26 November 2026 the author posted another public thread asking what a "final decision" means. He says that in the first case an agent called a refund impossible as a "final decision," then submitted it for further review; that after several business days he was told the account credits could not be refunded while the remaining amount was still under review; and that the first case was later closed without a clear resolution of that remaining amount. He opened a second case; an agent said the remaining amount had been definitively rejected, another "final decision." After the author posted on X, a senior billing specialist (Agent D) confirmed that the previously rejected amount had actually been refunded. The author asked whether the larger $2,141 account credit could be converted into a cash refund; after being told it was under review, an agent from the first case declared another "final decision": no refund. The author asks who reviews these requests and why a supposedly final rejection was later followed by an actual refund, and says D1 on Workers Paid still lacks a configurable hard spending cap. The posts cite cases #02391058 and #02447083. There is no staff reply on that public thread.

Author experienceR2 +1

风易: the easy leak on a free R2 public bucket is the public URL, not the quota itself

风易 (@Michael_liyang) argues that a public R2 bucket’s direct URL can be hotlinked by anyone, so other sites’ traffic is billed to the bucket owner. The recommended three steps are a custom domain instead of a bare r2.dev link, a Worker Referer allowlist that returns 403 otherwise, and signed expiring URLs for images.