Nodes/ComfyUI Griptape Nodes/Griptape Prompt Driver: OpenAI
ComfyUI Node

Griptape Prompt Driver: OpenAI

Your Griptape agent's brain is a dropdown — this node is it

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Prompt Driver: OpenAI
    • DRIVER
    modelgpt-4o-mini
    max_attempts_on_fail2
    temperature0.10
    seed10342349342
    use_native_toolstrue
    max_tokens-1
    min_p0.10
    response_formatdefault
    api_key_env_varOPENAI_API_KEY

    The Griptape Prompt Driver: OpenAI node is how you tell a Griptape agent what model does the thinking. Griptape is a full LLM agent framework bolted onto ComfyUI by the folks at Griptape.ai, and every agent you build needs a "prompt driver" - the thing that actually talks to a model. This node is that wiring for OpenAI: pick a model, set a couple of dials, and hand the resulting driver to an Agent Config.

    It doesn't generate images and it doesn't run locally. This is a pure API call to OpenAI, which is exactly the point - the agent brain is usually the one thing you don't want eating your VRAM, especially when your diffusion model already lives on the GPU.

    How it works

    Under the hood it's a thin wrapper around Griptape's OpenAiChatPromptDriver. The node collects your settings, reads your API key from an environment variable, builds the driver object, and passes it out of the DRIVER output. From there you wire it into a config node - Griptape Agent Config: Custom Structure is the natural home - or into one of the provider-specific configs, and your agent suddenly has a brain.

    A few details worth knowing from the source. The min_p field isn't passed as min-p at all: the node converts it to top_p = 1 - min_p, so lower min_p values make sampling more random, matching the tooltip. response_format set to json_object switches the driver to structured JSON output - handy when you're feeding agent output into downstream nodes that expect a parseable object. And use_native_tools (on by default) decides whether the LLM calls tools natively or through Griptape's wrapper.

    The inputs that matter

    • model - the big dropdown, 60+ OpenAI chat models from gpt-4o-mini (the default) up through gpt-5 and dated snapshots. Pick the cheapest model that does the job; this thing fires on every agent turn.
    • api_key_env_var - set this to the name of the environment variable, not the key itself. Default is OPENAI_API_KEY.
    • temperature - 0 to 1, default 0.1. For prompt-refinement and description work, low is right; raise it if the agent keeps regurgitating the same phrasing.
    • max_tokens - leave at -1 to use the model's default; only set it if you're hitting token caps on long outputs.

    Output is a single DRIVER of type PROMPT_DRIVER. That's the only thing it makes, and it's what you plug into your config.

    Install and keys

    Install the pack via ComfyUI Manager (search "Griptape") or clone it into custom_nodes:

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

    The pack's requirements.txt pulls in griptape[all] plus python-dotenv. Note that griptape[all] installs its own torch, and on Nvidia that can fight ComfyUI's copy - if you see torch errors, the README's fix is to reinstall it against the cu121 index:

    pip uninstall torch
    pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
    

    Get a key from platform.openai.com/api-keys and set OPENAI_API_KEY in Settings → Griptape (any key you already have in your environment shows up there automatically).

    Common gotchas

    The one that bites everyone: if you paste an actual key into api_key_env_var, the driver reads a variable named that string and finds nothing. Enter the variable name, not the secret. Also, after a ComfyUI Manager update you can hit ImportError: cannot import name ... from griptape.drivers - that's the Griptape library not updating in place; reinstall the pack or run python -m pip install griptape -U.

    Grok and Ollama have their own prompt driver nodes with the same shape, so once you've learned this one the rest come free.

    CategoryGriptape/Agent Drivers/Prompt

    Inputs (9)

    NameTypeDefaultDescription
    modeloptCOMBOgpt-4o-mini62 options: gpt-5, gpt-5-mini, gpt-5-nano, gpt-5-2025-08-07, gpt-5-mini-2025-08-07, gpt-5-nano-2025-08-07, +56
    max_attempts_on_failoptINT21–100Maximum attempts on failure
    temperatureoptFLOAT0.100–1Temperature for sampling
    seedoptINT10342349342Seed for random number generation
    use_native_toolsoptBOOLEANtrueUse native tools for the LLM.
    max_tokensoptINT-1Maximum tokens to generate. If <=0, it will use the default based on the tokenizer.
    min_poptFLOAT0.100–1Minimum probability for sampling. Lower values will be more random.
    response_formatoptCOMBOdefaultFormat of the response
    api_key_env_varoptSTRINGOPENAI_API_KEYEnter the environment variable name, not the actual API key

    Outputs (1)

    NameTypeDescription
    DRIVERPROMPT_DRIVER