diff --git a/.changeset/strange-flies-remember.md b/.changeset/strange-flies-remember.md new file mode 100644 index 000000000000..42892c8f8571 --- /dev/null +++ b/.changeset/strange-flies-remember.md @@ -0,0 +1,5 @@ +--- +'@ai-sdk/fal': patch +--- + +feat (@ai-sdk/fal): support new Flux Kontext models diff --git a/content/providers/01-ai-sdk-providers/10-fal.mdx b/content/providers/01-ai-sdk-providers/10-fal.mdx index 7766d385d2b7..859590c418cb 100644 --- a/content/providers/01-ai-sdk-providers/10-fal.mdx +++ b/content/providers/01-ai-sdk-providers/10-fal.mdx @@ -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: @@ -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: diff --git a/examples/ai-core/src/generate-image/fal-kontext.ts b/examples/ai-core/src/generate-image/fal-kontext.ts new file mode 100644 index 000000000000..510c66426f2f --- /dev/null +++ b/examples/ai-core/src/generate-image/fal-kontext.ts @@ -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); diff --git a/packages/fal/src/fal-image-settings.ts b/packages/fal/src/fal-image-settings.ts index 059f5c360b77..8507827c2de3 100644 --- a/packages/fal/src/fal-image-settings.ts +++ b/packages/fal/src/fal-image-settings.ts @@ -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'