> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magnific.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Imagen 4 API

> Generate images from text with Google Imagen 4. Two variants: Fast for speed and cost-effective generation, Ultra for highest-quality professional output with advanced safety controls.

<Card title="Google Imagen 4 integration" icon="google">
  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.
</Card>

Imagen 4 is Google's text-to-image API for generating high-quality images from natural language prompts. It is available in two variants: **Imagen 4 Fast**, optimized for speed and cost-effectiveness, and **Imagen 4 Ultra**, tuned for maximum output quality for professional and production workflows. Both variants share the same parameter schema, multilingual prompt support, and safety controls, and are delivered asynchronously via task IDs with webhook or polling integration.

### Key capabilities

* **Two quality tiers**: `imagen4-fast` for rapid iteration and cost-effective batch generation; `imagen4-ultra` for highest fidelity and professional use
* **Multilingual prompts**: Supports `auto`, `en`, `zh`, `zh-CN`, `hi`, `ja`, `ko`, `pt`, `es` for 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_all` for compliance with content policies
* **Safety settings**: `block_low_and_above`, `block_medium_and_above`, `block_only_high`, `block_none`
* **Output formats**: `image/png` or `image/jpeg` (with configurable JPEG `compression_quality` 0-100)
* **LLM prompt rewriting**: Enable `enhance_prompt` for 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

<div className="my-11">
  <Columns cols={2}>
    <Card title="Imagen 4 Fast" icon="bolt" href="/api-reference/text-to-image/imagen4-fast/generate">
      Speed-optimized and cost-effective. Ideal for rapid iteration, prototyping, and high-volume pipelines.
    </Card>

    <Card title="Imagen 4 Ultra" icon="star" href="/api-reference/text-to-image/imagen4-ultra/generate">
      Highest-quality output for professional and production use. Best for hero visuals and final deliverables.
    </Card>
  </Columns>
</div>

### API endpoints

#### Imagen 4 Fast

<div className="my-11">
  <Columns cols={2}>
    <Card title="POST /v1/ai/text-to-image/imagen4-fast" icon="wand-magic-sparkles" href="/api-reference/text-to-image/imagen4-fast/generate">
      Create a new image generation task
    </Card>

    <Card title="GET /v1/ai/text-to-image/imagen4-fast" icon="list" href="/api-reference/text-to-image/imagen4-fast/imagen4-fast-tasks">
      List all Imagen 4 Fast tasks
    </Card>

    <Card title="GET /v1/ai/text-to-image/imagen4-fast/{task-id}" icon="magnifying-glass" href="/api-reference/text-to-image/imagen4-fast/task-by-id">
      Get task status and results by ID
    </Card>
  </Columns>
</div>

#### Imagen 4 Ultra

<div className="my-11">
  <Columns cols={2}>
    <Card title="POST /v1/ai/text-to-image/imagen4-ultra" icon="wand-magic-sparkles" href="/api-reference/text-to-image/imagen4-ultra/generate">
      Create a new image generation task
    </Card>

    <Card title="GET /v1/ai/text-to-image/imagen4-ultra" icon="list" href="/api-reference/text-to-image/imagen4-ultra/imagen4-ultra-tasks">
      List all Imagen 4 Ultra tasks
    </Card>

    <Card title="GET /v1/ai/text-to-image/imagen4-ultra/{task-id}" icon="magnifying-glass" href="/api-reference/text-to-image/imagen4-ultra/task-by-id">
      Get task status and results by ID
    </Card>
  </Columns>
</div>

### 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

<AccordionGroup>
  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="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`.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="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`.
  </Accordion>

  <Accordion title="What are the rate limits for Imagen 4?">
    Rate limits depend on your subscription tier. See [Rate Limits](/ratelimits) for current limits.
  </Accordion>

  <Accordion title="How much does Imagen 4 cost?">
    See the [Pricing page](/pricing) for current rates and subscription options for both Fast and Ultra variants.
  </Accordion>
</AccordionGroup>

## 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 `language` code when prompting in non-English languages
* **Prompt enhancement**: Enable `enhance_prompt` when you want the model to refine and expand brief prompts. Disable it when you need deterministic output (with `seed`)
* **Safety configuration**: Tune `person_generation` and `safety_settings` to match your content policy before going to production
* **Reproducibility**: Pin a `seed` and keep `enhance_prompt` disabled 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](/api-reference/text-to-image/post-nano-banana-pro)**: Google's Gemini 3 text-to-image model with Google Search grounding and reference images
* **[Nano Banana Pro Flash](/api-reference/text-to-image/nano-banana-pro-flash/overview)**: Faster Gemini 3.1 Flash variant with the same feature set as Nano Banana Pro
* **[Seedream 4](/api-reference/text-to-image/seedream-4/overview)**: High-quality text-to-image generation with advanced prompt understanding
* **[Mystic](/api-reference/mystic/mystic)**: Magnific's proprietary image generation with LoRA style control
