Docs menu

Money

Cost forecasting

The month-end estimate with a likely range, each kind of spend and its trend, known renewals, when credit runs out, and alerts on spending spikes.

Explain it

Cost forecast, on each project page, tells you what the project will probably spend by the end of the month and over the next 30 days, and when the credit runs out at that pace. It includes everything the project pays for, not just running apps.

How to use it: open the project's Usage tab. If spending suddenly jumps, CLI alerts you.

"What will this project cost this month, and what's driving it?"

Cost forecast, on the project page, estimates what the project will spend by the end of the month and over the next 30 days. It also says when credit runs out at that rate. It's built from everything the project spends on: compute, AI calls, email, static-site bandwidth, static IPs, workflows, checks and domains, not just running services.

How it's worked out

Each kind of spend is forecast separately from the last four weeks:

  • A recent average that counts yesterday most.
  • The two-week trend, held back so one busy week doesn't project forever, and never below zero.
  • With three weeks of history, the weekday pattern (quieter weekends, say).
  • Charges known in advance, like domain renewals, on their dates.

The likely range comes from how much daily spend has varied lately. With less than three days of history, the forecast says it's a rough guess.

API
GET /v1/projects/:id/spend-forecast

The answer has monthEnd and next30Days (each with expected, low and high), byCategory with each kind's last 7 days, next 30 days and trend, upcoming known charges, runsOutOn and runwayDays, the budget comparison if a budget is set (/docs/billing), and anomalies. GET /v1/projects/:id/forecast is the simpler budget view.

Spending spikes

A day that spends more than twice the usual and well above the normal day-to-day spread is an anomaly. CLI raises spend_anomaly once for it, saying how much, against what usual amount, and mostly on what, so a runaway loop calling an AI model or a traffic spike gets noticed the next morning rather than at the end of the month.

Using it

  • Before the month runs over: if the month-end range is above your budget, look at the rising categories first.
  • Topping up: runsOutOn tells you how long the current balance lasts. Top up before then, or turn on card top-ups.
  • Cutting costs: right-sizing suggests the changes that lower the forecast (/docs/right-sizing).

Agents use cli_forecast and should quote the range, not just the middle.