Nodes/AQnodes for ComfyUI/AQ_SendImageToAPI
ComfyUI Node

AQ_SendImageToAPI

POST your generated images to any endpoint from inside the graph

By 2frames·Created about a year ago·Updated 6 months ago· 1
AQ_SendImageToAPI
  • images
  • instruction
  • result
api_endpointhttps://yourapiendpoint.com/upload
api_keyYOUR_API_KEY
batch_size10
image_formatPNG
quality85
verify_ssltrue
image_name_prefiximage
jobId
userId
compression_level6
send_gzippedtrue
show_progress_logstrue

When you generate images in ComfyUI for something other than yourself, at some point you need the pixels to leave. That's what AQ_SendImageToAPI is for: it takes an IMAGE batch, re-encodes it, gzips it, and POSTs it as JSON to whatever endpoint you point it at - an app backend, a Discord bot, a gallery server, anything with an HTTP route that expects to receive images. It's the "ComfyUI as a backend for your own app" node.

The thinking behind it, per the pack README, is to stop polling ComfyUI to see whether generation finished. Instead the workflow itself fires the images off to your service the moment they exist. You run the graph, your server gets the uploads, nobody sits there refreshing a folder.

How it works

The mechanism is simple and worth knowing because you own the other end of this wire. The node batches the images (batch_size, default 10), and for each image:

  1. converts the tensor to a PIL image,
  2. encodes it as PNG, JPEG, WEBP, or AVIF (image_format) at the given quality (ignored for lossless PNG),
  3. gzip-compresses it (compression_level, 0–9) and base64-encodes it,
  4. builds a payload of {"images": [{"image_name", "image_data", "is_gzipped"}], "jobId", "userId"} and POSTs it with an Authorization: Bearer <key> header.

Your server has to decode gzip before base64-decoding when is_gzipped is true - that's the contract. The node also fires progress events to the ComfyUI frontend via PromptServer.send_sync so you get a progress bar instead of staring at a blank node.

The inputs that matter

Most of the required set is self-explanatory, but two will burn you if you leave them alone:

  • api_endpoint - defaults to the placeholder https://yourapiendpoint.com/upload. Change it.
  • api_key - defaults to YOUR_API_KEY. Also change it. The node sends Bearer YOUR_API_KEY happily; the server will 401, and it'll look like the node is broken when it's really just your placeholder.

Beyond those: image_format (PNG/JPEG/WEBP/AVIF), quality (1–100), batch_size, and verify_ssl (set false for self-signed or dev endpoints). The optional image_name_prefix, jobId, and userId tag along in the payload so your server can attribute uploads - the node's own help text admits some of these are "conceptual," so don't expect elaborate server behavior from them. compression_level and send_gzipped control the gzip stage, and show_progress_logs controls console noise.

Outputs - and the surprise

Two STRING outputs: instruction and result. The instruction output is a giant wall of text describing the node - that's not an error, it's just the node being verbose (it literally returns its own manual as a port). The result output is the useful one: it tells you what happened on the last batch, like Success: Status 200 - {...} or Error: <message>.

Installing and dependencies

Pack-level install, same as the rest of AQnodes:

cd ComfyUI/custom_nodes
git clone https://github.com/2frames/ComfyUI-AQnodes

restart, or use ComfyUI Manager and search "AQnodes". The heavy requirements.txt (transformers, insightface, segment-anything…) serves the pack's other nodes; this one mostly needs requests and pillow-avif-plugin - that last one matters if you choose AVIF as your format, because without it AVIF encoding just fails. If AVIF errors, that's your first suspect.

Gotchas

  • The instruction output is a few kilobytes of help text. Don't wire it into a text display and panic about a broken workflow - that's intentional.
  • result only reflects the last batch's outcome. With more than one batch, earlier failures scroll past; the console log has the full per-batch picture.
  • You're responsible for the server side. The payload shape above is the contract, and it's not a standard - your endpoint must accept exactly that JSON body and those headers.
  • Leaving the defaults (yourapiendpoint.com, YOUR_API_KEY) is the #1 way to think this node is broken when it isn't.
CategoryAquasite/API

Inputs (13)

NameTypeDefaultDescription
imagesIMAGE
api_endpointSTRINGhttps://yourapiendpoint.com/upload
api_keySTRINGYOUR_API_KEY
batch_sizeINT101–100
image_formatCOMBOPNG4 options: PNG, JPEG, WEBP, AVIF
qualityINT851–100
verify_sslBOOLEANtrue
image_name_prefixoptSTRINGimage
jobIdoptSTRING
userIdoptSTRING
compression_leveloptINT60–9
send_gzippedoptBOOLEANtrue
show_progress_logsoptBOOLEANtrue

Outputs (2)

NameTypeDescription
instructionSTRING
resultSTRING