Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/phpaisdk/fal/llms.txt

Use this file to discover all available pages before exploring further.

The fal provider (aisdk/fal) brings fal.ai models into the PHP AI SDK ecosystem. With a single Composer package you can generate images, synthesize speech, transcribe audio, and produce AI video — all through a consistent, type-safe PHP API aligned with @ai-sdk/fal.

Installation

Add the package via Composer and set your API key in under a minute.

Quickstart

Generate your first image, speech clip, or video in a few lines of PHP.

Configuration

Customize the base URL, headers, and poll timeouts to fit your environment.

Model Reference

Explore image, speech, transcription, and video model details and options.

What you can build

Image Generation

Generate images from text prompts using models like fal-ai/flux/schnell. Control size, aspect ratio, seed, and count.

Text-to-Speech

Synthesize natural speech with models such as fal-ai/minimax/speech-02-hd. Returns raw audio bytes ready to stream or save.

Audio Transcription

Transcribe audio files or URLs to text. Supports both remote URLs and data URIs for inline audio.

Video Generation

Queue async video generation jobs via queue.fal.run with configurable polling intervals and timeouts.

Quick look

quickstart.php
use AiSdk\Generate;
use AiSdk\Fal;

// Configure once — reads FAL_API_KEY from the environment
Fal::create(['apiKey' => getenv('FAL_API_KEY')]);

// Generate an image
$result = Generate::image()
    ->model(Fal::model('fal-ai/flux/schnell'))
    ->prompt('A minimal desk lamp on a white background.')
    ->run();

echo $result->images[0]->url;
1

Install via Composer

composer require aisdk/fal
2

Set your API key

export FAL_API_KEY=your_fal_api_key
3

Generate your first asset

Call Generate::image(), Generate::speech(), Generate::transcription(), or Generate::video() with a fal model ID.
Language and embedding modalities are not implemented for fal in this package and will throw a NoSuchModelException if called.

Build docs developers (and LLMs) love