reactor.sendCommand(), the events the model emits back, and two end-to-end examples. For the
conceptual model and a quick start, see the overview.
Commands
Send commands to the model usingreactor.sendCommand(). Below are all available commands:
| Command | Description |
|---|---|
set_prompt | Set the prompt (at chunk 0, or current chunk if running) |
schedule_prompt | Schedule a prompt at a specific chunk index |
set_image | Set or change a reference image (works mid-generation) |
set_conditioning | Set prompt and reference image together atomically (avoids a first-chunk race) |
set_image_strength | Adjust how strongly the reference image anchors output (0.0–1.0) |
set_sr_scale | Set super-resolution scale: "off", "2x", or "4x" |
set_seed | Set a seed for reproducible output. Same seed = same video |
start | Begin video generation |
pause | Pause generation |
resume | Resume generation |
reset | Reset to initial state |
- set_prompt
- schedule_prompt
- set_image
- set_conditioning
- set_image_strength
- set_sr_scale
- set_seed
- start
- pause
- resume
- reset
set_prompt
Convenience wrapper aroundschedule_prompt that automatically picks the right chunk index so
you don’t have to track it yourself:- Not started: schedules at chunk 0.
- Paused: schedules at the current chunk (takes effect on resume).
- Running: schedules at the next chunk (current chunk is already being processed).
set_prompt and the model figures out when to
apply it.Parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The prompt text to use for generation |
Messages from model
Listen for messages withreactor.on("message", ...) (imperative) or the useReactorMessage()
hook (React). Every message is delivered as JSON { "type": "<name>", "data": { … } }.
| Message | When | Payload |
|---|---|---|
state | On connect, after every command, and after every chunk | Full session snapshot (see below) |
prompt_accepted | After set_prompt | { prompt: string } |
image_accepted | After set_image decodes | { width: int, height: int } |
conditions_ready | After set_prompt or set_image | { has_prompt: bool, has_image: bool } |
generation_started | After start | { prompt: string, chunk_index: int } |
chunk_complete | After each chunk emits | { chunk_index: int, frames_emitted: int, active_prompt: string } |
generation_paused | After pause | { chunk_index: int } |
generation_resumed | After resume | { chunk_index: int } |
command_error | When a command is rejected | { command: string, reason: string } |
state payload
state is the single source of truth for driving UI. Subscribe once and treat it as the
authoritative session snapshot; you generally do not need to track the individual messages above
yourself.
| Field | Type | Meaning |
|---|---|---|
running | bool | started && !paused. Equivalent to “frames are actively streaming”. |
started | bool | True once start has been accepted; stays true through pauses. Cleared by reset. |
paused | bool | True while generation is paused via pause. |
image_set | bool | True once a reference image has been set this session. Cleared only by reset. |
current_chunk | int | Zero-based index of the chunk currently being generated. 0 before the first chunk and after reset. |
current_frame | int | Running total of frames emitted on main_video since the last reset. |
current_prompt | string | null | The prompt currently driving generation, or null if none set. Stays null for the first state message after start, until the first chunk begins emitting. |
image_strength | number | Current image_strength (0.0–1.0). Ignored when no reference image is set. |
scheduled_prompts | object | Pending scheduled prompts, keyed by the chunk index at which they take effect. |
Complete example: prompt sequence
Complete example: image-to-video
Use a reference image to guide generation. Upload the image first, then send it together with the prompt viaset_conditioning before starting, so the very first chunk is conditioned on both.