Imagen 4 Text to Image
Input
Customize your input with more control.
Result
Your request will cost $0.04 per image.
Logs
Readme
Imagen4 - Google's Advanced Text-to-Image Generation API
Transform your creative vision into stunning images with Imagen4, Google's highest quality image generation model designed for developers who need reliable, high-quality image generation at scale.
Overview
Imagen4 delivers exceptional image generation capabilities through an easy-to-use API interface. Designed to generate high-quality images with enhanced detail, richer lighting, and fewer artifacts, Imagen4 provides the perfect balance of quality and performance for your applications.
Key Benefits
Transform your ideas into images with:
- Exceptional Quality: Generate photorealistic images and artistic creations with incredible detail and accuracy
- Multiple Quality Options: Choose between Standard, Fast, and Ultra variants based on your needs
- Simple Integration: Start generating images in minutes with our intuitive API and comprehensive SDKs
- Trusted Technology: Powered by Google's advanced AI research
Model Variants
Imagen4 offers three variants to suit different use cases:
- Standard (
`fal-ai/imagen4/preview`
): $0.05 per image - Balanced quality and performance - Fast (
`fal-ai/imagen4/preview/fast`
): $0.04 per image - Cost-effective option with best quality per dollar - Ultra (
`fal-ai/imagen4/preview/ultra`
): $0.06 per image - Highest quality for professional needs
Popular Use Cases
Content Creation Generate marketing visuals, social media assets, and blog illustrations at scale. Perfect for agencies and content teams who need consistent, high-quality imagery.
Product Development
Create concept art, UI mockups, and design variations for rapid prototyping. Ideal for designers exploring visual directions.
E-commerce Generate product lifestyle images, seasonal campaigns, and A/B testing visuals to boost conversion rates.
Entertainment Produce game assets, storyboard illustrations, and creative concept art for media projects.
Getting Started
Getting up and running with Imagen4 is straightforward. Here's how to begin:
- Install the SDK for your preferred language:
JavaScript/TypeScript:
bash
npm install --save @fal-ai/client
Python:
bash
pip install fal-client
- Configure your authentication:
javascript
import { fal } from "@fal-ai/client"; fal.config({ credentials: "YOUR_FAL_KEY_HERE" });
- Generate your first image:
javascript
const result = await fal.subscribe("fal-ai/imagen4/preview", { input: { prompt: "A serene mountain landscape at sunset, hyperrealistic style" } }); console.log(result.images[0].url);
API Parameters
`prompt`
(required): Text description of the image to generate`aspect_ratio`
: Control the dimensions of your generated image`num_images`
: Number of images to generate in one request`seed`
: Use for reproducible results`output_format`
: Specify the desired image format
Integration Examples
Here's a practical example of generating images in a web application:
javascript
import { fal } from "@fal-ai/client"; async function generateImage(prompt, variant = "standard") { const modelMap = { standard: "fal-ai/imagen4/preview", fast: "fal-ai/imagen4/preview/fast", ultra: "fal-ai/imagen4/preview/ultra" }; try { const result = await fal.subscribe(modelMap[variant], { input: { prompt, num_images: 1 } }); return result.images[0]; } catch (error) { console.error("Image generation failed:", error); throw error; } }
Queue Management
For handling asynchronous requests:
javascript
// Submit request const { request_id } = await fal.queue.submit("fal-ai/imagen4/preview", { input: { prompt: "Your detailed image description" } }); // Check status const status = await fal.queue.status("fal-ai/imagen4/preview", { requestId: request_id, logs: true }); // Get result const result = await fal.queue.result("fal-ai/imagen4/preview", { requestId: request_id });
Best Practices
Maximize your success with these proven approaches:
- Write Clear Prompts: Be specific and detailed in your prompt descriptions to achieve the best results
- Choose the Right Variant: Use Fast for bulk generation, Ultra for hero images
- Handle Responses Properly: Always implement proper error handling and response validation
- Cache Results: Store generated images when appropriate to optimize performance and reduce costs
- Monitor Usage: Keep track of your API usage through the fal.ai dashboard
Technical Specifications
- Image Output Formats: PNG, JPEG, and other standard formats
- API Authentication: Key-based authentication via FAL_KEY
- Concurrent Requests: Handle multiple generations simultaneously
- Partner Model: Powered by Google's advanced AI technology
Troubleshooting Guide
Common Issues and Solutions:
Authentication Errors
- Verify your API key is correctly configured
- Ensure your subscription is active
- Check your environment variables are properly set
Generation Failures
- Validate your prompt content follows content policy
- Confirm your input parameters are correctly formatted
- Review API response codes for specific error details
Pricing and Usage
Transparent, usage-based pricing that scales with your needs:
- Standard: $0.05 per image
- Fast: $0.04 per image (best value)
- Ultra: $0.06 per image (highest quality)
- No hidden fees or minimum commitments
View detailed pricing or contact sales for enterprise solutions.
Support and Resources
We're here to help you succeed:
- API Documentation: fal.ai/models/fal-ai/imagen4/preview/api
- Developer Discord Community: discord.com/invite/fal-ai
- Email Support: [email protected]
- Model Gallery: Explore all variants at fal.ai/models
Ready to Create with Google's Most Advanced Image Model?
Sign up now and start generating stunning images with Imagen4. Experience the power of Google's AI technology through fal.ai's optimized infrastructure.