@ai-sdk/fal
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

AI SDK - fal Provider

The fal provider for the AI SDK contains image model support for the fal.ai API.

Setup

The fal provider is available in the @ai-sdk/fal module. You can install it with

npm i @ai-sdk/fal

Provider Instance

You can import the default provider instance fal from @ai-sdk/fal:

import { fal } from '@ai-sdk/fal';

Image Generation Example

import { fal } from '@ai-sdk/fal';
import { experimental_generateImage as generateImage } from 'ai';
import fs from 'fs';
const { image } = await generateImage({
  model: fal.image('fal-ai/flux/schnell'),
  prompt: 'A cat wearing a intricate robe',
});

const filename = `image-${Date.now()}.png`;
fs.writeFileSync(filename, image.uint8Array);
console.log(`Image saved to ${filename}`);

Additional Options

If you want to pass additional inputs to the model besides the prompt, use the providerOptions.fal property:

const { image } = await generateImage({
  model: fal.image('fal-ai/recraft-v3'),
  prompt: 'A cat wearing a intricate robe',
  size: '1920x1080',
  providerOptions: {
    fal: {
      style: 'digital_illustration',
    },
  },
});

Documentation

Please check out the fal provider for more information.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.101,152latest
1.0.0-canary.1339canary

Version History

VersionDownloads (Last 7 Days)Published
1.0.0-canary.1339
1.0.0-canary.1251
1.0.0-canary.1149
1.0.0-canary.1051
1.0.0-canary.944
0.1.101,152
1.0.0-canary.810
0.1.9217
1.0.0-canary.72
0.1.8342
1.0.0-canary.62
1.0.0-canary.52
1.0.0-canary.42
1.0.0-canary.33
0.1.710
0.1.626
1.0.0-canary.22
1.0.0-canary.13
0.1.531
1.0.0-canary.02
0.1.464
0.1.33
0.1.29
0.1.130
0.1.02
0.0.1110
0.0.101
0.0.929
0.0.80
0.0.720
0.0.665
0.0.50
0.0.40
0.0.30
0.0.21
0.0.11

Package Sidebar

Install

npm i @ai-sdk/fal

Weekly Downloads

2,275

Version

0.1.10

License

Apache-2.0

Unpacked Size

96.7 kB

Total Files

10

Last publish

Collaborators

  • jaredpalmer
  • vercel-release-bot