Google Imagen 4 integration
Google’s latest text-to-image model family with two variants: Fast for speed-optimized generation and Ultra for maximum quality with fine-grained safety and person-generation controls.
Key capabilities
- Two quality tiers:
imagen4-fastfor rapid iteration and cost-effective batch generation;imagen4-ultrafor highest fidelity and professional use - Multilingual prompts: Supports
auto,en,zh,zh-CN,hi,ja,ko,pt,esfor native-language inputs - Aspect ratios:
square_1_1,social_story_9_16,widescreen_16_9,traditional_3_4,classic_4_3 - Person generation controls:
dont_allow,allow_adult,allow_allfor compliance with content policies - Safety settings:
block_low_and_above,block_medium_and_above,block_only_high,block_none - Output formats:
image/pngorimage/jpeg(with configurable JPEGcompression_quality0-100) - LLM prompt rewriting: Enable
enhance_promptfor higher-quality results that better reflect intent - Reproducibility: Deterministic generation with
seed(1 to 4,294,967,295) - Async processing: Webhook notifications or polling for task completion
Use cases
- Marketing creatives: Campaign visuals, social posts, and product imagery in standard aspect ratios
- E-commerce: On-brand product and lifestyle imagery at professional quality with Ultra
- Editorial and publishing: Illustrations and hero images in multiple languages
- Rapid prototyping: Visual ideation with Fast for low-cost iteration before finalizing with Ultra
- Localized content: Native-language prompts for Spanish, Japanese, Korean, Chinese, Portuguese, Hindi and more
Choose your variant
Imagen 4 Fast
Speed-optimized and cost-effective. Ideal for rapid iteration, prototyping, and high-volume pipelines.
Imagen 4 Ultra
Highest-quality output for professional and production use. Best for hero visuals and final deliverables.
API endpoints
Imagen 4 Fast
POST /v1/ai/text-to-image/imagen4-fast
Create a new image generation task
GET /v1/ai/text-to-image/imagen4-fast
List all Imagen 4 Fast tasks
GET /v1/ai/text-to-image/imagen4-fast/{task-id}
Get task status and results by ID
Imagen 4 Ultra
POST /v1/ai/text-to-image/imagen4-ultra
Create a new image generation task
GET /v1/ai/text-to-image/imagen4-ultra
List all Imagen 4 Ultra tasks
GET /v1/ai/text-to-image/imagen4-ultra/{task-id}
Get task status and results by ID
Parameters
Both Imagen 4 Fast and Imagen 4 Ultra share the same request schema.| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | - | Text description of the image to generate |
aspect_ratio | string | No | square_1_1 | Output ratio: square_1_1, social_story_9_16, widescreen_16_9, traditional_3_4, classic_4_3 |
person_generation | string | No | allow_adult | Person generation policy: dont_allow, allow_adult, allow_all |
safety_settings | string | No | block_medium_and_above | Safety filter level: block_low_and_above, block_medium_and_above, block_only_high, block_none |
seed | integer | No | - | Deterministic seed (1 - 4,294,967,295). Does not work when enhance_prompt is enabled |
enhance_prompt | boolean | No | - | LLM-based prompt rewriting for higher-quality images |
language | string | No | en | Prompt language: auto, en, zh, zh-CN, hi, ja, ko, pt, es |
output_options.mime_type | string | No | image/png | Output format: image/png or image/jpeg |
output_options.compression_quality | integer | No | 75 | JPEG compression (0-100). Only applies when mime_type is image/jpeg |
webhook_url | string | No | - | URL for async status notifications |
Frequently Asked Questions
What is Imagen 4 and how does it work?
What is Imagen 4 and how does it work?
Imagen 4 is Google’s text-to-image model available in two variants through the Magnific API: Fast (speed and cost-optimized) and Ultra (highest quality). You submit a text prompt via the API, receive a task ID immediately, then poll the task endpoint or configure a webhook to receive the generated image when processing completes. The response returns the image as base64-encoded data.
What is the difference between Imagen 4 Fast and Imagen 4 Ultra?
What is the difference between Imagen 4 Fast and Imagen 4 Ultra?
Imagen 4 Fast is optimized for speed and cost-effectiveness, making it suitable for rapid iteration, prototyping, and high-volume workflows. Imagen 4 Ultra is tuned for maximum output quality, making it the right choice for hero visuals, editorial imagery, and production deliverables. Both share the exact same parameters, aspect ratios, and safety controls.
What aspect ratios does Imagen 4 support?
What aspect ratios does Imagen 4 support?
Five aspect ratios:
square_1_1 (1:1), social_story_9_16 (9:16), widescreen_16_9 (16:9), traditional_3_4 (3:4), and classic_4_3 (4:3). The default is square_1_1.What languages does Imagen 4 support for prompts?
What languages does Imagen 4 support for prompts?
Imagen 4 supports prompts in English (
en), Spanish (es), Portuguese (pt), Japanese (ja), Korean (ko), Hindi (hi), Simplified Chinese (zh-CN), generic Chinese (zh), and automatic detection (auto). Use the language parameter to indicate the prompt language.How do I control person generation and safety?
How do I control person generation and safety?
Use
person_generation to control whether people appear in outputs: dont_allow disables person generation, allow_adult permits adults only, and allow_all permits all ages. Use safety_settings to configure content filtering from strict (block_low_and_above) to permissive (block_none). The defaults are allow_adult and block_medium_and_above respectively.Does Imagen 4 support deterministic generation?
Does Imagen 4 support deterministic generation?
Yes. Provide a
seed value between 1 and 4,294,967,295 to reproduce identical outputs for the same prompt and parameters. Note that seed does not work when enhance_prompt is enabled, because LLM-based rewriting introduces non-deterministic changes to the prompt.What output formats are available?
What output formats are available?
Imagen 4 returns images as base64-encoded data in either PNG (default) or JPEG. Use
output_options.mime_type to select the format and output_options.compression_quality (0-100) to control JPEG compression. The default JPEG quality is 75.What are the rate limits for Imagen 4?
What are the rate limits for Imagen 4?
Rate limits depend on your subscription tier. See Rate Limits for current limits.
How much does Imagen 4 cost?
How much does Imagen 4 cost?
See the Pricing page for current rates and subscription options for both Fast and Ultra variants.
Best practices
- Variant selection: Start with Imagen 4 Fast for ideation and iteration; switch to Imagen 4 Ultra for final, production-grade assets
- Prompt writing: Be specific about subject, composition, lighting, and style. Use the matching
languagecode when prompting in non-English languages - Prompt enhancement: Enable
enhance_promptwhen you want the model to refine and expand brief prompts. Disable it when you need deterministic output (withseed) - Safety configuration: Tune
person_generationandsafety_settingsto match your content policy before going to production - Reproducibility: Pin a
seedand keepenhance_promptdisabled when building A/B test suites or regression samples - Production integration: Use webhooks instead of polling for scalable applications
- Error handling: Implement retry logic with exponential backoff for 503 errors
Related APIs
- Nano Banana Pro: Google’s Gemini 3 text-to-image model with Google Search grounding and reference images
- Nano Banana Pro Flash: Faster Gemini 3.1 Flash variant with the same feature set as Nano Banana Pro
- Seedream 4: High-quality text-to-image generation with advanced prompt understanding
- Mystic: Magnific’s proprietary image generation with LoRA style control