Money fields
Every amount is an integer number of micro-USD, in a field whose name ends inMicroUsd. One US dollar is 1,000,000 micro-USD, so 42000 is USD 0.042.
Integers keep amounts exact; convert to dollars only for display.
A run’s billing
Every run has abilling object:
Billing states
While a run is
held, hold.state reports where it stands. It reports
facts, not a prediction of the charge:
For a
byok run, quotedMicroUsd is 0, heldMicroUsd is 0 while
held, and chargedMicroUsd is 0 once charged.
What’s charged
- The charge follows the work the provider actually reports, so it can differ from the quote. In rare cases, it can be higher than the quote.
- A failed output isn’t charged for its output, but a run is still charged for billable work that actually happened, such as accepting the request.
- Cancelling stops unfinished outputs. Outputs that a provider already finished are kept and charged.
Check the cost before you start
To see a cost before you start, request a quote withPOST /v1/runs/quote. It holds nothing. For details, see
Models in the API.
To cap a create, send maxCostMicroUsd. If the quote is higher, the create
fails with 402 cost_limit_exceeded and starts nothing. maxCostMicroUsd caps
the quote, not the final charge.
A create can also fail before it starts with these errors:
Read your balance
GET /v1/balance returns your organization’s funds. It needs the
account:read scope. Add projectId to include that project’s monthly budget.
A limit’s
limitMicroUsd can be null. If your organization’s balance isn’t
available, the response is 503 unavailable.
The balance is a point-in-time read. A run’s quote and admission decide whether
it can start.
In the app
ZeroGen’s app calls a run a generation, and shows a quote as the estimated cost before you generate. Settings › Billing shows the balance as Credit balance, Held, and Available to start, which matchbalanceMicroUsd, heldMicroUsd, and availableMicroUsd. Owners and Admins
add credits and set spend limits there. For details, see
Credits and billing and
Spend limits and budgets.