Griptape Driver: OpenAI Image Generation
Give your agent hands that draw — via the OpenAI Images API
- DRIVER
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), orgpt-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.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image_generation_modelopt | COMBO | dall-e-3 | Select the image generation model. |
| sizeopt | COMBO | 1024x1024 | Select the desired image size. |
| api_key_env_varopt | STRING | OPENAI_API_KEY | Enter the environment variable name for the API key, not the actual API key. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DRIVER | DRIVER | — |