Skip to main content
Use these commands to queue clips from a prompt and its references, control playback, and read session state.

Tracks

Commands

Commands with a named reply return that correlated message. play and stop declare acceptance without a response payload; their events report playback changes. A refused command changes no queue or default and fails its own call with a stable code; see Refusals. valid_commands reflects session state, but arguments still need validation.

enqueue

Supply a nonempty prompt. References are optional, so a prompt on its own generates a clip from the text. For images, supply either reference_image or reference_images, not both. A clip can also carry audio references, as either reference_audio or reference_audios, again not both. A clip that has audio needs at least one image, or a continue_from_clip_id whose clip the session still holds. Each clip retains its own prompt and ordered references. References guide appearance rather than fixing the first or last frame. A clip carries at most twelve references in total, counting its images, its audio, and any continuation. enqueue fails with empty_prompt for empty text, metadata_too_long for metadata past 2,000 characters, invalid_image for an invalid image, invalid_request for audio without an image or a continuation, too many references, or invalid parameters, and queue_full for a full generation queue. session_changed means a reset or another change ran while the model read your uploads; send the request again. Each audio reference is a WAV, MP3, AAC/M4A, OGG/Opus, FLAC, or WebM upload, at most 25 MiB, mono or stereo, and 2–15 seconds long. The model conditions the generated soundtrack on it, so name each one in the prompt and say what it is for. See the prompt guide for the two roles an audio reference can take. Audio outside these bounds fails enqueue with invalid_audio before the clip is queued. To continue a scene, set continue_from_clip_id to a clip that has finished generating. Motion, camera, and audio carry across the boundary while the new clip’s own references guide its appearance. A continued clip uses one of its three audio references for the previous clip’s soundtrack, so it accepts at most two of your own. Its budget of nine images is unchanged. Replies clip_queued and broadcasts queue_update and state_update. Completion emits clip_generated when the clip enters the playout queue.

move

A running build is unaffected. Replies clip_moved with the resulting queue and position and emits queue_update. Fails with unknown_clip for a missing or unknown ID and invalid_position for an invalid position.

pop

Replies clip_popped and emits queue_update and state_update. A running build finishes but its result is discarded. Use stop for a playing clip. Fails with unknown_clip for a missing or unknown ID.

play

Consumes the ready clip and emits clip_started, queue_update, and state_update. Fails with already_playing when a clip already plays, or no_ready_clip when no matching ready clip exists.

stop

Send {} to cut playback. Emits clip_stopped and state_update; queues remain intact. Under autoplay, this skips to the next clip. Fails with not_playing when nothing is playing. A stopped clip cannot resume.

set_seed

Replies seed_accepted and emits state_update. Explicit per-clip seeds do not advance this default. An invalid seed fails with invalid_seed.

set_clip_seconds

Replies clip_length_accepted with the actual clip_seconds and frames, and emits state_update. Only future enqueues use the new default; queued clips keep their lengths. An invalid length fails with invalid_seconds.

set_canvas

Both queues and playback must be empty. Replies canvas_accepted and emits state_update. An unsupported aspect fails with invalid_aspect, and a nonempty session with session_not_empty.

set_autoplay

Empty queues wait; autoplay does not generate prompts. Replies autoplay_accepted and emits state_update.

set_flush_on_clip_end

With flushing off, the playback clock carries across ready autoplay clips. This does not guarantee visual continuity. Reset always clears tracks. Replies flush_accepted and emits state_update.

get_queue

Send {} at any time. Replies queue_update with the complete generation and playout queues. history is always empty: a played clip is not listed and cannot be replayed. To continue from a generated clip, pass its ID as continue_from_clip_id on the next enqueue.

get_state

Send {} at any time. Replies state_update with defaults, capacities, playback progress, and valid_commands.

reset

Send {} to drop both queues, cut playback, restore defaults, and clear tracks. Replies session_reset; emits queue_update, state_update, and clip_stopped if playing. In-flight results are discarded.

Refusals

A refused command changes nothing and fails its own call. Only the client that sent it is told. The failure carries a stable code and a reason written for your user. A prompt past the text budget is not a refusal: enqueue accepts it, and the clip then fails with clip_failed. In JavaScript, the awaited call resolves undefined, and the error event fires first with operation: "sendCommand" and the code. Every command except play and stop declares a reply, so for those undefined means refused. play and stop resolve undefined on success too, so only the error event tells. In Python, send_command() raises a ReactorError with the code.
The model also broadcasts a command_error message to every client when it refuses a command. Read the refusal off the call instead: the broadcast reaches clients that did not send the command, and a future major release removes it. Releases before 0.7.0 refuse only with that broadcast. For a reply-declaring command that resolves undefined (None in Python) with no error, show a generic refusal such as “The model refused this command.” See Replies and refusals.

Messages

All listed payload fields are required. queue is a string identifying generation or playout; position is the resulting integer index, with zero at the front. reason and command are strings. seconds_sent is a number measuring the session total, not the duration of one clip. seed, frames, width, height, and cleared_clips are integers; clip_seconds is a number, aspect is a string, and enabled and was_playing are booleans. cleared_clips counts clips removed from both queues, excluding the playing clip. was_playing includes an armed or playing clip.

Clip object

The same clip object appears in clip messages and queue arrays.

queue_update

All three fields are required arrays of clip objects:

state_update

All fields are required, including the nullable playing_clip_id.

Upload reference

Image and audio parameters take references returned by the Reactor upload protocol. All fields are required.