OpenAI Chat API Node ComfyUI Official Example
This article will introduce how to use OpenAI Chat API nodes in ComfyUI to complete conversational functions
OpenAI is a company focused on generative AI, providing powerful conversational capabilities. Currently, ComfyUI has integrated the OpenAI API, allowing you to directly use the related nodes in ComfyUI to complete conversational functions.
In this guide, we will walk you through completing the corresponding conversational functionality.
To use the API nodes, you need to ensure that you are logged in properly and using a permitted network environment. Please refer to the API Nodes Overview section of the documentation to understand the specific requirements for using the API nodes.
OpenAI Chat Workflow
1. Workflow File Download
Please download the Json file below and drag it into ComfyUI to load the corresponding workflow.
Download Json Format Workflow File
2. Complete the Workflow Execution Step by Step
In the corresponding template, we have built a role setting for analyzing prompt generation.
You can refer to the numbers in the image to complete the basic text-to-image workflow execution:
- In the
Load Image
node, load the image you need AI to interpret - (Optional) If needed, you can modify the settings in
OpenAI Chat Advanced Options
to have AI execute specific tasks - In the
OpenAI Chat
node, you can modifyPrompt
to set the conversation prompt, or modifymodel
to select different models - Click the
Run
button, or use the shortcutCtrl(cmd) + Enter
to execute the conversation. - After waiting for the API to return results, you can view the corresponding AI returned content in the
Preview Any
node.
3. Additional Notes
- Currently, the file input node
OpenAI Chat Input Files
requires files to be uploaded to theComfyUI/input/
directory first. This node is being improved, and we will modify the template after updates - The workflow provides an example using
Batch Images
for input. If you have multiple images that need AI interpretation, you can refer to the step diagram and use right-click to set the corresponding node mode toAlways
to enable it