Skip to content
Install
vc i fal

Overview

Enable your app with AI inference with seamless integration with Next.js and Vercel. This integration makes the setup hassle-free and will get your Vercel app production-ready in no time.

Environment variables

This integration creates an API Key and sets it in the environment variables of your selected apps, named FAL_KEY. This will ensure your applications using the fal.ai clients can make calls while keeping your credentials safe.

Product

  • fal

    Run AI models at scale

    Prepaid plan

Instructions

Some extra components make Vercel + fal.ai integration even easier.

import { fal } from '@ai-sdk/fal';
import { experimental_generateImage as generateImage } from 'ai';
import fs from 'fs';

async function main() {
  const { image } = await generateImage({
    model: fal.image('fal-ai/fast-sdxl'),
    prompt: 'A serene mountain landscape at sunset with purple and orange sky, reflections in a calm lake',
  });

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

main().catch(console.error);