WBX Sandbox
Jobs and batches

Budgets

Set a monthly and a daily spending limit for background jobs and batches. Running jobs can never push spending over the limit.

Set limits

from wbxsandbox import get_budget, set_budget

set_budget(monthly="50.00", daily="5.00", alert_pct=80)   # "" removes a limit
print(get_budget())
curl -s https://sandbox.wbx.cz/v1/budget -H "Authorization: Bearer YOUR_API_KEY"
curl -s -X PUT https://sandbox.wbx.cz/v1/budget -H "Authorization: Bearer YOUR_API_KEY" -d '{"monthly_limit": "50.00", "daily_limit": "5.00", "alert_pct": 80}'

An empty string removes a limit. The answer shows the limits, what was spent this month and today, what running jobs have reserved and what is left. You can also manage it in Billing .

How it works

  • The worst-case cost of every job is reserved when it is accepted; when the job ends the reservation is replaced by its actual cost.
  • A job that does not fit is refused with 402 budget_exceeded.
  • Periods are the calendar month and day in UTC.
  • Limits set by WBX for your team apply as well – the lower one wins.
  • Sandboxes you create directly are not limited by the budget.

For a limit on a single job use max_cost (see Price limit), for a batch max_total_cost.