Skip to content
Docs menu

Step 5: balance and cost

Step 5 of 8

Look before you spend, and total what you spent.

Calls spend PLUMES. A product should look before it spends. usage is free and works even at a zero balance.

balance = catalyst.usage.get().plumes.remaining
if balance <= 0:
    raise SystemExit("No plumes left.")
spent = sounds.usage.plumes + song.usage.plumes         # every Generation knows its cost

A failed call costs nothing, and a fal_test_ key never spends your balance.

Checkpoint (M3): with a zero balance the program stops before spending, with a clear message.