Behaviour
Rate limits
Credits cap what a key can spend; these cap how fast. They are generous for a script or an agent and tight enough that a leaked key cannot empty a balance before you notice.
Budgets
| What | Limit | Window | Counted |
|---|---|---|---|
| Any request with a key | 300 | a minute | per key |
| Runs started (POST /images, POST /videos) | 30 | 10 minutes | per key |
| Runs started, API and web app together | 40 | 10 minutes | per account |
| Failed authentications | 30 | a minute | per IP address |
Over a budget the answer is 429 rate_limited with a Retry-After header in seconds, also in details.retryAfterSeconds. Nothing is charged for a refused request.
Runs in progress
An API call cannot start a run while the account already has 5 queued or running (runs started in the web app count too). It is refused with 429 too_many_running (and details.running, details.limit) until one finishes. A batch script should keep a pool of at most 5 and start the next run when a job turns final.