Docs / Runners and billing
On this page
Spend controls
Prepaid packs already bound what you can spend. Spend caps and the low-balance alert let you bound it per day and per month, and hear about it before compute runs out. Set them in the dashboard under Limits & alerts, or with PATCH /api/v1/settings and an admin key.
Daily and monthly caps#
A cap is a dollar amount per UTC day (daily_cap_usd) or per UTC calendar month (monthly_cap_usd). Before a job starts, Kajiya adds up:
- the cost of your jobs that finished since the start of the day or month,
- 10 minutes at their size for every job that is starting or running, and
- 10 minutes of the new job.
If the sum is above the cap, the job waits on GitHub with reason daily_cap or monthly_cap and starts by itself when the next UTC day or month begins, or as soon as you raise the cap.
A cap decides whether jobs start; it does not stop jobs that are running. A running job can run longer than its 10-minute reservation, so a day's spend can end above the cap by up to what the jobs running at that moment cost.
0holds every new job: an emergency stop that leaves running jobs alone.null(an empty field in the dashboard) removes the cap.- Amounts can be from 0 to 1,000,000 dollars.
# a $25 daily and $400 monthly cap
curl -X PATCH "https://kajiya.app/api/v1/settings" \
-H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"daily_cap_usd": 25, "monthly_cap_usd": 400}'
# stop new jobs now
curl -X PATCH "https://kajiya.app/api/v1/settings" \
-H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"daily_cap_usd": 0}'
# remove the daily cap again
curl -X PATCH "https://kajiya.app/api/v1/settings" \
-H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"daily_cap_usd": null}'When a cap first holds a job in a day or month, Kajiya sends one spend_cap.reached webhook for it, plus a job.waiting event for each job it holds. Changing a cap re-arms the spend_cap.reached event, and waiting jobs are re-checked within 10 seconds.
Low-balance alert#
Set low_balance_usd (dashboard: Low-balance alert below) to get a balance.low webhook when your remaining compute drops below that amount. Kajiya checks after each job finishes and sends the event once; it is sent again only after you buy a pack and the balance drops below the threshold again. Changing the threshold re-arms it.
Kajiya does not send email. To be alerted, set a webhook URL and forward balance.low and spend_cap.reached to your chat or paging tool. The dashboard also warns when, at your 7-day average, the balance lasts less than three days.
What happens to running jobs#
Nothing stops a job that is already running except its own end, the 58-minute limit, or a cancel: not a cap, not an empty balance, not pausing the repository, not a lower concurrency limit. These only hold new jobs. To stop running work, cancel its run in the dashboard, on GitHub, or with POST /api/v1/jobs/{id}/cancel.
Watching spend#
curl -s "https://kajiya.app/api/v1/account" -H "Authorization: Bearer $KAJIYA_API_KEY" | jq '{balance_usd, spend, caps}'spend.today_usd and spend.month_usd use the same UTC periods as the caps. spend.est_days_left divides the balance by the average daily spend of the last 7 days.