Skip to main content

Balance and deductions

Balance system

  • Your account has a balance (e.g. in USD or platform currency).
  • You add funds through the dashboard (payment methods and top-up flows).
  • Inference and training consume this balance; each successful request is charged and the balance is reduced.

How deductions work

  1. When you call inference or the Agent, the platform:
    • Validates your API key.
    • Checks that your balance is sufficient (using an estimate or actual cost).
    • If sufficient: runs the request, computes usage (tokens), and deducts the cost from your balance.
    • If insufficient: returns 402 Payment Required and does not run the request or deduct.
  2. For training, the job may be accepted and then charged when it runs or when it completes, depending on platform behavior. Insufficient balance can prevent the job from starting or cause it to fail.
  3. Failed requests (invalid input, 4xx, 5xx) are not charged. Only successful completions are deducted.

402 Payment Required

When the API returns 402:
  • Meaning — Your balance is too low for this request (or estimated cost).
  • Response — JSON with an error such as Insufficient balance. Please add funds to your account.
  • What to do — Add funds in the dashboard, then retry. In your app, show a clear message (e.g. “Add funds”) and link to billing.

Best practices

  • Monitor balance — Use the dashboard or usage API to track spend and set alerts if available.
  • Handle 402 — In code, treat 402 as a billing issue: prompt the user to add funds and do not retry the same request until balance is updated.
  • Estimate before batch — For large batch jobs, check balance or use cost-estimate endpoints first so you don’t start a job that will fail mid-way.