Zhenzhen ChatGPT Api:
ComflyChatGPTApi sends a prompt to a configured chat-completions API and reads its streamed reply. It can include images or files with the request, making it useful for workflows that ask for image analysis, creative direction, or image generation through a compatible model. When the reply contains image links, the node attempts to download those images for use elsewhere in your ComfyUI workflow. It also keeps a readable record of prompts and replies. The model and API service determine what content can be produced; the node itself does not guarantee that a request will generate an image.
Zhenzhen ChatGPT Api Input Parameters:
prompt
Required STRING. Write the instruction or question you want to send to the model; the field supports multiple lines. For example, you can describe an image to create or ask a question about an attached image. The prompt is sent as text in the current request. No default, minimum length, or maximum length is specified in the node interface.
model
Required STRING. Enter the model identifier accepted by your configured API service. The interface defaults to gpt-4o-image; no general list of supported models is defined in the source. The node explicitly rejects gpt-image-1 and suggests gpt-4o-image, gpt-4o-image-vip, sora_image, or sora_image-vip instead. Choosing a model that the service does not recognize may cause the request to fail.
api_key
Optional STRING; default: empty. This is the credential used to authorize the API request. If left empty, the node uses the API key already stored in the project configuration. Entering a nonempty value updates that stored key, so be mindful when sharing a workflow or using a shared installation. No length limit is specified. The node cannot make a successful request without an available key.
files
Optional FILES input; no default or file-count limit is specified. Connect a file path or a list of file paths to attach files to the request. The node encodes each readable file: files identified as images are sent as image content, while other files are sent as file content with their filenames. Whether a particular file type can be analyzed depends on the API service and model. Files that cannot be opened are logged and skipped.
image_url
Optional STRING; default: empty. Supply a URL for an image you want the model to consider. When clear_chats is on, the node uses this URL if no images input is connected; when clear_chats is off, it can use this URL if no previously saved generated-image URL is available. No URL-format validation or length range is specified in the interface, so use an image address accessible to the API service.
images
Optional IMAGE input; no default image is provided. Connect an image or image batch for the model to consider. With clear_chats on, the node sends up to the first four images as PNG data; any additional images are omitted from the request and noted in its text. This input also serves as a fallback image output if no image can be downloaded, or if an error is suppressed. With clear_chats off, connected images are not added to the request by this code path.
temperature
Optional FLOAT; default: 0.7, minimum: 0.0, maximum: 2.0, step: 0.01. This value is passed to the API as a response-generation setting. Lower values are generally used when you want more consistent wording, while higher values allow more variation, subject to how the selected model handles the setting. It does not directly control image resolution or guarantee a particular visual result.
max_tokens
Optional INT; default: 4096, minimum: 1, maximum: 16384, step: 1. This value is sent as the response-token limit. A low limit may leave a text reply incomplete; a higher limit permits a longer reply if the model and service support it. The source does not define a corresponding image-size or image-count control.
top_p
Optional FLOAT; default: 1.0, minimum: 0.0, maximum: 1.0, step: 0.01. This is passed to the API as another response-generation setting that can affect which words are considered during generation. The node does not interpret it locally. For a straightforward starting point, keep the default and adjust it only if your selected model supports the setting and you need to tune the response.
frequency_penalty
Optional FLOAT; interface default: -2.0, minimum: -2.0, maximum: 2.0, step: 0.01. The value is passed to the API as a setting related to repeated wording; the node does not apply a penalty itself. If you are trying to reduce repetition in a text reply, test values supported by your model. Note that the process method has a fallback default of 0.0 when this argument is not supplied programmatically, which differs from the interface default shown in ComfyUI.
presence_penalty
Optional FLOAT; default: 0.0, minimum: -2.0, maximum: 2.0, step: 0.01. This value is passed to the API as a setting that may influence whether the reply introduces new topics rather than repeating existing ones. Its effect depends on the selected model and service. Leave it at 0.0 unless you have a specific reason to tune the wording of the reply.
seed
Optional INT; default: -1, minimum: -1, maximum: 2147483647. At -1, the node selects a random integer in the allowed nonnegative range and sends it with the request. Set a fixed nonnegative value when you want to repeat the same seed in later requests. A matching seed alone does not guarantee identical results because the API service and model determine how it is used.
image_download_timeout
Optional INT; interface default: 600, minimum: 300, maximum: 1200, step: 10. This setting controls how long the node allows when downloading each image URL found in the reply, as interpreted by its download helper. Increase it within the interface range if image downloads regularly time out. It does not change the API request timeout, which is set separately in the node source. The process method has a fallback default of 120 when called without this argument, differing from the interface default.
clear_chats
Optional BOOLEAN; default: True. When True, the node clears its recorded conversation history for this execution and considers the connected images input or image_url as described above. When False, it retains its recorded history and, if a previous generated-image URL has been saved, sends the first such URL with the new prompt. Importantly, the source builds each API request with only the current message: retained history is displayed in chats but is not sent back to the model as prior conversation.
skip_error
Optional BOOLEAN; default: False. When False, most execution failures raise an error so you can see that the workflow did not complete as intended. When True, the node suppresses those failures and returns the connected images input, or a white 512 × 512 image if none is connected, along with an error message where applicable. Use it when a downstream workflow needs a fallback, but check the returned text so a fallback is not mistaken for a generated result. The special gpt-image-1 rejection returns a white image without raising when no images input is connected, even if this setting is False.
Zhenzhen ChatGPT Api Output Parameters:
images
IMAGE output in socket position 1. When the reply contains image URLs and downloads succeed, this contains the downloaded image or images combined into a batch for downstream ComfyUI nodes. If no download succeeds, the node may return the connected images input; where a fallback is allowed and no input image exists, it returns a white 512 × 512 image. A returned image therefore does not, by itself, prove that the API generated a new image. Downloaded images must also be compatible for batching; an image-processing failure can prevent them from being returned.
response
STRING output in socket position 2. On the normal success path, this is a short technical summary containing the model, temperature, seed, and local execution time; it is not the model's full written reply. On certain fallback paths it instead contains an error message. Check chats for the model's reply and image_urls for extracted links.
image_urls
STRING output in socket position 3. This contains image URLs extracted from the model's written reply, separated by newlines, or an empty string if none are found. The node first looks for Markdown image links, then direct links ending in a common image extension, then other URL-like text. An extracted URL is not proof that it points to a downloadable image; download problems can leave this output populated while images contains a fallback.
chats
STRING output in socket position 4. This is a readable record of prompts and model replies stored by this node instance, formatted with “User” and “AI” labels. With clear_chats on, it normally contains only the current exchange; with that setting off, earlier recorded exchanges may remain. It is useful for reading the model's actual response, but this displayed history is not itself sent as conversation history in subsequent API requests.
Zhenzhen ChatGPT Api Usage Tips:
- Start with a clear
promptdescribing the subject, style, and intended outcome. For image work, inspectchatsto see what the model actually said, then useimage_urlsandimagesto check whether an image was linked and downloaded. - For a new request using connected images, leave
clear_chatsset to True. Connect up to four images that matter most; the node omits later images from a larger batch. - For a follow-up intended to use a previously generated image, set
clear_chatsto False and confirm that a previous run produced an image URL. This passes the first saved URL with the new prompt; it does not pass the earlier text conversation to the model. - Use a fixed
seedwhen comparing prompt or setting changes, and leave it at -1 when you want the node to choose a new random seed. Record the model and settings alongside the seed when comparing results. - If links appear in
image_urlsbut no new image appears inimages, check the terminal for download errors. Increasingimage_download_timeoutmay help with slow downloads; it will not fix an inaccessible or non-image URL. - Leave
skip_erroroff while setting up or debugging a workflow. Turn it on only when you deliberately want the workflow to continue with an input-image or white-image fallback.
Zhenzhen ChatGPT Api Common Errors and Solutions:
API key is empty. Enter it in the current workflow or connect Zhenzhen API Settings.
- Explanation: The node found no key in either
api_keyor its stored project configuration, so it cannot authorize the request. - Solution: Enter a valid key in
api_keyor configure one through Zhenzhen API Settings. Ifskip_erroris off, the node raises an error; if it is on, the node returns a fallback image and this message.
不支持此模型,请使用 gpt-4o-image,gpt-4o-image-vip,sora_image,sora_image-vip 这4个模型。
- Explanation: The
modelvalue isgpt-image-1, which this node explicitly blocks. The Chinese message says this model is unsupported and names four alternatives. - Solution: Change
modelto an identifier accepted by your API service, such as one of the alternatives in the message. If animagesinput is connected andskip_erroris off, this condition raises an error; without animagesinput, the source returns a white fallback image and the message.
API request timed out after 800 seconds
- Explanation: The streaming API request exceeded the node's fixed request timeout of 800 seconds. This timeout is separate from
image_download_timeout. - Solution: Check that the API service is reachable and responding, then retry. Reduce the scope of a large request if appropriate. Changing
image_download_timeoutwill not extend this API request timeout.
Error in streaming response: …
- Explanation: The node encountered a problem while opening or reading the API's streamed response. The remaining text should provide the underlying error, such as an HTTP failure.
- Solution: Read the full message in the ComfyUI terminal. Check your key, model identifier, service availability, and whether the selected service accepts the attached content and settings.
Error encoding file: …
- Explanation: The node could not open or read one of the paths supplied through
files. It logs this message and skips that file rather than necessarily stopping the request. - Solution: Confirm that the file still exists, its path is correct, and ComfyUI has permission to read it. Check the terminal if a reply seems to ignore an attachment.
Timeout error downloading image from … (timeout: …s)
- Explanation: An image link was found in the reply, but its download took too long. Other image links may still be attempted.
- Solution: Check that the link is accessible and, for slow hosts, increase
image_download_timeoutwithin its allowed range. If downloads repeatedly fail, inspect the link inimage_urlsand the terminal log.
SSL Error downloading image from …
- Explanation: The secure connection to an image host failed during download.
- Solution: Check the image host's link and certificate from your environment, or use an image URL hosted by a service with a working secure connection. The node may still return another successfully downloaded image or a fallback.
Connection error downloading image from …
- Explanation: The node could not establish a connection to the image URL extracted from the reply.
- Solution: Check network access and the URL in
image_urls, then retry. A URL appearing in the model's reply does not guarantee that the host is reachable.
Warning: URL doesn't point to an image. Content-Type: …
- Explanation: The download response did not identify itself as image content. The node still attempts to open it as an image, which may then fail.
- Solution: Check whether the extracted URL leads to an actual image rather than a webpage, sign-in page, or expired link. Use a direct, accessible image link where possible.
Error downloading image from …
- Explanation: The node could not open or convert content returned by an image URL. The terminal message includes the underlying reason.
- Solution: Inspect the URL and confirm that it returns a supported, readable image. If the link has expired, generate or supply a fresh one.
Error processing image URLs: …
- Explanation: Image handling failed after the reply was received, potentially while combining downloaded images into one batch.
- Solution: Check the terminal details and inspect the returned links. If the reply links to multiple images with incompatible dimensions, try working with a single image or consistently sized images.
[ Zhenzhen ChatGPT Api] 节点执行失败,请查看终端日志
- Explanation: The request completed, but the node had no downloaded image to return and no connected
imagesinput to use as a fallback. The Chinese message asks you to check the terminal log. This occurs whenskip_erroris off; with it on, the node can return a white image instead. - Solution: Read
chatsandimage_urlswhen available, and inspect the terminal for failed downloads. Confirm that the selected model and prompt produce an image link if your workflow requires an image.
Error calling ChatGPT API: …
- Explanation: This is the node's wrapper message for an exception during execution. Its remaining text identifies the more specific problem, which may include a missing key, streaming failure, or image-handling error.
- Solution: Follow the specific detail after the colon and check the ComfyUI terminal. Keep
skip_erroroff during diagnosis so failures remain visible instead of being replaced by fallback output.
