fal package provides decorators and utilities for building serverless AI applications.
Installation
Quick Start
API Reference
fal
App class, decorators (endpoint, realtime, function, cached), HealthCheck, ContainerImagefal.api
SyncServerlessClient: manage apps, runners, keys, secrets, and deploy programmaticallyfal.toolkit
File types (
Image, Video, Audio), KVStore, model downloads, GPU utilitiesfal.exceptions
Exception classes for error handling
CLI
fal deploy, fal apps, fal runners, fal keys, fal secrets, and moreKey Decorators
| Decorator | Description |
|---|---|
@fal.endpoint(path) | Define an HTTP endpoint on an App |
@fal.realtime(path) | WebSocket endpoint for realtime applications |
@fal.function(...) | Create a standalone serverless function |
@fal.cached | Cache function results in-memory |
App Configuration
Configure your app using class variables. See the full App reference for all options.| Property | Description |
|---|---|
machine_type | GPU type: "GPU", "A100", or list for fallback |
requirements | Pip packages to install (e.g., ["torch>=2.0"]) |
num_gpus | Number of GPUs to allocate |
min_concurrency | Minimum warm instances (1+ to avoid cold starts) |
max_concurrency | Maximum instances to scale to |
request_timeout | Maximum seconds per request |
startup_timeout | Maximum seconds for setup |
app_auth | Auth mode: "private", "public", or "shared" |
app_files | Files/directories to include in deployment |
image | Custom ContainerImage for the application |
Toolkit Highlights
The fal.toolkit module provides utilities for common tasks:| Utility | Description |
|---|---|
Image, Video, Audio | File types with automatic CDN upload |
KVStore | Persistent key-value storage |
download_model_weights() | Download and cache model weights |
clone_repository() | Clone git repositories |
sync_dir() | Sync local directories to remote storage |
get_gpu_type() | Detect current GPU type |