Skip to content

five-on-it / apps/api/src/budget

apps/api/src/budget ​

The budget of the platform's model (TECHNICAL_SPECS §9.8): a hard cap a month (FOI_CREATOR_MONTHLY_USD, 25 dollars by default) spread over the days left of it. Each day's budget is what is left of the cap at the day's start divided by the days left, today included (UTC), so a quiet day leaves more to the next and a busy one less; it stays the same all day. A creation's turn reserves what is left of the creation's cap (FOI_CREATOR_JOB_USD, JOB_USD by default, an admin's override first) when a runner claims it and settles at what it spent when it ends (the ledger in the store, a line a turn). New briefs are refused once today's spend and reservations reach the day's budget ("creation resumes in N h", the next day's start, or the next month's when the cap is spent), and a queued creation is claimed only while the budget covers one more job's cap: an account an admin marked exempt skips both, its caps per job still holding.

Interfaces ​

Variables ​

Functions ​