Skip to main content
The Vidgen API uses limits to keep the queue fair. Limits attach to the account, not to the API key — creating three keys does not triple your allowance.

Numbers at a glance

Concurrent process limit

This is only enforced for Unlimited quota usage. If your account pays per credit, you may have more than two active jobs — with the consequence of a longer queue.
The correct pattern: do not fire requests and hope. Check first, or handle 429 as a rescheduling signal.

Daily video quota

It counts videos that succeeded. Failed jobs do not consume quota.
Read dailyVideosRemaining from GET /api/v1/user/credits before sending a batch so that no request dies partway through. The reset uses WIB time, not UTC.

Queue and job lifetime

Every job goes through queued → dispatching → processing → a final status. If a worker dies or the upstream service stalls, the job is not left hanging:
  • After 2 hours, a job is considered stale, marked failed, and its credits are refunded.
  • A job that needs to be picked up again goes through a tolerance window before being dispatched again.
For that reason, do not poll one job for more than 2 hours. After that, treat it as finished (failed) and send a new request.
1

Start at 5 seconds

Fetch the first status 5 seconds after the 202.
2

Increase gradually

Grow the interval exponentially up to a 30 second ceiling (5, 8, 12, 20, 30, 30, ...). This is enough because videos usually mature within minutes.
3

Stop at the end

As soon as it is succeeded or failed, stop polling and store the result.
4

Cap the total age

Stop your own polling at 2 hours. The server closes the job at the same point.
wait_for_job.js

Backoff when you hit 429

In Vidgen, 429 means “capacity”, not “you are blocked”. Wait, then retry:
  • If there is a Retry-After header (only on POST /api/v1/upload), honor its value in seconds.
  • For a 429 without the header, wait 30 seconds, then double the wait on each attempt, up to 5 attempts.
  • If the last attempt still fails, defer the job to the next window and tell the end user.
Retrying POST /api/v1/generate without an idempotencyKey can create two jobs and two charges. Read Idempotency first.