Budget allocation

Calls drain the project budget, not the wallet directly. Allocation moves micro-credits from the wallet into a project's budget.

The two numbers

The dashboard's balance card shows two figures per project:

  • Wallet balance — micro-credits held at the tenant level. Not directly spendable by API calls.
  • Project budget — micro-credits allocated to this project from the wallet. Drained by biofrq.* calls.

Allocating

From the dashboard's project detail pane, Allocate moves N micro-credits from the wallet to a project's budget. The operation writes one Allocation ledger entry on the project and a linked Allocation entry on the wallet (negative delta). The two rows share a LinkedLedgerId so the Money Audit can render them as a single transaction.

When a project runs out

Calls against an empty project return PAYMENT_REQUIRED (HTTP 402). The call is not billed.

To recover, allocate more to the project from the wallet.

Spend ledger row per call

Every billable call writes a Usage ledger entry on the project with a negative DeltaMicroCredits. Per-action prices are master-data, editable without a code release.

Reconciliation

At any point in time:

  • Project budget = sum(Allocation deltas on this project) + sum(Usage deltas) + sum(Refund deltas) + sum(Adjustment deltas).
  • Wallet balance = sum(Topup deltas) + sum(Bonus deltas) + sum(wallet-side Allocation deltas).

The dashboard's Money Audit tab shows both ledgers.

What's next