Initialize the provider with API credentials and optional configuration.
Configuration object. Must include apiKey.
If apiKey is missing or empty.
await provider.initialize({ apiKey: 'fal_xxx' });
Generate an image using the Fal.ai queue API.
Submits the generation task to the queue, then polls the status endpoint until the result is ready or the timeout is reached.
Image generation request with prompt and optional params.
The generated image result with URL(s).
If the provider is not initialized.
If the API returns an error or times out.
const result = await provider.generateImage({
modelId: 'fal-ai/flux/dev',
prompt: 'A serene Japanese garden in autumn',
n: 2,
});
List available Flux models on the Fal.ai platform.
Static list of known Fal.ai model identifiers.
Readonly providerOptional default
Image generation provider connecting to the Fal.ai serverless platform.
Implements the queue-based submit-then-poll pattern: a generation request returns a request ID immediately, and the provider polls the status endpoint until completion or timeout.
Implements
Example