Documentation
Quickstart with fal

Quickstart with fal

In this example, we'll be using one of our most popular model endpoints (opens in a new tab). This model endpoint can handle a wide range of Stable Diffusion models, including SD fine tunes, SDXL and LORAs.

Before we proceed, you need to create an API key (opens in a new tab).

This key will be used to authenticate your requests to the fal API.

npm install --save @fal-ai/serverless-client
fal.config({
  credentials: "PASTE_YOUR_FAL_KEY_HERE",
});

Now you can call our Model API endpoint using the fal client:

import * as fal from "@fal-ai/serverless-client";
 
const result = await fal.subscribe("fal-ai/lora", {
  input: {
    model_name: "stabilityai/stable-diffusion-xl-base-1.0",
    prompt:
      "Photo of a rhino dressed suit and tie sitting at a table in a bar with a bar stools, award winning photography, Elke vogelsang",
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});

We have made other popular models such as SDXL Finetunes, Stable Video Diffusion, ControlNets, Whisper and more available as ready-to-use APIs so that you can easily integrate them into your applications.

Check out our Model Playgrounds (opens in a new tab) to tinker with these models and let us know on our Discord (opens in a new tab) if you want to see other ones listed.

Once you find a model that you want to use, you can grab its URL from the “API” tab. The API tab provides some important information about the model including its source code and examples of how you can call it.


2023 © Features and Labels Inc.