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

# Image Generation

> Configure a workflow step that generates one or more images and returns uploaded asset records for later steps

Use **Image Generation** when you want a workflow step to create images from a prompt and reuse the generated assets later in the workflow.

Supports **OpenAI** (`gpt-image-2`), **xAI Grok Imagine** (`grok-imagine-image-quality`, `grok-imagine-image`), and hosted **Google Gemini** (`gemini-2.5-flash-image`). Select the model in the **Model** dropdown at the top of the settings form. OpenAI-specific options (Size, Quality, Background, Moderation, Output Format, Output Compression) are hidden when a Grok or Gemini model is selected. Gemini shows aspect-ratio choices instead of OpenAI size tiles.

## Configuration

| Option                    | Required | Description                                                                                     |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------- |
| Name                      | No       | Label for the step in the workflow canvas.                                                      |
| Model                     | No       | Image model to use. Default: `gpt-image-2`.                                                     |
| Prompt                    | Yes      | The text entered in **Prompt**.                                                                 |
| Image Size / Aspect Ratio | No       | OpenAI uses size tiles. Gemini uses aspect ratios such as `1:1`, `16:9`, or `9:16`.             |
| Image Count               | No       | Number of images to generate.                                                                   |
| Image Quality             | No       | Quality level for the generated images (OpenAI only).                                           |
| Image Background          | No       | Background mode for the image output (OpenAI only).                                             |
| Image Moderation          | No       | Moderation setting for the generation request (OpenAI only).                                    |
| Output Format             | No       | Output file format (OpenAI only).                                                               |
| Output Compression        | No       | Compression level for formats that support it (OpenAI only).                                    |
| Charge Type               | No       | Whether the step uses **Hosted** or **Personal** billing.                                       |
| When the step fails       | No       | Controls whether the workflow should **Terminate Workflow** or **Continue** if this step fails. |

Use the **Insert Variable** button next to **Prompt** when part of the image description should come from workflow inputs or earlier steps.

This step uses **Settings** and **Output** tabs. The **Output** tab shows the generated images as a gallery after a successful test run.

## Output

This step outputs an object with:

* `settings`: the selected model plus provider-specific image generation settings used for the call
* `assets`: an array of generated asset records

Each asset item includes uploaded asset data such as:

* `id`
* `file_url`
* `file_name`
* `file_size`
* `file_type`

Use the base output reference to pass the full object forward:

```text theme={null}
{{STEP_IDENTIFIER.output}}
```

To reference a specific generated image field, use an indexed path such as:

```text theme={null}
{{step_2.output.assets.0.file_url}}
{{step_2.output.assets.0.file_name}}
```

To reference settings used by the step:

```text theme={null}
{{step_2.output.settings.model}}
{{step_2.output.settings.image_size}}
```

The exact settings keys depend on the selected provider. OpenAI outputs include OpenAI-specific fields such as `image_quality`, `image_background`, `image_output_format`, and `image_output_compression`. Gemini outputs include the selected aspect ratio in `image_size`. xAI outputs include the model, provider, and image count.

Use the variable picker after a test run to confirm the exact path you want to insert.

## Example

Add **Image Generation** to your workflow.

Write a detailed **Prompt** such as `Create a product hero image for a blue insulated water bottle on a clean studio background`.

Choose a **Size** or **Aspect Ratio**, set **Image Count**, then adjust the provider-specific options that are visible.

If you want smaller JPEG or WebP output, lower **Output Compression**. If you keep **Output Format** set to **PNG**, that compression control stays disabled.

Click **Run** in the step header. After the run finishes, open **Output** to review the returned images and use the variable picker to reference the generated asset fields in later steps.

{/* Add screenshot: Image Generation output tab showing generated images */}

## Notes

* If **Output Format** is **JPEG**, **Transparent** is not available in **Background** (OpenAI only).
* If **Output Format** is **PNG**, **Output Compression** is disabled in the editor (OpenAI only).
* When using a Grok Imagine model, images are always returned as PNG regardless of the Output Format setting.
* Gemini image generation is hosted-only in this workflow step. Personal/BYOK Gemini image generation is not supported in v1.
* xAI Grok Imagine is billed at a fixed rate per image (not per token). OpenAI `gpt-image-2` is billed per token. Gemini is billed from input tokens plus generated-image output tokens.
* This step returns uploaded asset records, not just raw image bytes.
* Before the image provider is called, Fetch Hive checks whether your account has reached its plan storage limit. If the limit is reached, the step fails without generating or uploading new images.
* Generated file URLs are useful when a later step needs to pass an image reference forward.

See also: [Creating and Editing](../../creating-and-editing) and [Testing and Iteration](../../testing-and-iteration)
