FEGenStringGPT
Generate prompts from any OpenAI-compatible API
- prompt
- generate_ctx
The name says GPT, but the honest description is "LLM prompt generation for anyone." FEGenStringGPT takes a system prompt and a user prompt, calls a chat/completions endpoint, and streams back a full prompt string you can drop straight into a CLIP text encode. LLM-assisted prompt writing has been a ComfyUI staple since the first "Custom Prompt Generation Node using ChatGPT" appeared in late 2023, and this is that idea done cleanly - the key being that the endpoint is configurable, not glued to OpenAI.
The api dropdown is actually built from your config.yaml - the openai_host list. That's the detail that makes this node more useful than it looks: any OpenAI-compatible server works. LM Studio, Ollama's OpenAI shim, vLLM, a proxy, or the real OpenAI API are all just entries in that list, and the node's dropdown fills itself from it. Same for the key: openai_key in the config becomes the Authorization header, and if it's empty, no header is sent - which is exactly right for local servers that don't want one. Real OpenAI needs a key; your local model doesn't.
The inputs that matter
- system_prompt - the instructions, defaulting to the stock "You are ChatGPT…". This is where you tell the model how to write image prompts.
- user_prompt - your raw idea.
- model - a free-text string, default
gpt-4; type whatever your endpoint supports. - api - the dropdown from
openai_hostinconfig.yaml. - temperature (default 1.0), presence_penalty, max_tokens (2048).
- async_infer -
YES/NO;NOblocks and streams the full reply,YESreturns an empty string plus agenerate_ctx(GPT_GEN_CTX) for deferred handling.
Outputs: prompt (STRING) and generate_ctx.
Setting it up
Create config.yaml in the pack's config/ folder (the pack copies the example automatically on first load) and restart:
openai_key: <your key, or leave blank for local servers>
openai_host:
- https://api.openai.com/v1/chat/completions
- http://127.0.0.1:1234/v1/chat/completions # e.g. LM Studio
Then install the pack the usual way (ComfyUI Manager → search fexli-util-node-comfyui, or git clone into custom_nodes + pip install -r requirements.txt), restart, and the new hosts show up in the dropdown.
Where people get burned: config edits require a restart - the config is read once at import, so adding a host while ComfyUI is running does nothing until you relaunch. And streaming replies mean the node blocks your queue for the duration of the generation; if your server is slow, the whole graph waits. That's also why async_infer exists. Watch the ComfyUI console, too - that's where retry/error tracebacks land, not in the UI.
It's the node from this pack I'd actually put in a workflow: real LLM prompt expansion against whatever server you already run, no lock-in. The "BC" nodes are tied to the author's infra; this one works with yours.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| system_prompt | STRING | You are ChatGPT, a large language model trained by OpenAI. | — |
| user_prompt | STRING | Hello World! | — |
| model | STRING | gpt-4 | — |
| api | COMBO | 1 options: https://api.openai.com/v1/chat/completions | |
| temperature | FLOAT | 1.000–2 | — |
| presence_penalty | FLOAT | 0.000–10 | — |
| max_tokens | INT | 20480–2048 | — |
| async_infer | COMBO | NO | 2 options: YES, NO |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| generate_ctx | GPT_GEN_CTX | — |