Midjourney Imagine
One node, one prompt, a 2×2 grid back
- image
- task_id
- buttons
Midjourney Imagine is the entry point into this pack's Midjourney quartet: type a prompt, hit run, and instead of waiting for a local diffusion model to grind out an image, the node phones a Midjourney API and drops the resulting 2×2 grid back into your ComfyUI graph as a normal IMAGE tensor. Same canvas, same wires, closed model.
The name is honest about the trade. Midjourney has no open weights - the KB's closed-source-models essay has the whole arc of "Flux closed the gap," but MJ still has its look and its ecosystem. If you want that look inside a ComfyUI pipeline, an API wrapper is the only door. This node is that door, through a third-party reseller (Yunwu, default https://yunwu.ai) rather than Comfy's own Partner Nodes.
How it works
The node submits your prompt to /mj/submit/imagine, polls until the task succeeds, and returns:
- image - the 4-image grid as an IMAGE tensor.
- task_id - the Midjourney task identifier.
- buttons - a DICT mapping labels (
U1–U4,V1–V4) to Midjourney's button IDs. This is the plumbing that lets the pack's Midjourney Action and Midjourney Batch Actions nodes drive upscales and variations off the grid you just got. Withoutbuttons, the pipeline dead-ends.
Inputs that matter
- prompt - plain text. The node appends the flags itself:
--v 6.1,--ar 16:9,--s,--c,--w,--seed- built from the widgets below, so you write natural prompts and let the node assemble the CLI line. Base modelnijigets--niji <version>instead of--v. - api_key - your Yunwu key. The tooltip has a warning worth quoting: "pasted keys are saved into the workflow JSON." Leave it blank to fall back to the
MJ_API_KEYenvironment variable - which I'd strongly recommend, because a pasted key in a workflow JSON is a key that ends up in a shared PNG metadata. - api_url - override the provider host if yours differs.
- version - 5.2 / 6 / 6.1 / 7. aspect_ratio - 1:1, 4:3, 3:4, 16:9, 9:16. stylize, chaos, weird, seed (-1 = random).
Install
Part of TrentNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt
Restart, look under Trent/Midjourney. No model downloads - this is network plumbing with requests.
Honest notes
First, the security frame from the KB's external-api-nodes doc applies fully: this is a node whose job is to phone home with a credential, the exact shape of the thing that's been weaponized in this ecosystem before. Use the env var, and know your provider. Second, the Yunwu reseller is niche - essentially no community discussion out there, so you're betting on a third-party proxy's uptime and pricing. Check the provider's docs before you commit a pipeline to it. Third, remember MJ returns a grid; the upscale/variation nodes in this pack are how you turn that grid into a usable single image.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | a cinematic portrait | Plain prompt text. Flags like --ar and --s are added automatically from the widgets below. |
| api_key | STRING | Yunwu API key. Leave blank to fall back to the MJ_API_KEY env var. WARNING: pasted keys are saved into the workflow JSON. | |
| api_urlopt | STRING | https://yunwu.ai | Yunwu API base URL. Override if your provider uses a different host. |
| base_modelopt | COMBO | midjourney | 2 options: midjourney, niji |
| versionopt | COMBO | 6.1 | 4 options: 5.2, 6, 6.1, 7 |
| aspect_ratioopt | COMBO | 1:1 | 5 options: 1:1, 4:3, 3:4, 16:9, 9:16 |
| stylizeopt | INT | 1000–1000 | — |
| chaosopt | INT | 00–100 | — |
| weirdopt | INT | 00–3000 | — |
| seedopt | INT | -1-1–4294967295 | Use -1 for a random seed. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| task_id | STRING | — |
| buttons | DICT | — |