Nodes/KIE.ai Nodes Next/Generate or Edit Image · flux-kontext-max
ComfyUI Node

Generate or Edit Image · flux-kontext-max

Edit by describing the change, not by masking

By felipederosilva·Created about a month ago·Updated a day ago· 3
Generate or Edit Image · flux-kontext-max
    • image
    • url
    • all_urls_json
    • task_id
    • raw_json
    • credits_consumed
    • credits_left
    ◄promptA serene mountain landscape at sunset with a lake reflecting the orange sky►
    ◄enableTranslationtrue►
    ◄aspectRatio16:9►
    ◄outputFormatjpeg►
    ◄promptUpsamplingfalse►
    ◄safetyTolerance2►
    ◄uploadCnfalse►
    ◄inputImagehttps://example.com/input-image.jpg►
    ◄watermarkyour-watermark-id►
    ◄timeout_seconds1200►
    ◄callback_url►

    Kontext is the model that made instruction editing a commodity - feed it a picture and a sentence, get the same picture with the clothing changed or the background swapped. It's also the model people remember for watermark removal and for how good it was at keeping a character recognisable across edits. This is the hosted Max tier of that, and the node does double duty: no input image means generate, input image means edit.

    That's the neat part of the docs page KIE published, and the pack kept it: one node, two jobs.

    How it works

    You write a prompt. That's required in both modes. Then, if you supply an image, the same prompt is interpreted as an edit instruction instead of a scene description - Kontext consumes references in-context rather than through adapter embeddings, which is why it holds subject identity better than the ControlNet-era approach it replaced.

    The gotcha that catches everyone: inputImage on this node is a plain string URL, not an IMAGE socket. Nothing in the pack uploads it for you. You need a URL KIE's servers can reach - either something already public, or one you produced with the pack's upload utilities:

    KIE • Upload Image  →  first_url  →  paste into inputImage
    

    The whole node is a thin wrapper over KIE's Kontext endpoint: submit, poll, download, decode to a ComfyUI IMAGE. Expect a straight substitution, not a re-imagining - that's what the model is for.

    Inputs worth setting

    prompt is required. English only, per the tooltip, and enableTranslation (default on) is what saves you if you type in another language - it auto-translates before the request. If you're already writing English you can turn it off and skip a step.

    inputImage - the URL. Empty means text-to-image generation; filled means edit.

    aspectRatio is a dropdown defaulting to 16:9 with six options. In generation mode the output follows it. In editing mode, supplying it tells the model to re-frame the result - so if you want the edit in the original's shape, think about this before you leave a default in place.

    safetyTolerance is a dropdown defaulting to 2 with seven steps. The tooltip gives the range honestly: 0 (strictest) to 6 (most permissive) for generation, but 0 to 2 for editing, where 2 is described as balanced. So the same number means different things depending on which mode you're in.

    outputFormat is jpeg by default, with the other option being PNG. For anything you'll composite or re-edit, PNG is worth the extra bytes - repeated JPEG passes on an image you're editing in stages is how detail dies.

    promptUpsampling (off by default) has the service rewrite your prompt before generating. It usually helps thin prompts with nothing to lose and can hurt prompts you carefully wrote; it also costs time.

    uploadCn is a server-region switch for the image upload - China or not, chosen by where you are. Leave it unless uploads are slow.

    watermark ships with a placeholder value (your-watermark-id), and the tooltip says a watermark is added whenever that field is non-empty. Clear it unless you actually want one.

    Plus timeout_seconds and callback_url, the same pair every node in the pack carries.

    Outputs

    image - native tensor, wire it downstream. url - the hosted result, all_urls_json - every URL returned, task_id - the job ID for follow-ups, raw_json - full provider response, credits_consumed / credits_left - floats reporting cost and balance.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
    

    Or search "KIE.ai Nodes Next" in ComfyUI Manager, then restart. Dependencies are requests, Pillow, numpy, PyYAML. Set the key once in Settings → KIE.ai Nodes Next → Connection; it's validated against KIE before being saved over a good key, and it never enters workflow JSON.

    Honest notes

    Kontext is the previous generation of this idea. It shifts details you didn't ask about and softens an image over repeated passes, which is why the current local favourites for masked editing are Qwen-Image-Edit and Klein - the pack has nodes for those families too. The reason to use Max here is convenience: no 12B model to download, no environment to fight, an edit in twenty seconds from a node you already have. For heavy repeated editing of your own photos, the local path still wins.

    CategoryKIE Next/Image/Black Forest Labs/Flux Kontext

    Inputs (11)

    NameTypeDefaultDescription
    promptSTRINGA serene mountain landscape at sunset with a lake reflecting the orange skyText prompt describing the desired image or edit. Required for both generation and editing modes. - Should be detailed and specific - For image editing, describe the desired changes - For image generation, describe the complete scene - IMPORTANT: Only English language is supported
    enableTranslationoptBOOLEANtrueWhether to enable automatic translation feature. - Since prompt only supports English, when this parameter is true, the system will automatically translate non-English prompts to English - If your prompt is already in English, you can set this to false - Default value: true
    aspectRatiooptCOMBO16:9Output image aspect ratio. You Applicable in both text-to-image generation and image editing modes. For **text-to-image generation** , the output image will follow the specified aspect ratio. For **image editing** , if aspectRatio is provided, the edited image will follow that ratio. If not provided, the image will retain its original aspect ratio. Supported Aspect Ratios: | Ratio | Format Type | Common Use Cases | |-------|-------------|-----------------| | 21:9 | Ultra-wide | Cinematic displays, panoramic views | | 16:9 | Widescreen | HD video, desktop wallpapers | | 4:3 | Standard | Traditional displays, presentations | | 1:1 | Square | Social media posts, profile pictures | | 3:4 | Portrait | Magazine layouts, portrait photos | | 9:16 | Mobile Portrait | Smartphone wallpapers, stories | > Note: Default ratio is "16:9" if not specified.
    outputFormatoptCOMBOjpegOutput image format.
    promptUpsamplingoptBOOLEANfalse- If true, performs upsampling on the prompt - May increase processing time
    safetyToleranceoptCOMBO2**For Image Generation Mode:** Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 6 (more permissive). **For Image Editing Mode:** Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 2 (balanced). Default: 2
    uploadCnoptBOOLEANfalse(Optional) Specifies the server region for image upload. Set to true to use servers in China, false to use non-China servers. Choose based on your geographical location for optimal upload speeds.
    inputImageoptSTRINGhttps://example.com/input-image.jpgURL of the input image for editing mode. Required when editing an existing image. - Must be a valid image URL - Image must be accessible to the API server
    watermarkoptSTRINGyour-watermark-idWatermark identifier to add to the generated image. - Optional - If provided, a watermark will be added to the output image
    timeout_secondsoptINT120030–7200—
    callback_urloptSTRINGOptional KIE callback URL. Leave empty for normal ComfyUI use.

    Outputs (7)

    NameTypeDescription
    imageIMAGE—
    urlSTRING—
    all_urls_jsonSTRING—
    task_idSTRING—
    raw_jsonSTRING—
    credits_consumedFLOAT—
    credits_leftFLOAT—