> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# The AI Media block

The **AI Media** block uses artificial intelligence (AI) models to generate images based on your plain-language prompts. For example, you could enter a prompt like "Create a generic profile picture for a random person" or "Create a picture of an astronaut studying".

You can assign another block's output to the **AI Media** block's built-in variable, or [insert](/docs/postman-flows/reference/blocks/overview/#insert-data-blocks-into-other-blocks) data blocks. You can then reference the variable or data block in your prompt using curly braces. To learn how, see [Setup](#setup).

The number of credits a **AI Media** block consumes any given time that it runs depends on which model it's using. To learn more, see [How Flows consume credits](/docs/billing/flows-usage/#how-flows-consume-credits).

## Input

Connect another block's output port to the **AI Media** block's input port to assign incoming data to a variable. Click the variable's name to edit it. Click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/action-add-stroke.svg#icon" width="16px" /> **Add data blocks** to [insert](/docs/postman-flows/reference/blocks/overview/#insert-data-blocks-into-other-blocks) a data block into the **AI Media** block. You can then assign a value to the data block and reference it in your prompt with curly braces like `{{this}}`.

## Output

The output port sends the image that the AI model creates. You can click **?** next to the output port to preview the image.

## Setup

Click the text box to enter a prompt in plain language. To insert a variable data block into your **AI Media** block, click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/action-add-stroke.svg#icon" width="16px" /> **Add data blocks**. For example, you could insert a **String** block, name the variable `animal`, and reference it in a prompt like this: `Create an image of this {{animal}}`. The **AI Media** block generates an image of whatever is assigned to the variable `animal`. You can change an inserted block to a different data block by clicking the inserted block's icon and choosing a block from the dropdown list.

Click **Additional settings** to set the image's size and background.

* **Size** - Select **Auto**, **Square (1024x1024)**, **Portrait (1024x1536)**, or **Landscape (1536x1024)**.

* **Background** - Select **Opaque** or **Transparent**. For best results when selecting **Transparent**, also specify a transparent background in the prompt.

### Use Mustache syntax in AI prompts

The **AI Media** block supports [Mustache](https://mustache.github.io/mustache.5.html) syntax. You can use Mustache to dynamically format prompts, iterate over arrays, conditionally display text, and more.

If a referenced variable in your AI prompt contains an object, Mustache syntax in the **AI Media** block returns the full JSON representation of the object, including field names, rather than `[object Object]`.

### Change the AI model

To change the AI model, do the following:

1. Click the **AI Media** block, then click the **Model** dropdown list.

2. Select a model from the list.

## Related blocks

You can insert a number of blocks into the **AI Media** block to process their data including the [**String**](/docs/postman-flows/reference/blocks/string/), [**Bool**](/docs/postman-flows/reference/blocks/bool/), [**Number**](/docs/postman-flows/reference/blocks/number/), [**Null**](/docs/postman-flows/reference/blocks/null/), [**Select**](/docs/postman-flows/reference/blocks/select/), [**Now**](/docs/postman-flows/reference/blocks/now/), [**Date**](/docs/postman-flows/reference/blocks/date/), [**Date & Time**](/docs/postman-flows/reference/blocks/date-and-time/), and [**Get Variable**](/docs/postman-flows/reference/blocks/get-variable/) blocks.