Nodes/ComfyUI-API-DockerCPU/Load Replicate Prediction
ComfyUI Node

Load Replicate Prediction

Got a Replicate prediction ID? Re-download the result without re-running it

By trustypangolinΒ·Created 5 months agoΒ·Updated about a month agoΒ· 0
Load Replicate Prediction
    • images
    • prediction_info
    β—„prediction_idβ–Ί
    β—„model_versionβ–Ί

    Replicate hands every API call a prediction ID - that long string of letters and numbers in the URL when you run something on their website. Here's the thing: that ID is the key to the result forever. You don't have to re-run the model to get the output back; you can just fetch it. That's exactly what this node does, and it's one of those quiet utilities you don't appreciate until you've lost a download and realized the generation is still sitting on Replicate's servers.

    Why does this matter in a ComfyUI workflow? Because this pack's other nodes spend real money per call, and ComfyUI re-runs nodes when you tweak anything upstream. If you found a great result, saved the workflow, and then changed a parameter somewhere - or the download failed, or you just want the output again without paying - LoadPrediction lets you pull the finished result back by ID, free, no re-generation. The KB's ecosystem essay documents how ComfyUI caches and re-runs, and this node is the pack's escape hatch for the expensive parts of that.

    The inputs are just two strings:

    • prediction_id - the Replicate prediction ID. You can find it in the prediction URL on Replicate's site or in the API_JSON output of whichever Replicate node ran it. Format looks like a short alphanumeric token.
    • model_version (optional) - the model version in owner/model:version form. Leave it blank for most cases; you only need it if Replicate can't resolve the prediction without knowing which model it came from.

    Outputs: images (an IMAGE tensor - the prediction's output image(s) back in the graph, where they can be saved or piped onward) and prediction_info (a string with the status and what was extracted). Note the status handling: if the prediction hasn't succeeded yet, you'll get something like Prediction status: starting in that info string rather than an error.

    Mechanically it's a thin client call: it hits the Replicate API, checks the prediction status, and if it succeeded, downloads the output files - including handling ZIP-packed outputs, which matters because some Replicate models return their results as zips. The pack's zip_utils handles unwrapping those for you automatically.

    Install is the pack standard - ComfyUI Manager (search ComfyUI-API-DockerCPU), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/trustypangolin/ComfyUI-API-DockerCPU
    cd ComfyUI-API-DockerCPU
    pip install -r requirements.txt
    

    Set REPLICATE_API_TOKEN - this node needs it even though it doesn't run inference - and restart. It's under 🎨 DockerCPU API/Utilities.

    The gotchas are the two ways this node quietly fails: no token (you'll get REPLICATE_API_TOKEN not set raised in the console), and a stale or mistyped ID (you'll get an error string in prediction_info, not an exception you'll necessarily notice). Grab the ID straight from API_JSON when you can - copying it by hand from a URL is exactly how you introduce a typo. And remember it only fetches finished predictions; if you load a prediction that's still running, you'll see the status in prediction_info and can re-run the node after it completes.

    Category🎨 DockerCPU API/Utilities

    Inputs (2)

    NameTypeDefaultDescription
    prediction_idSTRINGReplicate prediction ID (e.g., 'abc123')
    model_versionoptSTRINGModel version for the prediction (owner/model:version)

    Outputs (2)

    NameTypeDescription
    imagesIMAGEβ€”
    prediction_infoSTRINGβ€”