Skip to main content

Classes & Interfaces

FalClient

interface FalClient
The main client type, it provides access to simple API model usage, as well as access to the queue and storage APIs.

Properties

NameTypeDescription
queueQueueClientThe queue client to interact with the queue API.
realtimeRealtimeClientThe realtime client to interact with the realtime API and receive updates in real-time.
storageStorageClientThe storage client to interact with the storage API.
streamingStreamingClientThe streaming client to interact with the streaming API.
streamStreamingClient["stream"]Calls a fal app that supports streaming and provides a streaming-capable object as a result, that can be used to get partial results through either AsyncIterator or through an event listener.

Methods

run

run(endpointId: Id, options: RunOptions<InputType<Id>>): Promise<Result<OutputType<Id>>>
Runs a fal endpoint identified by its endpointId.
ParameterTypeDescription
endpointIdIdThe endpoint id, e.g. fal-ai/fast-sdxl.
optionsRunOptions<InputType<Id>>The request options, including the input payload.
Returns: Promise<Result<OutputType<Id>>>

subscribe

subscribe(endpointId: Id, options: RunOptions<InputType<Id>> & QueueSubscribeOptions): Promise<Result<OutputType<Id>>>
Subscribes to updates for a specific request in the queue.
ParameterTypeDescription
endpointIdId- The ID of the API endpoint.
optionsRunOptions<InputType<Id>> & QueueSubscribeOptions- Options to configure how the request is run and how updates are received.
Returns: Promise<Result<OutputType<Id>>>

Functions

createFalClient

function createFalClient(userConfig?: Config): FalClient
Creates a new reference of the FalClient.
ParameterTypeDescription
userConfigConfigOptional configuration to override the default settings.
Returns: FalClient