ComfyUI Node

FL GPT Text

A plain OpenAI chat completion call, dropped into ComfyUI

By filliptm·Created 3 years ago·Updated 20 days ago· 648
FL GPT Text
    • response
    ◄api_key►
    ◄modelgpt-5.6-luna►
    ◄system_promptYou are a helpful assistant that provides accurate and concise information.►
    ◄user_promptHello, can you help me with something?►
    ◄max_tokens500►
    ◄temperature0.7►
    ◄top_p1.00►
    ◄frequency_penalty0.0►
    ◄presence_penalty0.0►
    ◄save_to_filefalse►
    ◄output_directory►
    ◄filenamegpt_response.txt►
    ◄custom_model►

    A plain, synchronous call to OpenAI's chat completion API, with full parameter control, dropped straight into a ComfyUI graph. Not an image node at all - this is for text: generating captions, expanding a short prompt into a longer one, or running any language-model step as part of an otherwise image-focused pipeline, without leaving ComfyUI to do it.

    The mechanism

    Sends system_prompt and user_prompt to your chosen model synchronously - unlike a lot of this pack's other API nodes, which fire async batches, this one blocks and returns a single response - with the usual OpenAI sampling knobs exposed directly: temperature, top_p, frequency and presence penalties.

    Inputs and outputs that matter

    api_key falls back to an environment variable if left blank, per the pack's own description, so you're not forced to paste a key into every workflow file if you'd rather set it once as an environment variable. model gives four choices - gpt-4o-mini through gpt-3.5-turbo - with gpt-4o-mini the cheap/fast default worth starting with before reaching for full gpt-4o. system_prompt defaults to a generic "helpful assistant" instruction; replace it with whatever role you actually want the model playing. user_prompt is the actual request.

    max_tokens (1-4096) caps response length and therefore cost. temperature (0-2, default 0.7) - higher is more random and creative, lower is more literal and deterministic. top_p (0-1, default 1) is an alternative sampling control; most people tune one of temperature or top_p and leave the other at default, since tuning both at once tends to produce unpredictable results. frequency_penalty and presence_penalty (both -2 to 2, default 0) push positive to discourage the model from repeating itself, useful if you're generating a batch of captions and getting suspiciously similar phrasing across them.

    Optionally, save_to_file plus output_directory and filename (default gpt_response.txt) write the response straight to disk.

    Output: response (STRING) - wire it into FL_ShowText to read it inline, into a prompt input elsewhere in the graph, or into a save node.

    Installing it

    ComfyUI Manager: search Fill-Nodes, install, restart. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/filliptm/ComfyUI_Fill-Nodes, then restart.

    Where people get burned

    max_tokens caps the response, not the request - if system_prompt plus user_prompt is long, you're still billed for that input regardless of max_tokens, and a response that cuts off mid-sentence usually means max_tokens was set too low for what you asked, not an API failure.

    And with temperature/top_p both at defaults that allow real variation, identical prompts won't return identical text run to run - there's no seed field here, so if you need reproducible output for something like automated testing, this node's parameters don't fully solve that.

    Category🏵️Fill Nodes/GPT

    Inputs (13)

    NameTypeDefaultDescription
    api_keySTRING—
    modelCOMBOgpt-5.6-luna3 options: gpt-5.6-luna, gpt-5.6-terra, gpt-5.6-sol
    system_promptSTRINGYou are a helpful assistant that provides accurate and concise information.—
    user_promptSTRINGHello, can you help me with something?—
    max_tokensINT5001–65536—
    temperatureFLOAT0.70–2—
    top_pFLOAT1.000–1—
    frequency_penaltyFLOAT0.0-2–2—
    presence_penaltyFLOAT0.0-2–2—
    save_to_fileoptBOOLEANfalse—
    output_directoryoptSTRING—
    filenameoptSTRINGgpt_response.txt—
    custom_modeloptSTRING—

    Outputs (1)

    NameTypeDescription
    responseSTRING—