Nodes/ComfyUI llama.cpp Suite/llama.cpp Result JSON
ComfyUI Node

llama.cpp Result JSON

The receipt that tells you whether that text is trustworthy

By Setmaster·Created 9 months ago·Updated 3 days ago· 9
llama.cpp Result JSON
  • result
  • result_json

One input, one output, and a real job

llama.cpp Result JSON takes the typed result from llama.cpp Generate and serialises it as JSON. That's the whole node. No widgets, no settings, nothing to configure.

It's also the difference between "the LLM said something" and "here's what happened". Generate's response output is plain text on a wire - it can't tell you whether the generation finished cleanly or was cancelled at token 300 and salvaged. The typed result can, and this node is how you get it into a text socket where you can read it or pass it on.

Why that matters in practice

Say you use return_marked_partial because a truncated response is better than a failed queue. Now you have text that may or may not be complete, flowing into your CLIP Text Encode. The JSON carries the completion state, the exact model, the seed, usage, finish evidence, warnings, timing, error categories and the release block. status: not_requested in the release evidence means exactly that - no release was asked for - which is quite different from "the release succeeded".

The node also doesn't editorialise. It uses the same bounded serializer as the result contract, so it doesn't truncate to the live preview tail and it never turns a partial result into a complete one. If Generate handed it an incomplete generation, the JSON says so.

Wiring it

result (shown as Generation Result) from Generate goes in. result_json, a STRING, comes out. The pack's suggested use is llama.cpp Prompt Output next to it with Plaintext turned off - that renders the JSON readably in the node instead of a wall of escaped text. From there you can wire it to a text file writer, dump it into a metadata node, or just look at it.

Two things it won't do: it doesn't generate anything, and it never requests runtime cleanup. It's a formatter.

One consequence of Generate's strict default worth remembering - with raise_error, a failed generation raises before producing the result socket at all, so this node never runs on a hard failure. You only see the JSON for successes and for explicitly accepted marked partials.

Installing

Ships in the pack:

comfy node install comfyui-llamacpp

Manager search "comfyui-llamacpp" or a source clone into ComfyUI/custom_nodes both work; restart afterwards. It has no dependencies of its own, though the pack as a whole wants a llama-server build and a GGUF model in ComfyUI/models/LLM/gguf/ to be useful. The canonical-text template shows the Generate → Result JSON → Prompt Output chain already wired.

Where people get burned

Expecting it to validate your prompt. It reports on the generation, not on whether the text is any good. It won't tell you the model ignored your instruction.

Reading driver_memory_verified wrong. Terminal release proves the process or router model is gone; it doesn't prove the GPU driver has finished accounting for the memory. If you're debugging VRAM, sample for a few seconds rather than trusting one flag.

Trying to feed it a plain string. It accepts a typed generation result from Generate and raises a TypeError on anything else - including arbitrary JSON you made yourself. If you want to build your own JSON, that's core Comfy's job.

Thin node, high value. If you're running this pack for anything you intend to keep, leave one of these wired up next to your Generate node and stop guessing.

CategoryLlamaCpp/Utilities

Inputs (1)

NameTypeDefaultDescription
resultLLAMACPP_GENERATION_RESULTTyped result from llama.cpp Generate.

Outputs (1)

NameTypeDescription
result_jsonSTRINGThe complete versioned GenerationResult JSON, without changing its state.