Nodes/TrentNodes/Midjourney Action
ComfyUI Node

Midjourney Action

U1–U4 and V1–V4 in one click

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
Midjourney Action
  • buttons
  • image
task_id
actionU1
api_key
api_urlhttps://yunwu.ai

Midjourney Imagine hands you a 2×2 grid. That's four candidates, not an image. To get a usable single image you pick one of the grid cells and either upscale it (U1–U4) or spin off a variation (V1–V4). Midjourney Action is the node that does exactly one of those eight moves: you feed it the task_id and buttons map from Imagine, pick an action, and it returns the resulting single image.

It's deliberately narrow - the whole job is "submit one Midjourney action and download the result." If you want all four upscales or all four variations at once, the pack's Midjourney Batch Actions is the one; this node exists for the case where you want to try U2 on one grid and V4 on the next, or where you're building a pick-one flow around a switch.

Inputs

  • task_id - from Imagine's output.
  • buttons - the label→customId DICT from Imagine. This is what makes the node work at all; without it you'd be typing Midjourney's opaque button IDs by hand. If you wire something else in, it errors with a helpful message listing the keys it actually found.
  • action - U1U4 or V1V4. Default U1.
  • api_key - Yunwu key (env MJ_API_KEY fallback, same as Imagine).
  • api_url - provider override, default https://yunwu.ai.

One output: image, the single result as an IMAGE tensor, ready for an upscaler, a detailer, or straight to Save Image.

How it works

It looks up your chosen label in the buttons map to get Midjourney's custom button ID, submits the action, polls the task, and downloads the resulting image. The buttons dict is doing the heavy lifting - which is why the node's first failure mode is a wrong or missing dict, and the error message tells you exactly which labels are available. This is a clean example of the API-wrapper pattern from the KB: the local node is a thin HTTP client; the intelligence lives in Midjourney's cloud.

Install

Part of TrentNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt

Restart, find it under Trent/Midjourney. Network-only; no models.

Gotchas

The task_id and buttons have to come from the same Imagine run - they're a matched pair. Grab a task_id from one grid and buttons from another and the action will fail or hit the wrong image. Also remember actions are paid API calls: U1–U4 each cost a request. If you know you want the whole grid upscaled, the Batch Actions node runs all four concurrently, which is both faster and easier to reason about than four of these. And the usual credential hygiene applies - env var over pasted key, since the pasted key lands in the workflow JSON.

CategoryTrent/Midjourney

Inputs (5)

NameTypeDefaultDescription
task_idSTRING
buttonsDICT
actionCOMBOU18 options: U1, U2, U3, U4, V1, V2, +2
api_keySTRING
api_urloptSTRINGhttps://yunwu.ai

Outputs (1)

NameTypeDescription
imageIMAGE