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

# Image Generation

Image generation steps turn a text prompt into an image you can display in chat, pass to another step, or hand back as a downloadable link. Airia offers more than one image-generation step — pick the tab for the step you're using.

> 💡 **Displaying the result is the same idea for every step:** an image step returns *data* (a URL or encoded bytes), not a rendered picture. To show it in the conversation, render it as markdown with a [**Message Formatter**](/building-and-deploying-agents/agent-basics/Message-Formatter) step placed downstream — each tab below shows the exact reference.

<Tabs>
  <Tab title="Nano Banana (Gemini)">
    **Nano Banana** and **Nano Banana Pro** are image-generation steps powered by Google's Gemini image models.

    * **Nano Banana** — Gemini 2.5 Flash Image. Fast generation at 1024px, with customizable aspect ratios.
    * **Nano Banana Pro** — Gemini 3 Pro Image. Professional quality with resolutions up to 4K (1K / 2K / 4K).

    > 💡 Find them in **Steps → Actions → Image Models → Gemini**.

    ### Configuration

    | Field                   | Applies to                                    | Description                                                                                                                                               |
    | ----------------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | **Credential**          | Both                                          | The Google API Key credential to use. Leave blank to use the **Airia Key**.                                                                               |
    | **Prompt** *(required)* | Both                                          | Describe the image to generate. Supports `{{variable}}` syntax, so you can build the prompt from upstream steps and user input.                           |
    | **Aspect Ratio**        | Both                                          | `1:1` (default), `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`.                                                                        |
    | **Image Size**          | Nano Banana **Pro** only                      | `1K` (\~1024px, default), `2K` (\~2048px), `4K` (\~4096px).                                                                                               |
    | **Output Format**       | Both                                          | **Base64** (default) — image bytes embedded in the response. **Download URL** — image is uploaded to blob storage and a temporary signed URL is returned. |
    | **URL Expiry**          | Both (only when Output Format = Download URL) | How long the URL stays valid, in minutes. `0` = environment default, a positive number = custom minutes, **Perpetual** = non-expiring.                    |

    > 💡 **Choosing an Output Format:** Use **Download URL** when you want to *display* or *share* the image (it gives you a plain link you can embed or hand to a user). Use **Base64** when a downstream step needs the raw bytes inline.

    ### Output

    Each step returns a `GeminiGenerateImageResponse`:

    ```json theme={null}
    {
      "Images": [
        {
          "ImageUrl": "https://.../signed-blob-url",
          "ImageDataBase64": null,
          "MimeType": "image/png"
        }
      ],
      "Message": "…",
      "TotalCount": 1
    }
    ```

    * **`Images[]`** — One entry per generated image. Each has:
      * **`ImageUrl`** — the signed download URL (when Output Format = **Download URL**).
      * **`ImageDataBase64`** — the base64-encoded bytes (when Output Format = **Base64**).
      * **`MimeType`** — e.g. `image/png`.
    * **`Message`** — any text the model returned alongside the image.
    * **`TotalCount`** — number of images generated.

    ### Displaying the image in chat

    Wire a [**Message Formatter**](/building-and-deploying-agents/agent-basics/Message-Formatter) step after Nano Banana:

    ```
    Input  →  Nano Banana  →  Message Formatter  →  Output
    ```

    1. On the **Nano Banana** step, set **Output Format → Download URL** (and, if you want the link to stay valid, set **URL Expiry → Perpetual**).
    2. In the **Message Formatter**, use markdown's image syntax pointing at the step's `ImageUrl`:

       ```markdown theme={null}
       ![image]({{Inputs.Nano_Banana.Output.Images[-1].ImageUrl}})
       ```

       * `Inputs.Nano_Banana` refers to the upstream step **by its title**, with spaces replaced by underscores (*Nano Banana* → `Nano_Banana`, *Nano Banana 1* → `Nano_Banana_1`). See [Variables](/building-and-deploying-agents/agent-basics/agent-variables#syntax) for the naming rules.
       * `.Output.Images[-1]` grabs the most recently generated image (`[-1]` is the last item); use `[0]` for the first.
       * `![alt](url)` is markdown's image tag, so the chat surface renders the picture inline.

    **Add a download link.** Because **Download URL** gives a real, shareable link, reuse the same `ImageUrl` in a markdown link (drop the leading `!`) to offer a click-to-download option:

    ```markdown theme={null}
    ![image]({{Inputs.Nano_Banana.Output.Images[-1].ImageUrl}})

    [⬇️ Download image]({{Inputs.Nano_Banana.Output.Images[-1].ImageUrl}})
    ```

    > 💡 **Using Base64 output instead?** Embed it as a data URI rather than a plain URL:
    >
    > ```markdown theme={null}
    > ![image](data:{{Inputs.Nano_Banana.Output.Images[-1].MimeType}};base64,{{Inputs.Nano_Banana.Output.Images[-1].ImageDataBase64}})
    > ```

    ### Troubleshooting

    **The image won't display / the link is empty**

    * The Message Formatter references `ImageUrl`, but the step is set to **Base64**. Switch **Output Format → Download URL**, or embed the base64 data URI instead (see above).

    **The variable doesn't resolve**

    * Check the step title in the token. The default step *Nano Banana* is referenced as `Inputs.Nano_Banana`; spaces become underscores, and a numbered duplicate like *Nano Banana 1* becomes `Nano_Banana_1`. The token must match the title exactly.

    **The download link stops working after a while**

    * The signed URL expired. Increase **URL Expiry**, or set it to **Perpetual** for a non-expiring link.

    **Authentication errors**

    * Either select a valid **Google API Key** credential on the step, or leave the credential blank to fall back to the **Airia Key**.
  </Tab>
</Tabs>
