Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strange-flies-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/fal': patch
---

feat (@ai-sdk/fal): support new Flux Kontext models
38 changes: 29 additions & 9 deletions content/providers/01-ai-sdk-providers/10-fal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,17 @@ console.log(`Image saved to ${filename}`);

Fal offers many models optimized for different use cases. Here are a few popular examples. For a full list of models, see the [Fal AI documentation](https://fal.ai/models).

| Model | Description |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `fal-ai/fast-sdxl` | High-speed SDXL model optimized for quick inference with up to 4x faster speeds |
| `fal-ai/flux-lora` | Super fast endpoint for the FLUX.1 [dev] model with LoRA support, enabling rapid and high-quality image generation using pre-trained LoRA adaptations. |
| `fal-ai/flux-pro/v1.1-ultra` | Professional-grade image generation with up to 2K resolution and enhanced photorealism |
| `fal-ai/ideogram/v2` | Specialized for high-quality posters and logos with exceptional typography handling |
| `fal-ai/recraft-v3` | SOTA in image generation with vector art and brand style capabilities |
| `fal-ai/stable-diffusion-3.5-large` | Advanced MMDiT model with improved typography and complex prompt understanding |
| `fal-ai/hyper-sdxl` | Performance-optimized SDXL variant with enhanced creative capabilities |
| Model | Description |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fal-ai/fast-sdxl` | High-speed SDXL model optimized for quick inference with up to 4x faster speeds |
| `fal-ai/flux-pro/kontext` | FLUX.1 Kontext [pro] handles both text and reference images as inputs, seamlessly enabling targeted, local edits and complex transformations of entire scenes |
| `fal-ai/flux-pro/kontext/max` | FLUX.1 Kontext [max] with greatly improved prompt adherence and typography generation, meeting premium consistency for editing without compromise on speed |
| `fal-ai/flux-lora` | Super fast endpoint for the FLUX.1 [dev] model with LoRA support, enabling rapid and high-quality image generation using pre-trained LoRA adaptations. |
| `fal-ai/flux-pro/v1.1-ultra` | Professional-grade image generation with up to 2K resolution and enhanced photorealism |
| `fal-ai/ideogram/v2` | Specialized for high-quality posters and logos with exceptional typography handling |
| `fal-ai/recraft-v3` | SOTA in image generation with vector art and brand style capabilities |
| `fal-ai/stable-diffusion-3.5-large` | Advanced MMDiT model with improved typography and complex prompt understanding |
| `fal-ai/hyper-sdxl` | Performance-optimized SDXL variant with enhanced creative capabilities |

Fal models support the following aspect ratios:

Expand All @@ -123,6 +125,24 @@ Key features of Fal models include:
- Cost-effective scaling with pay-per-use pricing
- LoRA training capabilities for model personalization

#### Modify Image

Transform existing images using text prompts.

```ts
// Example: Modify existing image
await generateImage({
model: fal.image('fal-ai/flux-pro/kontext'),
prompt: 'Put a donut next to the flour.',
providerOptions: {
fal: {
image_url:
'https://v3.fal.media/files/rabbit/rmgBxhwGYb2d3pl3x9sKf_output.png',
},
},
});
```

### Advanced Features

Fal's platform offers several advanced capabilities:
Expand Down
20 changes: 20 additions & 0 deletions examples/ai-core/src/generate-image/fal-kontext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { fal } from '@ai-sdk/fal';
import { experimental_generateImage as generateImage } from 'ai';
import { presentImages } from '../lib/present-image';
import 'dotenv/config';

async function main() {
const { images } = await generateImage({
model: fal.image('fal-ai/flux-pro/kontext/max'),
prompt: 'Put a donut next to the flour.',
providerOptions: {
fal: {
image_url:
'https://v3.fal.media/files/rabbit/rmgBxhwGYb2d3pl3x9sKf_output.png',
},
},
});
await presentImages(images);
}

main().catch(console.error);
2 changes: 2 additions & 0 deletions packages/fal/src/fal-image-settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// https://fal.ai/models
export type FalImageModelId =
| 'fal-ai/flux-pro/kontext/max'
| 'fal-ai/flux-pro/kontext'
| 'fal-ai/aura-flow'
| 'fal-ai/aura-sr'
| 'fal-ai/bria/eraser'
Expand Down
Loading