ModelsPricingAPI keys
  • Overview
  • Quickstart
  • Authentication
  • Errors and retries
  • Limits and billing
  • JavaScript client

Reference

Limits and billing

Two limits apply: a request rate per key and a number of jobs in flight per workspace. Jobs are paid from the workspace balance, in US dollars.

Request rate

Each key has a request budget per window. Every response says where you stand:

Headers
ratelimit-limit: 480
ratelimit-remaining: 479
ratelimit-reset: 60

Over the budget you get 429 rate_limited with retry-after. Reads have a larger budget than writes; one poll per job every few seconds stays far inside it.

Jobs in flight

A workspace may have only so many generation jobs queued or running at once. A submit past the cap is refused, not queued, and not charged: 429 queue_full, with your limits in details.generation_limits and a retry_after_seconds. Wait for a job to end, then submit the next; a worker pool sized to the limit keeps you under it.

429 Too Many Requests
{
  "error": {
    "code": "queue_full",
    "message": "Workspace generation queue is full. Wait for running jobs to complete before submitting more generation work.",
    "request_id": "req_0ee311b4334e4b118a94c7d1c48577fd",
    "category": "queue",
    "retryable": true,
    "retry_after_seconds": 30,
    "next_action": "retry_later"
  }
}

What a job costs

WhenWhat happens
You submitThe price is reserved from the workspace balance.
The job completesThe reservation is charged.
The job fails or is canceledThe reservation is refunded.

Each model row from the model endpoints carries its pricing; prices depend on quality, resolution and duration. The list prices are on API pricing, and every charge and refund shows up in Billing in the dashboard.

Running out of balance

A submit the balance cannot cover fails with 402 insufficient_credits and creates no job; a team workspace that has never been funded gets 402 organization_wallet_not_provisioned. With insufficient_credits, details says how much the request needed and how much was available, in dollars. Add funds in Billing; turning on auto top-up keeps long runs from stopping.

402 Payment Required
{
  "error": {
    "code": "insufficient_credits",
    "message": "Not enough credits for this request.",
    "request_id": "req_0ee311b4334e4b118a94c7d1c48577fd",
    "category": "quota",
    "retryable": false,
    "retry_after_seconds": null,
    "next_action": "add_funds",
    "details": {
      "required_usd": "0.29",
      "available_usd": "0.01"
    }
  }
}

Related

  • Errors and retries
  • Models
  • API pricing

On this page

  • Request rate
  • Jobs in flight
  • What a job costs
  • Running out of balance