Nodes/ComfyUI-LumaAI-API/Extend Generation
ComfyUI Node

Extend Generation

Keep the clip going — extend Dream Machine videos forward or backward

By lumalabs·Created 2 years ago·Updated about a year ago· 213
Extend Generation
  • client
  • video_url
  • generation_id
prompt
model
loopfalse
resolution
savetrue
init_image_url
final_image_url
init_generation_id
final_generation_id
filename

Dream Machine clips are short - 5 or 9 seconds at most - and the first question everyone asks the moment they see one is "how do I make it longer?" LumaExtendGeneration is the answer. It takes an existing generation and continues it, either by extending the tail forward past the end or by prepending new footage before the start. Chain it a few times and a 5-second clip becomes a 20-second one, which is how people build the longer narrative shots you see posted from this pack.

One thing to know going in: people on reddit have been asking "has anyone been able to extend video length with the Dream Machine API?" since the nodes launched, and the workflow is real but not magical. Each extension is a fresh paid generation, so a 20-second result is four API calls' worth of credits, and each hop risks drifting further from your original. It's a tool for building a sequence, not for infinite growth.

How it works

The node builds keyframes - one for the start (frame0) and one for the end (frame1) - and you pick what each keyframe is anchored to:

  • init_generation_id - the clip you want to extend forward. Luma continues from the end of this generation into new footage you prompt.
  • final_generation_id - the clip you're extending backward. New footage is created leading up to the start of this generation.
  • init_image_url / final_image_url - the same positions, but anchored on a hosted image instead of an existing generation, for when you're extending toward a target frame rather than another clip.

The validation is strict on purpose: you can't set both an image and a generation for the same end ("You cannot provide both an init image and a init generation"), and you must provide at least one generation id ("You must provide at least one generation id"). The other inputs are the usual Ray set - model, prompt, loop, resolution - plus save and optional filename. Outputs are video_url and the new generation_id, which you can feed right back into another LumaExtendGeneration for the next hop.

What you'll actually set

  • The generation id(s) from a prior LumaText2Video, LumaImage2Video, or earlier extend. Wire them in; don't hand-type them.
  • prompt - describes the new footage being created, not a description of the whole clip. For forward extension, tell it what happens next.
  • model and resolution - keep them matching the source generation where possible; mixing 540p source with a 720p extension is where seams get visible.

Installing

Standard pack install: ComfyUI Manager (search "ComfyUI-LumaAI-API"), or git clone https://github.com/lumalabs/ComfyUI-LumaAI-API into ComfyUI/custom_nodes and pip install -r requirements.txt. Dependencies are light (lumaai==1.7.0, requests, numpy, Pillow), nothing local to download, and a LumaAIClient node with your API key (or the env/config.ini fallback) feeds the client input.

Common issues

  • "You must provide at least one generation id" - both id inputs are empty. Remember: extending needs an existing generation; if you have neither, LumaImage2Video or LumaText2Video is the node you actually want.
  • "You cannot provide both an init image and a init generation" - you've got two anchors fighting for the same end of the clip. Pick one.
  • Visible seams between hops - keep model, resolution, and loop consistent across the whole chain, and let the extension prompt describe motion that continues naturally from the last frame.
  • Drift - every extension is a new generation, so the look can wander. Re-using the same source generation id (rather than the freshly extended one) as your anchor for several branches keeps a consistent start.

There's an example ExtendingGeneration.json workflow in the pack's workflows folder if you want to see the wiring done properly - download it and drag it into ComfyUI.

CategoryLumaAI/Ray

Inputs (11)

NameTypeDefaultDescription
clientLUMACLIENT
promptSTRING
modelCOMBO3 options: ray-flash-2, ray-2, ray-1.6
loopBOOLEANfalse
resolutionCOMBO2 options: 540p, 720p
saveBOOLEANtrue
init_image_urloptSTRING
final_image_urloptSTRING
init_generation_idoptSTRING
final_generation_idoptSTRING
filenameoptSTRING

Outputs (2)

NameTypeDescription
video_urlSTRING
generation_idSTRING