FL GPT Text
A plain OpenAI chat completion call, dropped into ComfyUI
- response
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.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| model | COMBO | 4 options: gpt-4o-mini, gpt-4o, gpt-4, gpt-3.5-turbo | |
| system_prompt | STRING | You are a helpful assistant that provides accurate and concise information. | — |
| user_prompt | STRING | Hello, can you help me with something? | — |
| max_tokens | INT | 5001–4096 | — |
| temperature | FLOAT | 0.70–2 | — |
| top_p | FLOAT | 1.000–1 | — |
| frequency_penalty | FLOAT | 0.0-2–2 | — |
| presence_penalty | FLOAT | 0.0-2–2 | — |
| save_to_fileopt | BOOLEAN | false | — |
| output_directoryopt | STRING | — | |
| filenameopt | STRING | gpt_response.txt | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |