Skip to main content

Module window

Module window 

Source

Structs§

ModelUsage
Report
Totals

Constants§

FIVE_HOUR_SECS
LOOKBACK_SECS
How far back to read when inferring the anniversary.
WEEKLY_SECS

Functions§

build
Build the report: window totals plus a per-model breakdown for the period.
calendar_month_start
Start of the calendar month, 00:00 UTC — the predictable default, since nothing local records a subscription anniversary (the console holds it).
days_from_civil
month_start
Start of the billing month: the most recent occurrence of the inferred anniversary day, else the first of the calendar month. Returns (start, inferred).
next_month
The same day-of-month one month later, 00:00 UTC, in epoch ms; the year wraps. The day is clamped to 28 so an anniversary on the 29th–31st cannot skip a month into the wrong one — the same clamp month_start applies, so a period start it produced always has a matching end.
now_ms
Wall-clock now in epoch ms.
over_window
Which of this model’s windows is over its share of the monthly limit, if any — the verdict the sidebar’s flag, the watch frame and the cap notification all read from. Go meters per model AND per window (5-hour = 20%, weekly = 50%, monthly = 100%), so any one of them counts; the shortest window wins, being the most actionable. None for a free/unlimited model.
prev_month
The same day-of-month one month earlier, keeping the time of day — the inverse of next_month for the instants it can produce. The account API’s monthly resetsAt is an anniversary time (09:14:35, not midnight), so its period start has to carry that time of day back to the previous month.