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.

FalProvider (class AiSdk\Fal\FalProvider) is the concrete provider class that implements ImageProviderInterface, SpeechProviderInterface, TranscriptionProviderInterface, and VideoProviderInterface. Obtain one via Fal::create() or Fal::default().

Constructor

public function __construct(FalOptions $options)
options
FalOptions
required
A FalOptions instance holding the API key, base URL, headers, and poll timeouts. Normally not called directly — use Fal::create() which builds the FalOptions object for you.

Methods

name()

Returns the provider name string used to identify this provider.
public function name(): string
return
string
Always returns 'fal'.

Model dispatch methods

FalProvider exposes four protected model factory methods that are invoked automatically by the BaseProvider dispatch mechanism when you call Fal::model() or pass a model ID to a generation helper such as Generate::image()->model(...). You do not call these methods directly.
MethodVisibilityReturn typeTriggered by
imageModel(string $modelId)protectedImageModelInterfaceGenerate::image() context
speechModel(string $modelId)protectedSpeechModelInterfaceGenerate::speech() context
transcriptionModel(string $modelId)protectedTranscriptionModelInterfaceGenerate::transcription() context
videoModel(string $modelId)protectedVideoModelInterfaceGenerate::video() context
The correct public usage pattern is through Fal::model() or the generation helpers:
use AiSdk\Fal;
use AiSdk\Generate;

// Image generation — BaseProvider internally calls imageModel()
$result = Generate::image()
    ->model(Fal::model('fal-ai/flux/schnell'))
    ->prompt('A minimal desk lamp.')
    ->run();

// Speech generation — BaseProvider internally calls speechModel()
Generate::speech()
    ->model(Fal::model('fal-ai/minimax/speech-02-hd'))
    ->input('Hello world')
    ->run();

Example

use AiSdk\Fal;
use AiSdk\Generate;

$provider = Fal::create(['apiKey' => getenv('FAL_API_KEY')]);

// Use Fal::model() to obtain a model — provider dispatch is automatic
$result = Generate::image()
    ->model(Fal::model('fal-ai/flux/schnell'))
    ->prompt('A neon-lit Tokyo alleyway at night.')
    ->run();
Attempting to use an unsupported modality (e.g. language model or embedding) will throw NoSuchModelException from aisdk/core — fal.ai does not offer those modalities through this package.

Implemented Interfaces

FalProvider extends BaseProvider and fulfils the following contracts:
InterfaceProtected methodReturn type
ImageProviderInterfaceimageModel(string $modelId)ImageModelInterface
SpeechProviderInterfacespeechModel(string $modelId)SpeechModelInterface
TranscriptionProviderInterfacetranscriptionModel(string $modelId)TranscriptionModelInterface
VideoProviderInterfacevideoModel(string $modelId)VideoModelInterface

Build docs developers (and LLMs) love