Customize your input with more control.
Customize your input with more control.
Customize your input with more control.
Bagel is a 7B parameter multimodal model from ByteDance-Seed that can generate both text and images. This versatile model supports text-to-image generation, image-to-image editing, and image understanding capabilities through an intuitive API.
Getting up and running with Bagel takes just a few minutes. Here's everything you need to start generating content:
First, install your preferred client library:
For JavaScript/TypeScript:
bashnpm install --save @fal-ai/client
For Python:
bashpip install fal-client
Configure your authentication by setting up your API key:
JavaScript:
javascriptimport { fal } from "@fal-ai/client"; fal.config({ credentials: "YOUR_FAL_KEY_HERE" });
Python:
pythonfrom fal import client import os os.environ["FAL_KEY"] = "YOUR_FAL_KEY_HERE"
Generate images from text prompts:
JavaScript:
javascriptimport { fal } from "@fal-ai/client"; const result = await fal.subscribe("fal-ai/bagel", { input: { prompt: "A serene landscape with mountains at sunset" } }); console.log(result.image_url);
Python:
pythonfrom fal import client result = client.subscribe("fal-ai/bagel", { "prompt": "A serene landscape with mountains at sunset" }) print(result["image_url"])
Transform existing images with text prompts:
javascriptconst result = await fal.subscribe("fal-ai/bagel/edit", { input: { image_url: "https://example.com/your-image.jpg", prompt: "Transform this into a watercolor painting" } });
Extract structured information from images:
javascriptconst result = await fal.subscribe("fal-ai/bagel/understand", { input: { image_url: "https://example.com/your-image.jpg", prompt: "Describe the contents of this image" } });
javascripttry { const result = await fal.subscribe("fal-ai/bagel", { input: { prompt: "your prompt" } }); } catch (error) { console.error("Generation failed:", error.message); // Implement appropriate fallback behavior }
Bagel offers three main endpoints:
fal-ai/bagel - Text-to-image generationfal-ai/bagel/edit - Image-to-image editingfal-ai/bagel/understand - Image understanding and analysisFor image inputs, you can either provide URLs or upload files directly:
javascriptimport { fal } from "@fal-ai/client"; // Upload a local file const file = new File([imageData], "image.jpg", { type: "image/jpeg" }); const url = await fal.storage.upload(file); // Use the uploaded file const result = await fal.subscribe("fal-ai/bagel/edit", { input: { image_url: url, prompt: "Apply artistic style" } });
When integrating Bagel into your application:
For image inputs:
Common Issues and Solutions:
Authentication Errors:
Image Input Issues:
Generation Quality:
Bagel represents a significant advancement in multimodal AI, offering unified capabilities for both text and image tasks. Developed by ByteDance-Seed, it demonstrates strong performance across various benchmarks and provides a versatile solution for creative AI applications.
For more information and to explore the model's capabilities, visit the Bagel model page on fal.ai.
For production deployments and additional support: