Video generation with fal.ai is asynchronous.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/fal/llms.txt
Use this file to discover all available pages before exploring further.
FalVideoModel submits a job to https://queue.fal.run/{modelId} and then polls response_url at a configurable interval until the video is ready or the timeout is exceeded. The SDK manages the entire polling loop inside run(), so your code only receives a VideoJob once the job has either succeeded or failed.
Basic Usage
How It Works
Video generation follows a two-step asynchronous flow:-
Submit —
generate()sends a POST tohttps://queue.fal.run/{modelId}with the request body. fal.ai queues the job and responds immediately with arequest_idand aresponse_url. AVideoJobwith statusQueuedis returned. -
Poll —
poll()sends a GET toresponse_urlon each tick. When the response contains avideo.url, the job transitions toSucceededand a completeVideoJobis returned with theVideoDatapopulated. While the video is still being rendered,poll()returns aVideoJobwith statusRunning.
generate() or poll() directly.
VideoJob Status Values
| Status | Meaning |
|---|---|
Queued | The job has been submitted and is waiting to be picked up by the fal.ai worker. |
Running | The worker has started generating the video; polling is ongoing. |
Succeeded | The video is ready; $job->video->url contains the download URL. |
Failed | An error occurred; $job->errorMessage describes the problem. |
Request Parameters
The following fields are sent as JSON toqueue.fal.run:
| Field | Type | Description |
|---|---|---|
prompt | string | The text prompt describing the video to generate. |
image_url | string (optional) | A URL to use as the first frame. Only included when $request->image is a URL source. |
$request->providerOptionsFor('fal') are merged into the body last.
Response
A completedVideoJob (status Succeeded) carries a video property of type VideoData:
url(string) — the publicly accessible URL of the generated video, taken fromvideo.urlin the fal.ai queue response.mimeType(string) — taken fromvideo.content_type; defaults tovideo/mp4when the API omits it.
Configuring Timeouts
UsevideoPollIntervalMs and videoPollTimeoutMs in the Fal::create() configuration array to tune how aggressively the SDK polls and how long it waits before giving up:
2,000 ms (2 seconds) for the interval and 300,000 ms (5 minutes) for the timeout.
