GPT
The GPT node that rewrites your prompt — then pastes the result into its own text box
- STRING
GPT is a prompt-enhancer node: you feed it a rough idea, it calls OpenAI's chat API to expand it into a long, detailed English Stable Diffusion prompt, and then - here's the odd part - it writes that improved prompt straight into its own result textbox on the canvas instead of handing it to you through the output. It's like a friend who tells you what you should have said and then writes it on a sticky note.
Why does it exist? Because the rest of this pack talks to memeplex.app, and that API expects a clean, mostly-English prompt. The node's system message (written in Japanese, hardcoded in the source) tells GPT to produce a detailed prompt of at least 30 words, in English, in JSON format, with nothing extra. The design intent is obvious: rough Japanese text in, polished SDXL-style prompt out.
How it works
You give it text (a forced string input), prompt (a multiline box for your actual request or extra instruction), and pick a model - gpt-3.5-turbo or gpt-4-1106-preview. It calls OpenAI chat completions with response_format set to JSON, parses the result, and retries up to five times if the JSON doesn't come back clean. Then it POSTs the enhanced prompt to http://localhost:8188/memeplex/update_text - a route this same pack registers on ComfyUI's server - and the pack's frontend JavaScript drops that text into the node's result widget.
Here's the quirk to know before you build a workflow around it: the STRING output returns your original text input, not the generated prompt. The generated prompt lives in the result textbox on screen. So treat the result box as the real product - copy it from there, or wire the node's output onward knowing it's a passthrough of what you typed in.
Inputs that matter
model- gpt-4 for noticeably better prompts, gpt-3.5 if you're watching cost. Each run is a paid API call.promptandtext- together they form the instruction; the source concatenates the hardcoded system message withpromptthentext.result(optional) - the box the enhanced prompt gets pasted into by the frontend.
Installing and using it
Same story as the rest of the pack: clone into custom_nodes, pip install openai, and edit nodes.py to replace the placeholder OPENAI_API_KEY with a real key - the import line overwrites any environment variable, so a shell export won't save you. Restart after editing. The README's "fill API keys in code" instruction is literal.
Two gotchas worth knowing. First, the POST target is hardcoded to port 8188 - if your ComfyUI runs on a different port, the update silently fails and your enhanced prompt never lands. Second, the five retries on JSON-parse failure mean one bad run can cost you five API calls; that's mildly annoying on gpt-3.5 and genuinely rude on gpt-4. Honestly, for prompt expansion most people end up happier with a local LLM node you're not paying per token for - but if you already have an OpenAI key and just want the memeplex pipeline to work end to end, this is the piece that makes the renders sing.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| prompt | STRING | — | |
| model | COMBO | 2 options: gpt-3.5-turbo, gpt-4-1106-preview | |
| resultopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |