Package ai.fal.client
Interface FalClient
- All Known Implementing Classes:
FalClientImpl
public interface FalClient
The main client interface for interacting with the FAL APIs.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionqueue()
Get the queue client for interacting with the FAL queue.<O> Output
<O> run
(String endpointId, RunOptions<O> options) Run the specified endpoint with the provided options.<O> Output
<O> subscribe
(String endpointId, SubscribeOptions<O> options) Subscribe to the specified endpoint with the provided options.static FalClient
withConfig
(ClientConfig config) Create a new client instance with the provided configuration.static FalClient
Create a new client instance with the credentials resolved from the `FAL_KEY` environment variable.static FalClient
withProxyUrl
(String proxyUrl) Create a new client instance with the provided proxy URL.
-
Method Details
-
run
Run the specified endpoint with the provided options. This method is only recommended for short-running operations. For long-running operations, consider using thesubscribe(String, SubscribeOptions)
method to subscribe to the endpoint's results via the queue orqueue()
client for specific queue operations. .- Type Parameters:
O
- Output type.- Parameters:
endpointId
- The endpoint ID to run, e.g. `fal-ai/fast-sdxl`.options
- The run options.- Returns:
- The result of the operation.
-
subscribe
Subscribe to the specified endpoint with the provided options. This method is recommended for long-running operations. The subscription will return the result once the operation is completed.- Type Parameters:
O
- Output type.- Parameters:
endpointId
- The endpoint ID to subscribe to, e.g. `fal-ai/fast-sdxl`.options
- The subscribe options.- Returns:
- The result of the operation.
- See Also:
-
queue
QueueClient queue()Get the queue client for interacting with the FAL queue.- Returns:
- The queue client.
-
withConfig
Create a new client instance with the provided configuration.- Parameters:
config
- The client configuration.- Returns:
- The new client instance.
-
withEnvCredentials
Create a new client instance with the credentials resolved from the `FAL_KEY` environment variable.- Returns:
- The new client instance.
-
withProxyUrl
Create a new client instance with the provided proxy URL. With this configuration all requests will be proxied through the provided URL and the fal target url will be in a request header called `X-Fal-Target-Url`.- Parameters:
proxyUrl
- The proxy URL.- Returns:
- The new client instance.
-