ai-openai-image-gen

ai-openai-image-gen — Generate images using GPT Image 1 API


Description

- step: ai-openai-image-gen
  args:
    - '${PROMPT}'
    - '${SIZE}'   # optional

The ai-openai-image-gen step generates images based on a text prompt using the OpenAI GPT Image 1 model.

Usage in a workflow YAML:

workflow:
  - step: ai-openai-image-gen
    args:
      - "A futuristic city skyline at sunset"
      - "512x512"   # optional

Parameters

Parameter Type Description
prompt string Text prompt describing the image to generate.
size string Optional. Image size, e.g., "256x256", "512x512", or "1024x1024". Defaults to "1024x1024".

Context requirements:

Context Key Type Description
OPEN_AI_API_KEY string Required. OpenAI API key for authentication.
output_dir string Optional. Directory where images are saved. Defaults to output.

Return Values

[
  "/full/path/to/output/uuid1.png",
  "/full/path/to/output/uuid2.png"
]
{
  "error": "Error message describing the failure"
}

Behavior


Examples

Example #1 — Basic image generation

workflow:
  - step: ai-openai-image-gen
    args:
      - "A cyberpunk cityscape at night"

Saves images in output/ and stores their paths in ${prev}.

Example #2 — Custom size and context key

workflow:
  - step: ai-openai-image-gen
    args:
      - "A majestic mountain landscape"
      - "512x512"
    context:
      set_context: mountain_images

Stores generated image paths under ${mountain_images}.

Example #3 — Specifying output directory

workflow:
  - step: ai-openai-image-gen
    args:
      - "A cute cartoon robot"
    context:
      output_dir: '/tmp/robot_images'

Saves images to /tmp/robot_images/.


Notes


See Also