The AI Media block

View as Markdown

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 data blocks. You can then reference the variable or data block in your prompt using curly braces. To learn how, see 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.

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 Add icon Add data blocks to insert 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 Add icon 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 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.

You can insert a number of blocks into the AI Media block to process their data including the String, Bool, Number, Null, Select, Now, Date, Date & Time, and Get Variable blocks.