OpenAI Images
Generate, edit, and vary images with OpenAI from any workflow.
This Module turns text prompts into images, applies prompt-guided edits to existing images (optionally constrained by a mask), and produces variations of an input image. Results land in a Session variable as a URL or a base64 data URL, ready to send to the user or store.
How it works
Each Task sends one request to OpenAI's image endpoints and saves the result. Image inputs accept an https://… URL, a data:image/...;base64,… data URL, or a {variable} containing one of those. Generated images come back either as an OpenAI-hosted URL (expires after a while) or — when you ask for base64 — as a self-contained data URL you can store with a file-storage Task.
Configuration
Each OpenAI Module is configured separately, per Environment — this Module has its own API key, so you can reuse the key you set on the core OpenAI Module or use a dedicated one (for example to track this capability's spend on its own).
| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| OpenAI API Key | string | Yes | sk-... | Your OpenAI API key for this Module. Stored securely. Find it in OpenAI Console → API keys → Create new secret key. |
| OpenAI Organization | string | No | org-abc123 | Your OpenAI organization ID, if your account belongs to one. |
Tasks
All Tasks in this Module are Generic (all Channels) — they run the same regardless of how the Session was started.
Output fields: type a variable name without braces (for example image) and pick its type (string, number, true/false, object, date). The Task saves its result there, and any later Task can use it by writing {image}.
OpenAIGenerateImageTask
Generates an image from a text prompt.
| Property | Type | Required | Example | Description |
|---|---|---|---|---|
| Model | string | Yes | dall-e-3 | dall-e-3, dall-e-2, or gpt-image-1. |
| Size | string | No | 1024x1024 | e.g. 1024x1024. Allowed values depend on the model. |
| Quality | string | No | hd | standard or hd. Empty → model default. |
| Style | string | No | vivid | vivid or natural. Empty → model default. |
| Prompt | string | Yes | {imagePrompt} | Text prompt. Supports {variable} placeholders. |
| Output Variable | string | Yes | image | Variable name (no braces). Receives the URL or data: URL. |
| Return as Base64 Data URL | bool | No | checked | Default off. When on, the result is data:image/png;base64,... for downstream storage. |
Example: Set Model = dall-e-3, Size = 1024x1024, Prompt = {imagePrompt}, Output Variable = image, Return as Base64 Data URL = off. With {imagePrompt} = "A watercolor lighthouse at dawn", the Task saves an OpenAI-hosted image URL to image; a later Task sends it with {image}.
OpenAIEditImageTask
Edits an existing image with a text prompt and an optional mask. Transparent pixels in the mask mark the areas to edit.
| Property | Type | Required | Example | Description |
|---|---|---|---|---|
| Model | string | Yes | dall-e-2 | dall-e-2 or gpt-image-1. |
| Image Source | string | Yes | {imageUrl} | URL, data URL, or {variable} containing one of those. |
| Image File Name | string | No | input.png | Filename including extension. Default input.png. |
| Mask Source | string | No | {maskUrl} | Optional. Same format as Image Source. Transparent pixels in the mask mark areas to edit. |
| Mask File Name | string | No | mask.png | Filename including extension. Default mask.png. |
| Prompt | string | Yes | {editPrompt} | Text prompt describing the edit. Supports {variable} placeholders. |
| Output Variable | string | Yes | editedImage | Variable name (no braces). Receives the resulting image URL or data URL. |
Example: Set Model = dall-e-2, Image Source = {imageUrl}, Mask Source = {maskUrl}, Prompt = Replace the sky with a starry night, Output Variable = editedImage. The Task edits only the transparent mask area and saves the result to editedImage.
OpenAIVariationImageTask
Generates N variations of an input image (no prompt).
| Property | Type | Required | Example | Description |
|---|---|---|---|---|
| Model | string | Yes | dall-e-2 | dall-e-2. |
| Image Source | string | Yes | {imageUrl} | URL, data URL, or {variable} containing one of those. |
| Image File Name | string | No | input.png | Filename including extension. Default input.png. |
| Count | string | No | 3 | Number of variations to generate (1–10). Default 1. |
| Output Variable | object | Yes | variations | Variable name (no braces). Receives a list of image URLs (one per variation). |
Example: Set Model = dall-e-2, Image Source = {imageUrl}, Count = 3, Output Variable = variations. The Task saves a list of three image URLs to variations.
Common recipes
Generate an illustration and send the user the link
Ask the user what to draw, generate the image, and reply with the hosted URL. Input and Output Tasks come from the Standard Module.
- InputTask — Output Variable =
imagePrompt(e.g. the user types "A watercolor lighthouse at dawn"). - OpenAIGenerateImageTask — Model =
dall-e-3, Size =1024x1024, Prompt ={imagePrompt}, Return as Base64 Data URL = off, Output Variable =image. - OutputTask — Message =
Here is your image: {image}. The hosted URL expires after a while — if the user needs a permanent copy, store the image (for example with the Google Drive Module) and send that link instead.
Best practices
- Prefer hosted URLs for immediate delivery — leave Return as Base64 Data URL off when the user just needs to see the image; the URL is small and the Session stays lean.
- Store before the URL expires — OpenAI-hosted image URLs are temporary; for anything the user keeps, save the image to permanent storage right after generation.
- Match the model to the job —
dall-e-3for prompt-faithful generation,dall-e-2for edits and variations,gpt-image-1for the newest generation/edit quality.
Troubleshooting
data: URL is huge
Storing a multi-megabyte image as a base64 data URL in the Session bloats the execution. Save the image to external storage (for example with the Google Drive Module) immediately after generation, then keep only the link.
Error codes
| Code | Name | Description |
|---|---|---|
| 3005 | TaskInvalidData | A required property is missing or an output field is not a valid variable name — details |
| 4001 | ModuleException | OpenAI rejected the request (e.g. unsupported size or a policy-violating prompt) — details |
| 4008 | ModuleMissingConfiguration | The OpenAI API key is not set in the OpenAI Module's Environment configuration — details |
| 4009 | ModuleInputEmpty | The prompt or image source resolved to an empty value — details |
| 4012 | ModuleInvalidData | The Session data could not be read or the image response could not be processed — details |
See the Error Code Reference for the full list.
Related pages
- OpenAI Module — the family core; the API key is configured there.