Skip to main content

Overview

Alongside the video stream, your app and the model exchange data over a real-time channel. This is how you control the model and receive feedback from it while video is generating.
  • Commands are instructions your app sends to the model. They change what the model is doing in real time.
  • Messages are updates the model sends back to your app. They report state, signal events, or push any data the model wants to share.
For example, a generative video model might accept a set_prompt command to change what it is generating, and respond with periodic state messages reporting the current frame number and active prompt.
Commands flow from your app to the model, messages flow back

Commands

A command is a named action with a payload.
await reactor.sendCommand("set_prompt", { text: "a forest at dawn" });
Every model defines its own set of commands with typed parameters. A model that generates video from prompts might expose a set_prompt command. A model that accepts camera controls might expose move or rotate commands. The command names, parameter names, and parameter types are all specific to the model. Check the model’s page under Models to see what commands it supports and what each parameter expects.
Commands can only be sent when the connection is in the ready state.

Messages

The model can send structured JSON messages to your app at any time during a session. What a model sends and when depends on the model.
reactor.on("message", (msg) => {
  console.log(msg);
});
Check the model’s page under Models to see what messages it sends.