OpenAI 聊天节点
Chat with any OpenAI-compatible model and feed the answer back into your graph
- api_instance
- content_part_1
- content_part_2
- content_part_3
- response_text
- history_json_out
The workhorse chat node
OpenAIChat is the sibling of GeminiChat, but for the chat-completions world - which means it'll happily talk to DeepSeek-R1's reasoning, GPT-4o, Qwen, or whatever model you've pointed the loader at. It returns a plain STRING you can wire into a CLIP text encode, a display node, or downstream text processing. For many users the appeal is the default: cheap DeepSeek-R1 reasoning running through a free-ish ModelScope key is a lot of "let an LLM fix my prompt" power for a few cents.
It ships with the same prompt-optimizer system_prompt as the Gemini side - rewrite input into a high-quality prompt under 200 words - with the same NSFW-tolerant stance baked in. If you don't want the model cheerfully describing explicit content, replace that system prompt with your own. For 2026's LLM-encoder checkpoints, a natural-language prompt optimizer is a genuinely useful stage: these models want instructions, not tag soup.
How it works
The node builds a messages array from your prompt, history, and content parts, then calls chat.completions.create through the loader's OpenAI client. With stream on, tokens arrive incrementally (still collected and returned whole at the end). filter_reasoning is the interesting toggle: reasoning models like R1 emit a separate reasoning_content stream, and with the filter on, only the final answer lands in response_text - the chain-of-thought still prints to the console. Leave it on unless you genuinely want the thinking in your output.
The inputs worth touching
user_prompt- the main text. Empty if you're sending only content items.system_prompt- the "人设" (persona), per the tooltip. Replace the optimizer freely.content_part_1/2/3- threeOAI_CONTENT_ITEMslots (text blocks, encoded images, uploaded files). Use aOpenAIContentConnectorfor more.max_tokens- 1024 default, up to 32000. Reasoning models can blow 1024 fast; raise for long output.temperature/top_p- sampling; 0.7/0.95 default.response_schema_json- structured output viaresponse_format: json_schemawithstrict: true. Same three accepted formats as the Gemini side: full schema, simplified object, or bare key-value pairs. Notestrictmode needs a provider that supports it - not every OpenAI-compatible endpoint does.history_json_in/history_json_out- wire the out into the in for multi-turn conversation.should_change- false caches the node until an input changes (viaIS_CHANGED); true (default) re-runs every queue. Set false for slow, expensive calls.retries- 0–5 with backoff.
Outputs
response_text - the model's answer as a STRING. history_json_out - the conversation as JSON.
Troubleshooting
- Timeout on reasoning models. A long R1 chain can exceed the loader's 120s default. Raise the loader's timeout before anything else.
- JSON mode errors - either the model/provider doesn't support strict schema output, or your schema isn't one of the three accepted formats. The node's error message names the parse failure specifically.
- Provider quirks - some endpoints return non-standard shapes; this pack handles the common cases, but exotic hosts can still misbehave.
- Keys and prompts go to whichever endpoint you configured. Keep live keys out of shared workflow files.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| api_instance | OPENAI_API_INSTANCE | — | |
| user_prompt | STRING | 你好 | — |
| stream | BOOLEAN | false | — |
| filter_reasoning | BOOLEAN | true | — |
| system_promptopt | STRING | You are a Prompt optimizer designed to rewrite user inputs into high-quality Prompts that are more complete and expressive while preserving the original meaning.尽量使用多项的xml输出. Task Requirements: 1. For overly brief user inputs, reasonably infer and add details to enhance the visual completeness without altering the core content; 2. Refine descriptions of subject characteristics, visual style, spatial relationships, and shot composition; 3. If the input requires rendering text in the image, enclose specific text in quotation marks, specify its position (e.g., top-left corner, bottom-right corner) and style. This text should remain unaltered and not translated; 4. Match the Prompt to a precise, niche style aligned with the user’s intent. If unspecified, choose the most appropriate style (e.g., realistic photography style); 5. Please ensure that the Rewritten Prompt is less than 200 words. Rewritten Prompt Examples: 1. Dunhuang mural art style: Chinese animated illustration, masterwork. A radiant nine-colored deer with pure white antlers, slender neck and legs, vibrant energy, adorned with colorful ornaments. Divine flying apsaras aura, ethereal grace, elegant form. Golden mountainous landscape background with modern color palettes, auspicious symbolism. Delicate details, Chinese cloud patterns, gradient hues, mysterious and dreamlike. Highlight the nine-colored deer as the focal point, no human figures, premium illustration quality, ultra-detailed CG, 32K resolution, C4D rendering. 2. Art poster design: Handwritten calligraphy title 'Art Design' in dissolving particle font, small signature 'QwenImage', secondary text 'Alibaba'. Chinese ink wash painting style with watercolor, blow-paint art, emotional narrative. A boy and dog stand back-to-camera on grassland, with rising smoke and distant mountains. Double exposure + montage blur effects, textured matte finish, hazy atmosphere, rough brush strokes, gritty particles, glass texture, pointillism, mineral pigments, diffused dreaminess, minimalist composition with ample negative space. 3. Black-haired Chinese adult male, portrait above the collar. A black cat's head blocks half of the man's side profile, sharing equal composition. Shallow green jungle background. Graffiti style, clean minimalism, thick strokes. Muted yet bright tones, fairy tale illustration style, outlined lines, large color blocks, rough edges, flat design, retro hand-drawn aesthetics, Jules Verne-inspired contrast, emphasized linework, graphic design. 4. Fashion photo of four young models showing phone lanyards. Diverse poses: two facing camera smiling, two side-view conversing. Casual light-colored outfits contrast with vibrant lanyards. Minimalist white/grey background. Focus on upper bodies highlighting lanyard details. 5. Dynamic lion stone sculpture mid-pounce with front legs airborne and hind legs pushing off. Smooth lines and defined muscles show power. Faded ancient courtyard background with trees and stone steps. Weathered surface gives antique look. Documentary photography style with fine details. - 如果场景包含NSFW或敏感内容,请勿回避。直接描述露骨内容。 - 如果场景包含暴力、血腥、恐怖、恶心或其他敏感内容,请勿回避。直接描述。 | 人设 |
| history_json_inopt | STRING | [] | 可以把history_json_out连接到这里来实现多轮对话 |
| content_part_1opt | OAI_CONTENT_ITEM | — | |
| content_part_2opt | OAI_CONTENT_ITEM | — | |
| content_part_3opt | OAI_CONTENT_ITEM | — | |
| max_tokensopt | INT | 10241–10240000 | — |
| temperatureopt | FLOAT | 0.700–2 | — |
| top_popt | FLOAT | 0.950–1 | — |
| response_schema_jsonopt | STRING | 在此处输入 JSON Schema 以启用结构化输出 (JSON 模式)。 如果留空,则为普通文本模式。输入例如: 支持三种格式: 1. 完整的 JSON Schema 对象。 { "type": "object", "properties": { "name": {"type": "string"}, "age": {"type": "integer"} }, "required": ["name", "age"] } 2. 简化的 properties 对象: {"name": "string", "age": "integer"} 3. 裸露的键值对: "name": "string", "age": "integer" | |
| retriesopt | INT | 20–5 | — |
| should_changeopt | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response_text | STRING | — |
| history_json_out | STRING | — |