Nodes/TrentNodes/Midjourney Imagine
ComfyUI Node

Midjourney Imagine

One node, one prompt, a 2×2 grid back

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
Midjourney Imagine
    • image
    • task_id
    • buttons
    prompta cinematic portrait
    api_key
    api_urlhttps://yunwu.ai
    base_modelmidjourney
    version6.1
    aspect_ratio1:1
    stylize100
    chaos0
    weird0
    seed-1

    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 (U1U4, V1V4) 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. Without buttons, 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 model niji gets --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_KEY environment 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.

    CategoryTrent/Midjourney

    Inputs (10)

    NameTypeDefaultDescription
    promptSTRINGa cinematic portraitPlain prompt text. Flags like --ar and --s are added automatically from the widgets below.
    api_keySTRINGYunwu API key. Leave blank to fall back to the MJ_API_KEY env var. WARNING: pasted keys are saved into the workflow JSON.
    api_urloptSTRINGhttps://yunwu.aiYunwu API base URL. Override if your provider uses a different host.
    base_modeloptCOMBOmidjourney2 options: midjourney, niji
    versionoptCOMBO6.14 options: 5.2, 6, 6.1, 7
    aspect_ratiooptCOMBO1:15 options: 1:1, 4:3, 3:4, 16:9, 9:16
    stylizeoptINT1000–1000
    chaosoptINT00–100
    weirdoptINT00–3000
    seedoptINT-1-1–4294967295Use -1 for a random seed.

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    task_idSTRING
    buttonsDICT