Nodes/ComfyUI-APIMaster/APIMaster Image to Image
ComfyUI Node

APIMaster Image to Image

References work great, the mask is a URL (that's the trap)

By apimaster-ai·Created 21 days ago·Updated 17 days ago· 1
APIMaster Image to Image
  • config
  • image
  • image_2
  • images
  • urls
◄promptreplace the background with a desert sunset►
◄modelgpt-image-2►
◄sizeauto►
◄resolution1k►
◄modesync►
◄mask_url►
◄model_override►

Prompt-only generation is a slot machine. Image-to-image is where these cloud models actually earn their keep - you hand over a photo, a render or a scribble and say "make this a desert sunset", "put this jacket on that model", "match the lighting of image two". Locally you'd buy that with a ControlNet stack, a pile of VRAM and a sampler. Here you buy it with a request body.

APIMaster Image to Image is the pack's node for that: reference image(s) in, IMAGE out, in whatever shape the gateway returns.

How it works

This is the part worth understanding, because it explains most of the gotchas. A ComfyUI IMAGE is a tensor - it can't travel over HTTP as-is. So the node walks the batch, converts each frame to a PNG, base64-encodes it, and sends it as a data URI in the request payload alongside your prompt. Up to 8 frames per input, and with both image inputs populated you can reach 16 references total - above that it raises rather than pretending. The response comes back as URLs, which get downloaded and decoded into tensors the same way the text-to-image node does.

Note what that means: your reference images leave your machine, uploaded inline in the request. That's inherent to the category, not a bug in this node, but it's worth knowing before you feed it a client's unreleased product shot.

The inputs you'll set

config (wire it from an APIMaster Config node), image (the reference - anything that outputs IMAGE: Load Image, a local sampler, a VAE Decode), prompt (defaults to replace the background with a desert sunset, which tells you what the author had in mind), model, size, resolution and mode.

size defaults to auto here, and that's deliberate - unlike the text-to-image node, the gateway can infer an output shape from your reference, so auto is a sane default. Pin a ratio when you want a specific output shape. resolution (1k / 2k / 4k) is the cost lever, and mode is sync / async: same advice as everywhere else in this pack, use async for 2k and up or accept that a slow gateway will hand you a HTTP 408.

Then the optional sockets, which are where the interesting work happens. image_2 takes a second reference - one for subject, one for style, or two angles of the same thing. mask_url is inpainting. model_override is for model ids that aren't in the model dropdown, including ids on a different OpenAI-compatible gateway.

Outputs: images (the IMAGE batch, wire into Preview/Save or a local detail pass) and urls (newline-joined STRING).

mask_url is a URL, not a mask

This is the thing that will confuse you if you came from local inpainting. There is no MASK socket on this node. mask_url is a plain text field expecting an address the gateway can fetch: the node builds the request with that string and never touches your local mask tensor.

So the standard local flow - Load Image, mask editor, wire the MASK out - does not connect here. To inpaint through this node your mask has to exist at a URL, hosted somewhere reachable by the service. For most people that means: do the masking locally with a local model, or host the mask yourself, or skip mask_url and describe the edit in the prompt instead (which works surprisingly often with the reference-based models). Don't spend twenty minutes looking for the MASK input that isn't there.

Second gotcha, same family: if your image input is a batch, every frame becomes a reference image. Run a four-frame batch in and you've sent four references, which is rarely what anyone means. Batch the image node down to one frame first, or send the extra ones explicitly through image_2.

Install

Manager: search APIMaster, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/apimaster-ai/ComfyUI-APIMaster

No dependencies to install - the client is standard library urllib plus the torch/numpy/Pillow ComfyUI already ships, so nothing here can conflict with your existing packs. Set APIMASTER_API_KEY before launching ComfyUI and leave the key field on the Config node empty; a key typed into a widget is saved in the workflow JSON you're about to share.

Common issues

HTTP 401 - key missing from the environment ComfyUI was launched in, or a stray quote in it. HTTP 404 - base_url without its /v1. HTTP 400 ... use the Images API - a chat model id reached an image node, usually via model_override. And if the endpoint returns images of different sizes in one batch, the node raises instead of silently resizing the smaller ones. Correct behaviour, occasionally annoying: ask for one image, or pin size.

One practical note: this is slower than pure text-to-image, since the reference has to be uploaded and processed. Iterate prompts at 1k in sync mode until the composition is right, then jump to async at higher resolution for the keeper.

CategoryAPIMaster

Inputs (10)

NameTypeDefaultDescription
configAPIMASTER_CONFIG—
imageIMAGE—
promptSTRINGreplace the background with a desert sunset—
modelCOMBOgpt-image-25 options: gpt-image-2, doubao-seedream-5-0-pro-260628, gemini-3.1-flash-image, midjourney-v8.2, midjourney-niji-7
sizeCOMBOauto16 options: auto, 1:1, 3:2, 2:3, 4:3, 3:4, +10
resolutionCOMBO1k3 options: 1k, 2k, 4k
modeCOMBOsync2 options: sync, async
image_2optIMAGE—
mask_urloptSTRING—
model_overrideoptSTRING—

Outputs (2)

NameTypeDescription
imagesIMAGE—
urlsSTRING—