Provider budgets
What you'll find here
The pre-routing budget and quota check that gates whether Craik is allowed to dispatch a request to a configured model provider. This is the gate; the budget and quota view is the read-only operator display of the same information.
References only, never secrets.
Status records carry budget_ref and quota_ref strings that point at
external budget and quota systems. Concrete amounts, account ids, and
credentials never enter the routing decision payload.
Records
ProviderBudgetStatus
ProviderRoutingBudgetDecision
ProviderBudgetStatus
Non-secret budget and quota snapshot for one provider, prepared by the operator surface or an integration before routing is attempted.
provider_idbudget_refquota_refbudget_remainingquota_remainingblockedreasonProviderRoutingBudgetDecision
The structured allow-or-deny outcome produced by
provider_budget_decision(provider, status) and consumed by the
provider router.
allowedprovider_idreasonbudget_ref · quota_refbudget_remaining · quota_remainingDecision rules
A decision is always produced — never silently dropped.
provider_budget_decision returns a ProviderRoutingBudgetDecision in
every case. The provider router is expected to read allowed and
reason directly; there is no second channel for "no answer."
The check denies routing when any of the following is true, in order:
Status mismatch
status.provider_id does not equal the provider being routed.
Explicit block
status.blocked is set. The status reason is surfaced verbatim; absent reason falls back to "provider budget status is blocked."
Budget exhausted
budget_remaining is set and <= 0.
Quota exhausted
quota_remaining is set and <= 0.
Otherwise the decision is allowed with reason "provider budget and quota allow routing."
Absent remainders mean unknown, not unlimited.
budget_remaining=None and quota_remaining=None are treated as "no
signal" — the check does not block on them, but it also does not invent
a remaining amount. Integrations that want hard limits must populate
the value.