Skip to content

Spending limits

A spending limit is set by a person in the HalationLab.ai app, for one credential. No API call can create a limit or raise it.

  • API keys have a limit that is on by default and resets monthly. It can also cap the price of a single generation. The owner can switch it off; the key can then spend up to the account balance. Keys and their limits are managed in Account → Developers.
  • OAuth apps get the limit the user set on the consent screen when connecting the app. The app cannot raise it. See Budgets.

GET /v1/account returns spending_limit for the credential:

Field Meaning
enabled Whether a limit applies. When false the credential may spend up to the account balance.
amount The limit per period.
per_generation The most one generation may cost.
period month: resets monthly. fixed: applies once until it ends.
used, held, remaining Spent in this period, reserved for work in progress, and what is left.
resets_at When the period ends.
manage_url Where the account owner changes the limit.

spending_limit is null when the credential has no spending authority yet. The account’s own token balance is in balance (available and held).

get-account.sh
# Shows who the API key acts for, its balance and what is left of its spending limit.
set -euo pipefail
API="${HL_API_BASE:-https://api.halationlab.ai/v1}"
curl -sS --fail-with-body "$API/account" \
-H "Authorization: Bearer $HALATIONLAB_API_KEY"

A start that would go over the limit, or over the balance, is refused before anything runs. Every refusal is free.

Error Meaning What to do
402 spending_limit_reached This generation would go over the limit. Wait for resets_at, or ask the owner to raise the limit at manage_url.
402 insufficient_balance The account does not have enough tokens. Add tokens in the app, or choose a cheaper model or settings.
402 max_cost_exceeded The price is above your own max_cost. Raise max_cost or change the request.
403 spending_not_authorized No limit covers this model and project. Ask the owner to allow spending at manage_url.
403 spending_limit_changed The limit is paused, revoked or expired. Ask the owner to review it at manage_url.

Spending limits and balances never answer 429. Retrying does not help; show the manage_url to the account owner instead.