aisdk / black-forest-labs
Official Black Forest Labs provider for the PHP AI SDK.
Fund package maintenance!
v0.8.1
2026-07-22 06:41 UTC
Requires
- php: ^8.3
- aisdk/core: ^0.8.0
Requires (Dev)
- laravel/pint: ^1.18
- nyholm/psr7: ^1.8
- pestphp/pest: ^3.0 || ^4.0
- phpstan/phpstan: ^2.0
README
Official Black Forest Labs provider for the PHP AI SDK. Uses BFL's native FLUX image-generation API.
Installation
composer require aisdk/black-forest-labs
Basic Usage
use AiSdk\BlackForestLabs; use AiSdk\Generate; BlackForestLabs::create(['apiKey' => $_ENV['BFL_API_KEY']]); $image = Generate::image('A cinematic mountain lake at sunrise') ->model(BlackForestLabs::model('flux-2-pro-preview')) ->size('1440x810') ->run();
Configuration
| Variable | Description | Default |
|---|---|---|
BFL_API_KEY |
API key for authentication | Required |
BFL_BASE_URL |
Base URL for API requests | https://api.bfl.ai/v1 |
Supported Capabilities
| Capability | Support |
|---|---|
| Text-to-image generation | Native |
| Async job polling | Native |
The provider submits a native FLUX request, polls BFL's returned polling_url, and returns the signed image URL. Use providerOptions('blackforestlabs', ['raw' => [...]]) for documented BFL image fields outside the portable SDK surface.