0.10.0 • Published 2 days ago

@fal-ai/serverless-client v0.10.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

fal.ai JavaScript/TypeScript client library

@fal-ai/serverless-client npm package

Introduction

The fal.ai JavaScript Client Library provides a seamless way to interact with fal serverless functions from your JavaScript or TypeScript applications. With built-in support for various platforms, it ensures consistent behavior across web, Node.js, and React Native environments.

Getting started

Before diving into the client-specific features, ensure you've set up your credentials:

import * as fal from '@fal-ai/serverless-client';

fal.config({
  // Can also be auto-configured using environment variables:
  // Either a single FAL_KEY or a combination of FAL_KEY_ID and FAL_KEY_SECRET
  credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
});

Note: Ensure you've reviewed the fal.ai getting started guide to acquire your credentials and register your functions. Also, make sure your credentials are always protected. See the ../proxy package for a secure way to use the client in client-side applications.

Running functions with fal.run

The fal.run method is the simplest way to execute a function. It returns a promise that resolves to the function's result:

const result = await fal.run('my-function-id', {
  input: { foo: 'bar' },
});

Long-running functions with fal.subscribe

The fal.subscribe method offers a powerful way to rely on the queue system to execute long-running functions. It returns the result once it's done like any other async function, so your don't have to deal with queue status updates yourself. However, it does support queue events, in case you want to listen and react to them:

const result = await fal.subscribe('my-function-id', {
  input: { foo: 'bar' },
  onQueueUpdate(update) {
    if (update.status === 'IN_QUEUE') {
      console.log(`Your position in the queue is ${update.position}`);
    }
  },
});

More features

The client library offers a plethora of features designed to simplify your serverless journey with fal.ai. Dive into the official documentation for a comprehensive guide.

0.10.0

2 days ago

0.9.3-alpha.0

24 days ago

0.9.3

24 days ago

0.9.2

25 days ago

0.9.2-alpha.2

25 days ago

0.9.2-alpha.1

1 month ago

0.9.2-alpha.0

1 month ago

0.9.1

1 month ago

0.9.1-alpha.1

1 month ago

0.9.1-alpha.0

1 month ago

0.9.0

2 months ago

0.9.0-alpha.1

2 months ago

0.8.6

2 months ago

0.8.6-alpha.1

2 months ago

0.8.6-alpha.0

2 months ago

0.8.5

3 months ago

0.8.5-alpha.0

3 months ago

0.8.4

3 months ago

0.8.4-alpha.0

3 months ago

0.8.4-alpha.1

3 months ago

0.8.3-alpha.0

3 months ago

0.8.3

3 months ago

0.8.1

4 months ago

0.8.0

4 months ago

0.8.2

4 months ago

0.7.4

5 months ago

0.7.4-alpha.0

5 months ago

0.7.4-alpha.1

5 months ago

0.7.3

5 months ago

0.7.3-alpha.0

5 months ago

0.7.3-alpha.1

5 months ago

0.7.2

5 months ago

0.7.1

5 months ago

0.7.1-alpha.0

5 months ago

0.7.0

5 months ago

0.6.0-alpha.1

6 months ago

0.6.0-alpha.2

6 months ago

0.6.0-alpha.0

6 months ago

0.6.1-alpha.0

5 months ago

0.6.1-alpha.1

5 months ago

0.6.1-alpha.4

5 months ago

0.6.1-alpha.5

5 months ago

0.6.1-alpha.2

5 months ago

0.6.1-alpha.3

5 months ago

0.6.1-alpha.6

5 months ago

0.6.0-alpha.3

6 months ago

0.6.0-alpha.4

6 months ago

0.5.0-alpha.0

6 months ago

0.7.0-alpha.1

5 months ago

0.7.0-alpha.0

5 months ago

0.7.0-alpha.3

5 months ago

0.7.0-alpha.2

5 months ago

0.7.0-alpha.5

5 months ago

0.3.0

7 months ago

0.2.1

8 months ago

0.7.0-alpha.4

5 months ago

0.2.0

8 months ago

0.7.0-alpha.7

5 months ago

0.7.0-alpha.6

5 months ago

0.5.4

6 months ago

0.5.3

6 months ago

0.5.0

6 months ago

0.4.1

7 months ago

0.3.2

7 months ago

0.4.0

7 months ago

0.3.1

7 months ago

0.6.1

5 months ago

0.5.2

6 months ago

0.6.0

5 months ago

0.5.1

6 months ago

0.4.2

6 months ago

0.1.0

1 year ago