Guides
How Billing Works

How Billing Works

Each inference task you run costs credits from the balance attached to your API key. The cost rules are simple:

  • You're charged only for successful tasks. When a task reaches success, its cost is deducted from your balance.
  • Failures and cancellations are free. Tasks that end in failed or cancelled don't cost anything.
  • Pricing is per model. Each model sets its own price per inference, so expensive models cost more per call.

Checking your balance

To see the current balance for the user or organization that owns your API key, call account.balance. The response includes your available balance, any free credits, accrued debt, and earnings from models you've published. Balance and other monetary fields come back as decimal strings rather than numbers: precision matters for money, and the string form preserves it exactly across the wire. Read them as strings and convert to your language's decimal type when you need to do arithmetic; parsing them as floats will introduce rounding error.

balance = client.account.balance()
print(balance.balance)  # e.g. "12.34"

Quoting a price before you run

If you want to know what a task will cost before creating it, ask the model with models.task_cost. Checking the quote first is a good habit, especially for higher-priced models or when you're running many tasks at scale; it keeps surprises out of your bill.

quote = client.models.task_cost("model_id_here")
print(quote.cost, quote.unit)  # e.g. "0.05 USD"

Where to learn more

This page covers only the API-side mechanics of inference billing. For pricing tiers, top-up flows, invoices, and other account-level payment topics, see the platform's payments documentation.