your-username/your-app-name, and all of the inference methods work identically whether you are calling a marketplace model or your own deployed app.
This page shows quick examples of each calling pattern. subscribe is the simplest option since it handles polling for you and blocks until the result is ready. For production workloads where you need to manage many requests in parallel, submit gives you full control over the request lifecycle. For full details on parameters, response shapes, status polling, and cancellation, see the Inference documentation.
Subscribe
Submits a request to the queue, polls automatically, and returns the result when ready. This is the simplest calling pattern since it handles the request lifecycle for you. Optionally receive progress updates via callbacks.- Python
- JavaScript
Synchronous Inference
Queue (Async)
For fire-and-forget workflows. Submit a request, get a request ID, and retrieve the result later by polling or webhook.- Python
- JavaScript
Asynchronous Inference
Streaming
For apps that produce progressive output via Server-Sent Events (SSE). Your app must define a streaming endpoint at/stream using @fal.endpoint("/stream").
- Python
- JavaScript
Building Streaming Endpoints
Streaming Inference
Real-Time (WebSocket)
For bidirectional, low-latency communication over a persistent connection. Your app must define a@fal.realtime("/realtime") endpoint.
- Python
- JavaScript
Building Realtime Endpoints
Real-Time Inference
Webhooks
Submit a request and receive the result at a URL you specify, instead of polling.- Python
- JavaScript
- cURL
POST to your webhook URL with the result:
Webhooks API
Passing Headers
You can pass custom headers with any calling method to control platform behavior:- Python
- JavaScript