Nodes/Workflow to API Converter Endpoint/Workflow to API Converter (Marker)
ComfyUI Node

Workflow to API Converter (Marker)

The 'Save (API)' trap, solved — convert full workflows server-side

By SethRobinson·Created about a year ago·Updated 6 months ago· 54
Workflow to API Converter (Marker)
    • info

    If you've ever built an app that sends workflows to ComfyUI's /prompt endpoint, you already know the trap: you drag out a workflow, POST it, and get some "Invalid prompt" garbage back. That's because the full workflow you saved with Save isn't what the API wants - it needs the stripped-down Save (API) format, an option that's hidden behind developer mode for no good reason. So you start maintaining two copies of every workflow, and the moment you drag that API version back into the editor to tweak it, you discover it's a skeleton missing half its UI. That's the exact hole this pack plugs.

    The name is slightly misleading: the actual work isn't done by the WorkflowToAPIConverter node at all. That node is just a marker. The real machinery is a server-side endpoint, /workflow/convert, that the pack registers when ComfyUI starts.

    How it works

    The pack ports the Javascript that powers the browser's "Save (API)" button into Python, so it runs on the server instead of in your web UI. POST a full workflow JSON to http://localhost:8188/workflow/convert and you get back something ready to hand to /prompt. Under the hood it's genuinely clever about it: it walks ComfyUI's actual node registry (NODE_CLASS_MAPPINGS and each node's INPUT_TYPES()) to resolve widget values, fills in default values for required inputs that were never set in the editor, expands subgraphs (including nested ones), ignores reroute nodes, and preserves Unicode. The author reports it handles 200 KB Flux and Wan workflows without complaint.

    The marker node itself does none of that. It takes zero inputs and returns one STRING output named info - basically a version string telling you the endpoint exists. Drop it in a workflow you share and ComfyUI Manager will detect the pack and offer to install it for whoever opens the file. That's its entire job, and it does it fine.

    Installing it

    No dependencies, no model files, nothing heavy - the whole pack is one Python module. Easiest path is ComfyUI Manager: search "Workflow to API Converter Endpoint" and install. One gotcha: the README notes that on the Windows build's new Node Manager you might not see it, and you'll need to switch to the legacy custom node manager. Or just clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SethRobinson/comfyui-workflow-to-api-converter-endpoint
    

    Restart ComfyUI and the endpoint is live - the log line "[WorkflowToAPIConverter] API endpoint registered at /workflow/convert" confirms it.

    Using it

    import json, requests
    
    workflow = json.load(open("workflow.json", encoding="utf-8"))  # a full "Save", not "Save (API)"
    api_format = requests.post("http://localhost:8188/workflow/convert", json=workflow).json()
    requests.post("http://localhost:8188/prompt", json={"prompt": api_format})
    

    The author's pattern is to cache the converted result by file date so you only pay the conversion cost when a workflow actually changes. If you already POST something in API format, the endpoint passes it through untouched.

    Where people get burned

    The endpoint is unauthenticated, like the rest of ComfyUI's API - don't expose it to the internet. It also refuses to convert a workflow it can't make sense of (400 if nodes or links are missing) and hard-caps requests at 1 MB. And because it imports ComfyUI's nodes module, it only works running inside a real ComfyUI install, not standalone. Reasonable tradeoffs for a tool that saves you from keeping two versions of every workflow.

    Categoryapi

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    infoSTRING