AQ_SendImageToAPI
POST your generated images to any endpoint from inside the graph
- images
- instruction
- result
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:
- converts the tensor to a PIL image,
- encodes it as PNG, JPEG, WEBP, or AVIF (
image_format) at the givenquality(ignored for lossless PNG), - gzip-compresses it (
compression_level, 0–9) and base64-encodes it, - builds a payload of
{"images": [{"image_name", "image_data", "is_gzipped"}], "jobId", "userId"}and POSTs it with anAuthorization: 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 sendsBearer YOUR_API_KEYhappily; 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
instructionoutput is a few kilobytes of help text. Don't wire it into a text display and panic about a broken workflow - that's intentional. resultonly 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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| api_endpoint | STRING | https://yourapiendpoint.com/upload | — |
| api_key | STRING | YOUR_API_KEY | — |
| batch_size | INT | 101–100 | — |
| image_format | COMBO | PNG | 4 options: PNG, JPEG, WEBP, AVIF |
| quality | INT | 851–100 | — |
| verify_ssl | BOOLEAN | true | — |
| image_name_prefixopt | STRING | image | — |
| jobIdopt | STRING | — | |
| userIdopt | STRING | — | |
| compression_levelopt | INT | 60–9 | — |
| send_gzippedopt | BOOLEAN | true | — |
| show_progress_logsopt | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| instruction | STRING | — |
| result | STRING | — |