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.
FalImageModel submits a synchronous POST request to {baseUrl}/{modelId} (defaulting to https://fal.run/{modelId}) and returns an ImageResponse containing one or more ImageData objects. Each ImageData exposes the url of the generated image and its mimeType. Because the request is synchronous, run() blocks until fal.ai has finished generating the image and returns the result in a single call.
Basic Usage
Request Parameters
The following fields are assembled into the JSON body sent to fal.ai. Standard request properties are mapped automatically; any extra fal-specific parameters can be forwarded via provider options.| Field | Type | Source | Description |
|---|---|---|---|
prompt | string | $request->prompt | The text prompt describing the image to generate. |
num_images | int | $request->count | Number of images to generate. |
image_size | string | $request->size | Desired image size (e.g. square_hd, landscape_4_3). Only sent when size is set. |
aspect_ratio | string | $request->aspectRatio | Desired aspect ratio (e.g. 16:9). Only sent when aspectRatio is set. |
seed | int | $request->seed | Seed for reproducible generation. Only sent when seed is not null. |
$request->providerOptionsFor('fal') are merged into the body last, so they can override or extend any of the above.
Response
generate() returns an ImageResponse with an images array of ImageData objects. Each element has:
url(string) — the publicly accessible URL of the generated image, taken fromimages[*].urlin the fal.ai response.mimeType(string) — taken fromimages[*].content_type; defaults toimage/pngwhen the API omits it.
An
InvalidResponseException is thrown when the API response contains an empty images array. This can happen if the model rejects the prompt or the request payload is malformed.Provider Options
Pass fal-specific parameters that are not part of the standard request interface usingproviderOptions(). These are merged into the request body and can override any automatically mapped field.
