Skip to docs content

AI spend budget gate

The public spend-check endpoint returns account month-to-date spend, forecast paces, your threshold, and an overBudget flag. Point a CI job at it with a Fluxtab API token to fail a deploy when the account is already over budget.

This is a budget trajectory check. This checks your account's budget trajectory as of this PR — it does not yet calculate the specific cost impact of the code change itself.

Why use it

Dashboards and Slack alerts help humans notice overruns. An AI spend budget gate makes the same account-level check automatic: if month-to-date spend already exceeds the budget you care about, the pipeline fails before you ship more load.

This still does not hard-stop provider traffic. It only stops your pipeline when Fluxtab says the account is over budget.

Setup

  1. Create a token under Settings → API access (shown once; starts with ftab_). Store it as a CI secret (for example FLUXTAB_TOKEN).
  2. Optionally note your alert threshold in Fluxtab, or plan to pass budget= on the request to override overBudget for that check only.
  3. Add a job step that calls spend-check and exits non-zero when over budget:
RESP=$(curl -sS -H "Authorization: Bearer $FLUXTAB_TOKEN" \
  "https://fluxtab.dev/api/public/spend-check?budget=500")

echo "$RESP" | grep -q '"overBudget":true' && exit 1
  1. Run the job on a schedule or on every deploy. Watch rate limits: each token is limited to 60 requests per hour by default.

Full response shape and auth details are under API Access. Forecast fields in the payload are an estimate, not a guarantee — use overBudget / mtdSpend for the gate, not the forecast alone.