Overview
FalImageGenService provides high-speed image generation capabilities using fal’s optimized Stable Diffusion XL models. It supports various image sizes, formats, and generation parameters with a focus on fast inference and low-latency image creation.
Fal Image Gen API Reference
Pipecat’s API methods for fal image generation integration
Example Implementation
Browse examples using fal image generation
fal Documentation
Official fal API documentation and model guides
fal Platform
Access fast SDXL models and manage API keys
Installation
To use fal image generation services, install the required dependencies:Prerequisites
fal Account Setup
Before using fal image generation services, you need:- fal Account: Sign up at fal Platform
- API Key: Generate an API key from your account dashboard
- Model Selection: Choose from available fast SDXL models
- HTTP Session: Configure aiohttp session for image downloading
Required Environment Variables
FAL_KEY: Your fal API key for authentication
Configuration
Input parameters for image generation configuration. Deprecated in v0.0.105.
Use
settings=FalImageGenService.Settings(...) instead.HTTP client session for downloading generated images.
The fal model to use for image generation. Deprecated in v0.0.105. Use
settings=FalImageGenService.Settings(model=...) instead.Optional API key for fal. If provided, sets the
FAL_KEY environment
variable.Runtime-configurable generation settings. See Settings below.
Settings
Runtime-configurable settings passed via thesettings constructor argument using FalImageGenService.Settings(...). See Service Settings for details.
| Parameter | Type | Default | Description |
|---|---|---|---|
model | str | NOT_GIVEN | Fal model identifier. (Inherited from base settings.) |
seed | int | None | NOT_GIVEN | Random seed for reproducible generation. If None, uses a random seed. |
num_inference_steps | int | NOT_GIVEN | Number of inference steps for generation. |
num_images | int | NOT_GIVEN | Number of images to generate. |
image_size | str | dict | NOT_GIVEN | Image dimensions as a string preset or dict with width/height keys. |
expand_prompt | bool | NOT_GIVEN | Whether to automatically expand/enhance the prompt. |
enable_safety_checker | bool | NOT_GIVEN | Whether to enable content safety filtering. |
format | str | NOT_GIVEN | Output image format. |
NOT_GIVEN values are omitted from the request, letting the service use its
own defaults ("fal-ai/fast-sdxl" for model, 8 for num_inference_steps,
"square_hd" for image_size, etc.). Only parameters that are explicitly set
are included.Usage
Basic Setup
With Custom Settings
Notes
- Environment variable: If the
keyconstructor parameter is provided, it sets theFAL_KEYenvironment variable automatically. - HTTP session required: You must provide an
aiohttp.ClientSessionfor downloading the generated images from fal’s URLs. - Image size presets: The
image_sizeparameter accepts string presets (e.g.,"square_hd","landscape_16_9") or a dictionary with explicitwidthandheightvalues.