Nodes/ComfyUI Griptape Nodes/Griptape Driver: OpenAI Image Generation
ComfyUI Node

Griptape Driver: OpenAI Image Generation

Give your agent hands that draw — via the OpenAI Images API

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Driver: OpenAI Image Generation
    • DRIVER
    image_generation_modeldall-e-3
    size1024x1024
    api_key_env_varOPENAI_API_KEY

    If you want your Griptape agent to not just talk about an image but produce one, this is the node. The OpenAI Image Generation driver wires an image-generation backend into your agent, so a Griptape Create: Image from Text task can call out to OpenAI's image models (dall-e-2, dall-e-3, or gpt-image-1) instead of only reasoning about text.

    Set your expectations up front: this is not local generation. It doesn't touch your checkpoint or your GPU. It's a paid API call that returns a finished image, which Griptape hands back to the workflow. That's a feature in agent-land - your local diffusion setup stays free for what it's good at, and the agent gets a cheap way to illustrate its output - but it's also the thing people miss when they grab this node expecting a ComfyUI-quality render. The output is good, but it's dall-e, not your fine-tuned SDXL.

    How it works

    The node wraps Griptape's OpenAiImageGenerationDriver. You pick a model and a size, it reads OPENAI_API_KEY from the environment variable you name, and it hands you a DRIVER object. That driver then plugs into an agent config's image-generation slot - Griptape Agent Config: Custom Structure accepts it, or you can use it in the OpenAI-flavored configs.

    One genuinely thoughtful detail hides in the source: the node auto-corrects invalid size/model combos instead of erroring. Pick dall-e-2 and a portrait size like 1024x1792? It silently downgrades you to 1024x1024 because dall-e-2 doesn't do non-square. Pick dall-e-3 with 256x256 or 512x512? Back to 1024x1024, because dall-e-3's smallest size is 1024. Handy, but it means the size you selected may not be the size you get - check the result if dimensions matter.

    The inputs that matter

    • image_generation_model - dall-e-2, dall-e-3 (default), or gpt-image-1. gpt-image-1 is the newest and best, but it's also the most expensive; dall-e-3 is the sane default for agent output.
    • size - 256x256, 512x512, 1024x1024, 1024x1792, 1792x1024. Remember the auto-correction above: not every size works with every model.
    • api_key_env_var - the name of the env var holding your key, default OPENAI_API_KEY. Never paste the key itself here.

    Output is a single DRIVER of type DRIVER, which feeds the config. From there, a task node like Griptape Create: Image from Text uses it to actually render.

    Install and keys

    Same pack as the rest - ComfyUI Manager (search "Griptape") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/griptape-ai/ComfyUI-Griptape
    

    Set OPENAI_API_KEY under Settings → Griptape in ComfyUI (or in your environment). Note the pack's requirements.txt pins an openai version and pulls in griptape[all], which can fight ComfyUI's torch install on Nvidia - reinstall torch from the cu121 index if you see import or runtime errors.

    Common gotchas

    The usual suspects apply: enter the env var name in api_key_env_var, not the secret. And because this is an API call, it bills you per image and can silently fail on rate limits - the agent will just report an error for that task. If your workflow is a one-off illustration, dall-e-3 at 1024 is the cost/quality sweet spot; save gpt-image-1 for when you actually need its quality jump.

    CategoryGriptape/Agent Drivers/Image Generation

    Inputs (3)

    NameTypeDefaultDescription
    image_generation_modeloptCOMBOdall-e-3Select the image generation model.
    sizeoptCOMBO1024x1024Select the desired image size.
    api_key_env_varoptSTRINGOPENAI_API_KEYEnter the environment variable name for the API key, not the actual API key.

    Outputs (1)

    NameTypeDescription
    DRIVERDRIVER