ComfyUI Node

Grok Collect

Pick up your finished Grok video when it's done, without babysitting the API

By alchemine·Created about a year ago·Updated 2 days ago· 2
Grok Collect
    • video
    • label
    wait_sec0
    poll_interval5.00
    access_token
    refresh_token
    client_id

    GrokCollect is the "answer's ready, go get it" node for the Grok image-to-video workflow. Grok Submit fires a job at x.ai and returns a request_id; this node reads that recorded job, polls until the clip exists, downloads the mp4 into the path reserved at submit time, and hands it back as a native VIDEO with an inline preview. If the job isn't done yet, it returns an ExecutionBlocker and nothing downstream runs - which is exactly the signal you exploit by looping the graph.

    Think of it as the collector that turns "I submitted a thing somewhere in the cloud" into "here's your video, in your output folder, wired into your graph."

    How it works

    GrokCollect reads the "grok" slot in the pack's shared jobs.lock, which Grok Submit wrote at queue time. From that record it gets the request_id, the reserved output path, and your label. It then polls the Grok API for the job's status - every poll_interval seconds - until one of these happens:

    • done → downloads the video to the reserved path, clears the lock (freeing the slot for the next submit), returns the VIDEO and the label.
    • failed/expired → drops the job, clears the lock, blocks downstream.
    • still running → waits up to wait_sec, then blocks downstream.
    • no job → blocks downstream.

    The "block" is an ExecutionBlocker, meaning everything downstream of the node is skipped for that run. Loop the graph (the pack docs suggest /loop) and the moment the clip is ready the blocker disappears and the pipeline continues. Since Collect calls the API to poll and download, it re-reads credentials from its own inputs or the env - tokens are deliberately not stored in the lock file - so provide access_token / refresh_token / client_id the same way you did on Submit, or they'll be read from GROK_* env vars.

    The inputs that matter

    • wait_sec (default 0) - how long to poll before blocking. 0 means "grab it if it's already done, otherwise block now". Give it a real value if you want one queue to hold until the render finishes.
    • poll_interval (default 5.0) - seconds between status polls while waiting.

    Outputs: video (VIDEO, with inline preview) and label (the label string you set at submit time, so you know which job this was).

    Install

    Part of ComfyUI-Alchemine-Pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alchemine/comfyui-alchemine-pack
    pip install -r requirements.txt
    

    Or via ComfyUI Manager (search "ComfyUI-Alchemine-Pack"). Only dependency is python-dotenv; no model downloads.

    Common issues

    The most common "it's broken" moment is actually the intended design: with wait_sec=0 and a job still rendering, you get a blocker and nothing happens. Run it in a loop or raise wait_sec. Second, if the job never arrives, check that Submit actually got a non-empty request_id - if it was empty, a Grok job was already in flight and your submit was skipped. Third, the credential dance: if you authenticated with token inputs on Submit but left Collect's token inputs empty, Collect needs the same env vars to poll; forgetting them just yields repeated skips, not an obvious error.

    CategoryAlcheminePack/Grok

    Inputs (5)

    NameTypeDefaultDescription
    wait_secINT00–3600
    poll_intervalFLOAT5.000.5–60
    access_tokenoptSTRING
    refresh_tokenoptSTRING
    client_idoptSTRING

    Outputs (2)

    NameTypeDescription
    videoVIDEO
    labelSTRING