Nodes/KIE.ai Nodes Next/Claude Opus 4.8
ComfyUI Node

Claude Opus 4.8

Getting Structured Prompt Output Without Leaving the Canvas

By felipederosilva·Created about a month ago·Updated a day ago· 3
Claude Opus 4.8
    • text
    • raw_json
    • credits_consumed
    • usage_json
    • credits_left
    ◄prompt►
    ◄system_prompt►
    ◄streamfalse►
    ◄tools_json[]►
    ◄history_json[]►
    ◄max_tokens4096►
    ◄thinkingfalse►
    ◄expert_override_json{}►

    The most common reason people wire an LLM into a Comfy graph isn't "I want to chat with a model". It's "I want my six shot prompts to come out consistent, and I don't want to alt-tab to ChatGPT forty times." This node is one of the pack's Opus-family options for that job, alongside 4.5, 4.6, 4.7 and 5 - different versions, same wiring, each its own node because KIE publishes a docs page per version and the pack builds a node per page.

    The workflow it's built for

    You're making a storyboard or a shot sequence. Each image or clip needs a prompt that inherits the same wardrobe, palette and lighting language, and drifts only where you want it to drift. Doing that by hand in a text box is where consistency dies. Doing it with an LLM that's been handed the continuity notes and asked for one output per shot is where it starts to hold.

    The standard shape: LLM node writes a prompt string → CLIPTextEncode (or a video model's prompt socket) → sampler. Sometimes the LLM output goes through a parsing step first; the pack's own ecosystem has prompt-JSON parser nodes for exactly that, and the Suno nodes take a prompt string too, so the same text output can drive a music call.

    One warning from the KB that applies directly here: an enhancer that adds detail will happily add detail you never asked for. Narrow the job and chain it rather than trusting one open-ended rewrite (llm-in-comfyui.md documents two-step chains drifting less than one loose prompt).

    How it works

    The node is generated at startup from KIE's live API docs index. It assembles an Anthropic-style request - model, messages, stream, max_tokens, plus optional system, tools and thinkingFlag - and sends it to KIE's /claude/v1/messages. KIE is a marketplace reselling the model, so your key only ever hits api.kie.ai; the client hard-refuses authenticated raw requests to any other host.

    Two mechanics that decide whether this works for you:

    history_json is the messages array. It's parsed and passed straight through, then your prompt is appended as the final user turn. That's your multi-turn, and it's also how you'd feed in continuity context from earlier steps - as prior turns, not as a wall of text inside the prompt.

    thinking becomes thinkingFlag. Not Anthropic's budgeted thinking object. Raw shapes go through expert_override_json.

    Inputs and outputs

    Required: prompt. Set system_prompt - this is your format contract, and it's the difference between a clean paragraph and "Sure! Here's a refined prompt for your image:". max_tokens defaults to 4096 (max 131072); JSON-in-a-string answers get cut off here first. stream, tools_json, expert_override_json are for later.

    Outputs: text (the product), raw_json (full provider response, for when the output looks mangled), usage_json, and the two floats credits_consumed / credits_left. A credits receipt is drawn on the node after each successful run.

    There's no IMAGE input on Claude nodes in this pack - multimodal has to travel through history_json/expert_override_json, with the image uploaded first via KIE • Upload Image.

    Install

    ComfyUI Manager → ComfyUI-KIE-Nodes-Next. The README describes Registry publishing as prepared but not yet shipped, so keep the manual route ready:

    cd ComfyUI/custom_nodes
    git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
    cd ComfyUI-KIE-Nodes-Next
    pip install -r requirements.txt
    

    Restart, then Settings → KIE.ai Nodes Next → Connection and paste your key once. It's checked against KIE before it overwrites anything, and you only ever see a masked fingerprint afterwards. KIE_API_KEY wins over the stored key. Python 3.10+, nothing to download.

    Common issues

    Structured output isn't structured. A chat model doesn't emit clean JSON by default; it wraps it. Say so in system_prompt, and give the answer enough max_tokens to finish.

    Prompt drift across a batch. Same failure the KB documents for every enhancer: the model invents continuity you didn't specify. Keep identity/wardrobe anchors explicit in the system prompt and separate from scene variation.

    Nothing shows up in the node search. First startup indexes KIE's docs and reloads the frontend once. Restart.

    Version comparison is guesswork. There's essentially no community signal on Opus point releases. If picking between 4.8 and 5 matters to your output, run the same prompt through both nodes and diff; that experiment costs pennies and beats anyone's opinion, including mine.

    Cost adds up invisibly. No free tier, no offline fallback. For the prompt-shaping loop you run constantly, a local small model is free per call and won't filter; the API node earns its place on the one or two hard briefs per project.

    It's a small pack with a small footprint. Corpus searches for this pack name return nothing - the Kie.ai node discussion out there belongs to a different project. The code's key handling is careful, but nobody has audited it for you. Read before installing, and don't hand it a key you reuse elsewhere.

    CategoryKIE Next/LLM/Claude/Opus

    Inputs (8)

    NameTypeDefaultDescription
    promptSTRINGUser prompt / message.
    system_promptoptSTRING—
    streamoptBOOLEANfalse—
    tools_jsonoptSTRING[]Optional function/tool definitions supported by this model endpoint.
    history_jsonoptSTRING[]Optional prior message/input array as JSON.
    max_tokensoptINT40961–131072—
    thinkingoptBOOLEANfalse—
    expert_override_jsonoptSTRING{}Expert-only request overrides. Normal use does not require this.

    Outputs (5)

    NameTypeDescription
    textSTRING—
    raw_jsonSTRING—
    credits_consumedFLOAT—
    usage_jsonSTRING—
    credits_leftFLOAT—