OpenAI API - Image Batch List to Images
Look Before You Spend
- image_batches
- Images
What it is
A debugging node, and the one you'll be glad exists the first time you wire up a twenty-request batch and can't see what's inside it.
OAIAPI_IMAGE_BATCH_LIST is a custom type. Preview Image can't consume it, Save Image can't, nothing can except the nodes in this pack that expect it. So once you've built up a grouping with Image Batch List or Image Batch to List, you're flying blind - and if the grouping is wrong, you find out by paying for twenty API requests that describe the wrong images.
This node turns the grouping back into plain IMAGE output so Preview Image can show it. Wire it in parallel with your batch node, look at what's actually in each group, then spend the money.
How it works
The input payload is a list of groups, each group being one batch tensor or a list of image tensors. The node walks them in invocation order, unbinds batches into individual images, and emits each one as a separate entry in an IMAGE execution list - one output entry per image, preserving both invocation order and the order of images inside each group, at original resolution. Differently-sized images stay individual tensors rather than being forced into a shared batch, which is why it stays honest about sizes.
Invocation Index decides the scope. -1 emits every group, in order - the whole batch flattened into one list. 0 emits only the first group, 1 the second, and so on. Since Preview Image walks an execution list and renders each entry, -1 gives you a contact sheet of everything the batch node was about to receive.
Out-of-range indices are rejected with a message that tells you how many invocations were available, which is a nicer way to discover your batch is 6 groups and not 20 than reading the API bill.
There's one behaviour to internalise: common images appear again in every invocation that includes them. If you prepended a style reference to all eight groups, the preview shows it eight times. That's not a bug - it's a faithful picture of what the model will receive, which is the entire point of the node.
Inputs and outputs
- Image Batches (
image_batches) - the payload from Image Batch List or Image Batch to List. Required. - Invocation Index (
invocation_index) - integer, default-1, minimum-1, step 1.-1previews all invocations in order;0is the first,1the second, and so on.
Output: Images - an IMAGE execution list, one entry per image in invocation and image order. Connect it to Preview Image.
Install
It ships in the pack. ComfyUI Manager → search OpenAI API or Comfpod, or:
cd ComfyUI/custom_nodes
git clone https://github.com/lany42/comfyui-openai-api
cd comfyui-openai-api
/path/to/ComfyUI/.venv/bin/python -m pip install -r requirements.txt
# restart ComfyUI
The openai SDK v2 (>=2.7.1,<3), numpy and Pillow are the runtime dependencies. Python 3.13+.
Where to put it
Two places, usually. Right after whichever image helper built the grouping, before the batch node - that's your pre-flight check, and it's free. And on a second branch off the same output, so you can flip between "what went in" and "what came out" without rewiring.
Because it feeds an execution list into Preview Image, the preview will step through every image rather than showing them all at once. With -1 on a 20-group batch that's a lot of clicks - for a quick sanity check, set the index to 0 and confirm the first group looks right, then trust the rest.
Where people get burned
Preview shows the reference image over and over. Expected - common images are repeated per group by design. If you see it exactly once, your Common Images connection is landing somewhere it shouldn't.
Index out of range. The count is the number of image groups, not the number of images. A six-image batch split by Image Batch to List is six invocations and worth six in the message; connect Image Batch List with four slots and it's four. When in doubt, leave it at -1.
Comparing this to the responses and getting lost. The preview list and the Responses list are in the same order, so position three of one corresponds to position three of the other. That correspondence is the only reason this node is worth wiring rather than eyeballing the inputs.
A group that's empty or wrongly typed. Shape and content are validated per image, and the error names the exact group and index. Take the message literally - it's usually a batch that never got connected rather than a bug.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_batches | OAIAPI_IMAGE_BATCH_LIST | Output from Image Batch List or Image Batch to List; each group corresponds to one Batched Chat Completion invocation | |
| invocation_index | INT | -1 | -1 previews all invocations in order; 0 selects the first invocation, 1 the second, and so on |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Images | IMAGE | One image per execution-list entry, in invocation and image order; connect to Preview Image |