Markdown doc. generator
Let a local LLM write your docs — no API key needed
- ui_widget
- request_json
- response_json
- markdown
- markdown_list
The name is the whole pitch: this node takes a chunk of source code and gets a local LLM to document it in Markdown. What's notable - and increasingly rare in the LLM-node space - is that the name isn't lying about needing a key. There's no API key, no cloud account, no billing page. It talks to an OpenAI-compatible endpoint on your own machine, defaulting to http://localhost:5001/v1/chat/completions, which is exactly the endpoint Koboldcpp exposes out of the box. That's the pairing the author tested the LLM nodes against.
How it works: the prompt input is the source file to document - paste in a Python file or a section of it. temperature (default 0.5) controls randomness, max_tokens (default 2000) caps how much the model writes, seed (default 42) keeps the output reproducible, and url points at your endpoint. The optional extra_context input lets you hand the LLM background material - "out of scope constants and helper definitions" - so it can explain code that references things outside the snippet. Under the hood it builds a chat-completions request, fires it at the endpoint, and returns four outputs: request_json and response_json (the raw request/response, useful when you're debugging why the model answered oddly) and markdown plus markdown_list (the generated doc, single string and as a list of lines).
The intended pipeline is very LF: use LF_RegionExtractor to pull the code regions you care about out of a folder of files, feed them into this node, then pass markdown to LF_SaveMarkdown to write the doc to disk. The nodes even share a category story - "LF Nodes/LLM" pairs with the IO and save nodes to make a mini documentation pipeline that runs entirely offline.
The setup cost is the LLM server, not the node. You need something serving an OpenAI-compatible API locally - Koboldcpp is the tested default, and any unauthenticated OpenAI-compatible endpoint should work per the README. The author's sample setup uses UCLA-AGI/Llama-3-Instruct-8B-SPPO-Iter3 with a LLaVA mmproj for vision, but any decent instruct model will produce usable docs. Realistically you want at least a 7B/8B model on a GPU; a 3B will write docs that read like a tired intern.
Where people get burned, in order:
- You forgot the server. The node errors if nothing is listening on port 5001. Start Koboldcpp first, then run the workflow.
- The default port isn't yours. If your server is elsewhere, update
url- this is the field everyone's first error message points at. - Everything on the graph is a dependency now. Like all LLM-node workflows, this one is only as deterministic as the model you run; seed helps, but a different model version can produce different docs.
Install the pack via ComfyUI Manager (search "LF Nodes") or git clone https://github.com/lucafoscili/comfyui-lf into custom_nodes, then restart. And the pack reminder that's worth repeating everywhere: comfyui-lf is legacy/frozen as of early 2025 - fully working, but new work happens in lucafoscili/lf-nodes.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | The source file to document. | |
| temperature | FLOAT | 0.50.1–1.901 | Controls the randomness of the generated text. Higher values make the output more random. |
| max_tokens | INT | 200020–8000 | Limits the length of the generated text. Adjusting this value can help control the verbosity of the output. |
| seed | INT | 420–18446744073709550000 | Determines the starting point for generating random numbers. Setting a specific seed ensures reproducibility of results. |
| url | STRING | http://localhost:5001/v1/chat/completions | URL of the local endpoint for the LLM. |
| extra_contextopt | STRING | Additional context to guide the LLM (out of scope constants and helpers definitions). | |
| ui_widgetopt | KUL_CODE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| request_json | JSON | — |
| response_json | JSON | — |
| markdown | STRING | — |
| markdown_list | STRING | — |