fal is a serverless Python runtime that lets you run and scale code in the cloud with no infra management.
With fal, you can build pipelines, serve ML models and scale them up to many users. You scale down to 0 when you don't use any resources.
This repository contains the main Python packages for building on fal:
fal(inprojects/fal): define, test, and deploy serverless apps on falfal-client(inprojects/fal_client): call fal model APIs or your deployed endpoints from Python
For full product and platform documentation, see fal.ai/docs.
The fal package includes the Python SDK and CLI for building serverless apps, testing them with temporary URLs, and deploying them to production.
pip install fal
fal auth loginCreate a minimal app:
import fal
class MyApp(fal.App):
@fal.endpoint("/")
def run(self) -> dict:
return {"message": "Hello, World!"}Run it on fal for testing:
fal run hello_world.py::MyAppDeploy it to a persistent endpoint:
fal deploy hello_world.py::MyAppDocs:
The fal-client package is the simplest way to call model APIs on fal from Python.
pip install fal-client
export FAL_KEY="your-api-key"Call a model:
import fal_client
result = fal_client.subscribe(
"fal-ai/flux/schnell",
arguments={
"prompt": "a futuristic cityscape at sunset",
"image_size": "landscape_16_9",
},
)
print(result["images"][0]["url"])You can also use fal-client to call your own deployed fal apps by passing your endpoint ID instead of a model ID.
Docs:
From the repository root:
pip install -e 'projects/fal[dev]'
pip install -e 'projects/fal_client[dev]'
pip install -e 'projects/isolate_proto[dev]'