OpenAI Generate Text
An LLM Call, Wired Straight Into Your Workflow Logic
- history
- text
- history
- payload
A lot of the interesting ComfyUI workflows these days aren't really about generation - they're about an LLM deciding something, then the graph acting on it. YogurtOpenAIGenerateText is the node that makes that decision: a full OpenAI chat call whose output lands as a STRING you can branch on, feed into a prompt, or log.
The controls you'll actually touch:
api_key- inline, or blank to fall back to the pack'sapi_key.jsonorOPENAI_API_KEY.model_name- defaults togpt-5.1.system_promptandprompt- the system framing and the user message. Multiline, so real prompting fits.temperatureandtop_p- sampling heat and diversity.top_pdefaults to 0, which means "not enforced" here.max_tokens- output ceiling (default 4096).frequency_penalty/presence_penalty- dials for repetition and topic drift, both -2 to 2.retry_count,timeout,proxy_url- resilience.chat_template- the default template wraps{{system_instruction}}and{{prompt}}in<-system->/<-user->markers, and you can restructure it freely.
Optional inputs: history (feed the previous turn's HISTORY output for a multi-turn conversation) and extra (raw JSON added to the request body). Outputs: text (the reply), history (chain it back in for the next call), and payload - the raw response object, for when you need more than the text.
How you'd use it
The classic loop: ask the model to analyze a prompt or an image caption and output a yes/no or a structured answer, then wire text into a switch or conditional. The history output makes real back-and-forth possible - a discussion with the model that spans multiple node calls instead of a single shot. And the base_url flexibility is quietly the best feature: point it at Azure or any OpenAI-compatible endpoint (LocalAI, Ollama, a self-hosted proxy) and this node becomes your universal LLM connector.
Install and keys
Ships in ComfyUI-YogurtNodes, the pack's LLM family (OpenAI, OpenRouter, Gemini, Grok, Qwen, Vertex AI - same client pattern throughout). ComfyUI Manager → search ComfyUI-YogurtNodes → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart ComfyUI, look under "Yogurt Nodes/LLM". Requires the openai Python package; no models to download.
Key gotcha: this node does one call per run - it's not a chat session unless you wire history back around. And watch max_tokens vs the model's real output length; a truncation at 4096 tokens can silently chop an answer the downstream node was expecting whole.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | API key for accessing OpenAI API | |
| base_url | STRING | Base URL for OpenAI API (leave blank for official API) | |
| model_name | STRING | gpt-5.1 | OpenAI model name |
| system_prompt | STRING | System-level prompt that affects the overall conversation style | |
| prompt | STRING | Main prompt content input by the user | |
| temperature | FLOAT | 1.000–2 | Sampling temperature, higher values produce more random outputs |
| top_p | FLOAT | 0.000–1 | Sampling probability threshold, controls output diversity |
| max_tokens | INT | 40960–32768 | Maximum number of tokens in the generated text |
| frequency_penalty | FLOAT | 0.00-2–2 | Frequency penalty to reduce repetition |
| presence_penalty | FLOAT | 0.00-2–2 | Presence penalty to encourage new topics |
| retry_count | INT | 11–10 | Number of retry attempts if the request fails |
| chat_template | STRING | <-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user-> | Content template for the generated text |
| proxy_url | STRING | 代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h | |
| timeout | INT | 00–2147483647 | Timeout for the request in seconds, 0 means no timeout |
| historyopt | HISTORY | — | |
| extraopt | STRING | {} | Extra parameters for the request, in JSON format |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| history | HISTORY | — |
| payload | * | — |