velobase-billing package wraps the Velobase control-plane: customer
deposits, balances, ledgers, and the freeze / consume / deduct primitives.
The SDK is for the billing control-plane. To make model calls, point the
OpenAI SDK at the gateway, see
OpenAI-Compatible Gateway.
Install
Initialize
AsyncVelobase with the same methods.
Deposit credits to a customer
State the amount with an explicit unit.amount_usd is the least error-prone.
idempotency_key so a retry never double-credits (use your payment event
id in production):
amount= (cents) is still accepted for backward compatibility, but prefer the
explicit amount_usd / amount_cents / amount_credits so the unit is clear.Read a balance
get() returns the customer with their wallets, each broken down by source:
Read the ledger
Billing primitives
For metering work you price yourself (not model calls, which bill automatically), use freeze → consume for unknown-cost work, or deduct for fixed-cost work.Errors
All failures raise aVelobaseError subclass (AuthenticationError,
NotFoundError, ConflictError, ValidationError, InternalError), each
carrying the server request_id. See Errors.