DMXAPI Agnes Image 2.1 Flash
A closed image model nobody has written about, wired into your canvas
- image
- IMAGE
There's a class of image models that never trend on r/StableDiffusion and still show up in your node menu. Agnes Image 2.1 Flash is one: a closed model from Sapiens AI, resold through DMXAPI, a Chinese API aggregator fronting OpenAI, MiniMax and others behind one key and one base URL. I went looking for community signal and found none - zero threads for "dmxapi" across r/comfyui, r/StableDiffusion and r/civitai. So there's no tuning guide. Here's what the node does.
What it's for
This is an API-wrapper node - the category of node that packages your prompt and image, ships them to a cloud service, and drops the result into the graph as if a local sampler made it. It runs no model on your card; it takes your prompt (and optionally your images), posts them to https://www.dmxapi.cn, and hands the returned pixels back as a normal IMAGE you can wire into your upscaler, masker, whatever. From the canvas it's indistinguishable from a local generator. Underneath it's an HTTP client with your key in it.
The reason to reach for it is reference-driven work. Multiple reference images, one prompt, no ControlNet stack, no LoRA, no VRAM math - and it's the "Flash" tier, so it's the cheap-and-fast one rather than the prestige model. The reasons not to: you can't run it offline, your prompt and reference images leave the machine, and no amount of prompt engineering gets you past the provider's own filter.
How it works
Text-to-image and image-to-image are the same endpoint here - POST /v1/images/generations, OpenAI-compatible JSON. The only difference is whether an image rides along. That's worth internalizing because the sibling node in this pack does it differently (more on that below).
Size isn't pixels. You pick a tier and a ratio, and the model's own table decides the output dimensions:
| ratio | 1K | 4K | | --- | --- | --- | | 1:1 | 1024x1024 | 4096x4096 | | 16:9 | 1312x736 | 5248x2944 | | 21:9 | 1568x672 | 6272x2688 |
Those come from the node's source, and it logs them for you. Note 21:9 at 4K is 6272 px on the long side - past the 3840 ceiling the GPT Image node in this same pack enforces. Different upstream, different rules; don't assume the constraints carry over.
Attach an image and each frame is sliced out of the batch, JPEG-encoded at quality 95, resized to a 2048 long side, and embedded as a base64 data URI inside extra_body.image. It goes in extra_body rather than at the top level because the upstream rejects it there - same as response_format.
The inputs that matter
- prompt - plain text. Required, and empty strings are a hard error.
- size -
1K,2K,3K,4K. Default1K. - ratio -
1:1,3:4,4:3,16:9,9:16,2:3,3:2,21:9. Default1:1. - api_key - leave blank if you've set an environment variable.
- response_format -
url(default) orb64_json, which skips a download round-trip at the cost of a fatter response body. Both parse; stay on the default. - image (optional) - an
IMAGEinput, batch capable. Up to five frames go out as references; the rest are dropped with a console warning. This is multi-image composition, not a ControlNet hint.
One output: IMAGE. Wire it into Preview Image, Save Image, or straight into the next step of your graph. model is a dropdown with exactly one entry (agnes-image-2.1-flash) - leave it alone.
Installing
ComfyUI Manager, search DMXAPI (the pack is on the Comfy Registry, so it shows up). Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/mch000534/ComfyUI-DMXAPI
/path/to/ComfyUI/.venv/bin/python -m pip install -r ComfyUI-DMXAPI/requirements.txt
Then restart ComfyUI - it only scans custom_nodes/ at startup. Dependencies are light: torch, numpy, Pillow, requests, opencv-python, imageio. ffmpeg is optional and only matters for the video nodes.
For the key: copy .env.example to .env in the pack folder and fill in AGNES_API_KEY (or DMXAPI_KEY, the generic fallback used by every node). Precedence is node field → DMXAPI_KEY → AGNES_API_KEY. .env is read once when the pack loads, so editing it means restarting ComfyUI.
Where people get burned
Timeouts on big tiers. The client waits 180s at 1K/2K and 300s at 3K/4K, but the pack's FAQ warns that DMXAPI's sync image endpoints get cut by the upstream gateway around the 60-second mark, and 3K/4K is a long job. Step down a tier first - the node's error message says the same - then trim reference images, then shorten the prompt. A request killed after it went out is probably already billed, so blindly re-queueing is how you pay twice.
Don't mix the two image nodes' conventions. Here a reference image is a base64 field inside extra_body.image. On the GPT Image node, attaching an image switches to a completely different multipart endpoint. Carry one node's payload assumptions to the other and you get a 400 or a silently ignored reference.
401 with a key you're sure about. Check for trailing whitespace, then check whether a system environment variable is shadowing your .env - the OS wins. The pack probes both Bearer <key> and a bare key on 401 and remembers whichever worked, so a plain 401 usually means the key really is wrong.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| model | COMBO | agnes-image-2.1-flash | 1 options: agnes-image-2.1-flash |
| api_key | STRING | — | |
| size | COMBO | 1K | 4 options: 1K, 2K, 3K, 4K |
| ratio | COMBO | 1:1 | 8 options: 1:1, 3:4, 4:3, 16:9, 9:16, 2:3, +2 |
| response_format | COMBO | url | 2 options: url, b64_json |
| imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |