> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.devit.software/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Generate images with OpenAI in a workflow

# ${color}[#204a87](Generate images with OpenAI in a workflow)

${color}[#3465a4](**In this article:**)
* [What the Generate Image action does](#1-what-the-generate-image-action-does)
* [Connect OpenAI](#1-connect-openai)
* [Add the Generate Image action](#1-add-the-generate-image-action)
* [Image options](#1-image-options)
* [Use the generated image](#1-use-the-generated-image)
* [Costs and tips](#1-costs-and-tips)

The **Generate Image** action creates an image from a text prompt using an OpenAI model. You can build the prompt from store data, for example the product title and type, and save the image to Shopify or Google Drive.

# ${color}[#204a87](What the Generate Image action does)

When the workflow reaches the action, React Flow sends your prompt to OpenAI with your API key, receives the image and saves it to the storage you selected. You'll find it under **Action** > **Connectors** > **Generate Image**. The same OpenAI connection is used by the **Generate Text** action.

# ${color}[#204a87](Connect OpenAI)

You need your own OpenAI API key. Create it in your OpenAI account (platform.openai.com) under API keys.

1. In React Flow, go to **Connectors** and click **OpenAI**.
2. Enter a **Name** for the connection.
3. Paste your key into **Api key** and save the connection.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/openai-connection_1xe77se.png =800x334)


|| Keep your API key private and never share it publicly. React Flow uses it only to send your requests to OpenAI.

# ${color}[#204a87](Add the Generate Image action)

1. In a workflow, click **+**, select **Action** and choose **Generate Image**.
2. Under **Connector**, click **Select connection** and choose your OpenAI connection.
3. Enter a **File name** for the image. You can use variables.
4. Choose a **Model**: **gpt-image-1.5** (default), **gpt-image-1**, **gpt-image-1-mini**, **dall-e-3** or **dall-e-2**.
5. Write the **Prompt**. Click **Add variables** to insert store data, for example:
`Lifestyle photo of {{ product.title }} on a white background`
6. Click **Save**.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/generate-image-settings_lsmh7v.png =800x382)


# ${color}[#204a87](Image options)

Click **Expand options** to see more settings. They depend on the model.

For the GPT image models (**gpt-image-1.5**, **gpt-image-1**, **gpt-image-1-mini**):

* **Number of images**: from 1 to 10.
* **Quality**: Auto, High, Medium or Low.
* **Size**: Auto, 1024x1024 (square), 1536x1024 (landscape) or 1024x1536 (portrait).
* **Output format**: jpeg, png or webp.
* **Background**: Auto or Opaque.
* **Output compression**: for jpeg and webp.
* **Moderation**: Auto or Low.

![](https://storage.crisp.chat/users/helpdesk/website/-/3/2/7/1/3271b421d88bd400/generate-image-options_1rf4awo.png =800x382)


For **dall-e-3**: one image per run, **Quality** Standard or HD, **Size** 1024x1024, 1792x1024 or 1024x1792, and **Style** Vivid or Natural.

Under **Select storage**, choose **Shopify** (saved to Shopify Files) or **Google Drive** (see [this article](https://help.devit.software/en/article/google-drive-connector-save-workflow-files-to-google-drive-lmp3xk/)).

# ${color}[#204a87](Use the generated image)

* Attach it to an email: in **Send email**, select **Attachments** > **Add files** and pick the image on the **Workflow** tab.
* Keep it in Shopify Files or Google Drive for your team to review before you use it on the store.

Example: trigger **Product added to store** → **Generate Image** with a prompt built from `{{ product.title }}` → **Send email** to your content manager with the image attached for review.

# ${color}[#204a87](Costs and tips)

* Image generation is billed by OpenAI to your OpenAI account, separately from your React Flow plan. Higher quality, larger sizes and more images per run cost more.
* Test the prompt with **Run Test** > **Execute** on one item before you turn the workflow on.
* Add conditions before the action, for example "product type is Apparel", so you don't generate images you don't need.

# ✔️ Next step

Check our articles to learn more about the app's functionality:

* [Google Drive connector: save workflow files to Google Drive](https://help.devit.software/en/article/google-drive-connector-save-workflow-files-to-google-drive-lmp3xk/)
* [Generate PDF documents in a workflow](https://help.devit.software/en/article/generate-pdf-documents-in-a-workflow-1k71k8q/)
* [React Flow Connectors](https://help.devit.software/en/article/react-flow-connectors-8urln8/)
* [Workflow testing](https://help.devit.software/en/article/workflow-testing-1m51cf9/)