Ugleh OpenAI - Responses Text
The Ugleh Responses Text Node
- text_out
You've got a good idea for an image and a clumsy first draft of a prompt. This node is the fix: it ships your rough text off to OpenAI's Responses API and hands the polished answer back as a plain string you can feed straight into a CLIP Text Encode. One node, one output, no GPU touched, no local model to download. It's the minimal end of the "let a language model do your prompting" spectrum, and that minimalism is exactly its selling point.
It's the text-only sibling of ComfyUI's own official API nodes that landed for GPT-Image-1 back in 2025. Same idea - a cloud round trip inside your graph - minus the images. The tradeoffs are baked in: every call costs real money per token, it needs an API key, and you're talking to OpenAI's servers, so whatever they won't say, you won't get. If you want a private, uncensored local LLM, this isn't that. If you just want better prompts without leaving the graph, it's perfect.
The canonical workflow: rough idea into input, something like "Expand this into a detailed, comma-separated image prompt" into instructions, then wire text_out into a CLIP Text Encode's prompt. Instant prompt enhancement at generation time. It'll happily rewrite, translate, or brainstorm captions too - but rewriting prompts is the use case that justifies paying for a round trip.
How it works. Under the hood it's a thin wrapper around the openai Python SDK. Run the node and it loads your key, builds a client, and calls responses.create() with the model, your instructions as the system prompt, your input, the reasoning effort, and the token cap - then returns response.output_text. The pack keeps a tiny service layer so the node itself stays dumb. Nothing clever, which is the point.
The inputs that matter:
model- a dropdown of ten models, fromgpt-4o-miniup to thegpt-5family. For prompt rewriting,gpt-4o-miniorgpt-4.1-nanois the sensible, cheap default. Break outgpt-5when you need actual reasoning, and watch the bill.instructions- the system prompt, multiline, default "You are a helpful assistant." This is where you tell it what to do with your text.input- your text, multiline.reasoning_effort-low/medium/high. It steers how much the reasoning models think before answering;lowis plenty for rewriting,highis slower and pricier.max_output_tokens- defaults to 300. Raise it for long rewrites, but every token is money.
The output is text_out, a plain STRING. Wire it into any node with a string input; CLIP Text Encode is the obvious target. If you want to eyeball the result before it touches a sampler, run it through a text display node first.
Install. ComfyUI Manager, search "Ugleh" and hit install - or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/Ugleh/ComfyUI-ugleh-OpenAI
cd ComfyUI-ugleh-OpenAI
pip install -r requirements.txt
then restart ComfyUI. Dependencies are modest - openai>=2.0.0 and python-dotenv, both legitimate PyPI packages. Then the key: create a file called .env in your ComfyUI root folder containing OPENAI_API_KEY=sk-..., or export it in your shell. No model files, no VRAM, runs on any machine ComfyUI runs on.
Where people get burned:
- Key not found - the node throws "OPENAI_API_KEY is not set." The pack's
load_dotenv()reads.envfrom the current working directory, which is only your ComfyUI root if you launch from there. An exported environment variable is the more robust option. - Stale openai SDK - the Responses API needs
openai>=2.0.0. If you hit anAttributeErroronoutput_text, an old SDK from another pack is shadowing it;pip install -U openaifixes it. - Billing and access - a 404 on a model you picked usually means your account tier can't reach it, not a broken node. And don't leave
gpt-5at high reasoning_effort on autopilot; that bill sneaks up on you.
One aside: Ugleh is the same handle behind the QR-code-monster workflows and tutorials from 2023, so this is a veteran tinkerer's clean take, not a random script. It does exactly one thing, plainly. If you need vision, chat memory, or multiple backends you'll outgrow it fast - if you want a tidy text round trip, it's hard to beat. Usual custom-node rule applies: installing any node runs its code, so use Manager, and keep your API key out of any workflow you share.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 10 options: gpt-4o, gpt-4o-mini, chatgpt-4o-latest, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, +4 | |
| reasoning_effort | COMBO | 3 options: low, medium, high | |
| instructions | STRING | You are a helpful assistant. | — |
| input | STRING | — | |
| max_output_tokens | INT | 300 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text_out | STRING | — |