Skip to content

Preview: contracts not deployed on Elysium yet. Wallet connect works; no balances or transactions.

Cerebra
Documentation

API balance

Your balance is a USD amount held by the gateway, credited from on-chain deposits and spent per token.

How balance is credited

The gateway runs an indexer that reads Deposited events from the Billing contract after a safe number of confirmations. Each event is applied exactly once, keyed by its deposit id, so restarts and reorg handling cannot double-credit.

How balance is spent

Every request follows the same three steps, so you are only ever charged for tokens that were actually used.

StepWhat happens
ReserveThe worst-case cost (prompt estimate plus max_tokens) is set aside from your balance.
SettleWhen the provider reports usage, the exact cost is charged.
RefundThe unused part of the reservation returns to your balance immediately.

If the reservation is larger than your balance or your max_cost, the gateway lowers max_tokens to fit rather than rejecting the request. A request is refused only when even a single output token cannot be afforded.

Spend caps

Send max_cost in the request body (or the x-max-cost header) to cap what a single call can cost in USD. This is useful for agents and untrusted prompts. See the reference.

Transparency

Every response includes usage.cost and the headers x-cerebra-cost and x-cerebra-balance. GET /v1/usage lists recent requests with token counts and exact cost, and the dashboard shows the same history.

Balances are not withdrawable

An API balance can only be spent on inference. Deposits are final once the transaction confirms. Only deposit what you plan to use.