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 Details

    • run

      <O> Output<O> run(String endpointId, RunOptions<O> options)
      Run the specified endpoint with the provided options. This method is only recommended for short-running operations. For long-running operations, consider using the subscribe(String, SubscribeOptions) method to subscribe to the endpoint's results via the queue or queue() 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

      <O> Output<O> subscribe(String endpointId, SubscribeOptions<O> options)
      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

      static FalClient withConfig(@Nonnull ClientConfig config)
      Create a new client instance with the provided configuration.
      Parameters:
      config - The client configuration.
      Returns:
      The new client instance.
    • withEnvCredentials

      static FalClient withEnvCredentials()
      Create a new client instance with the credentials resolved from the `FAL_KEY` environment variable.
      Returns:
      The new client instance.
    • withProxyUrl

      static FalClient withProxyUrl(@Nonnull String proxyUrl)
      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.