Skip to main content
Edit live video streams in realtime with precise modifications. Add objects, change elements, or modify appearances in any live video feed with minimal latency. The Video Editing Realtime API takes a video stream and editing instructions, then generates a modified version of the video with your requested changes applied in realtime.

Model Specifications

The model processes video with these specifications:
  • Frame Rate: 25 FPS
  • Resolution: 1280x704 (16:9 aspect ratio)

Realtime API

The realtime API uses WebRTC for low-latency video editing. Clients establish a connection with our inference server, stream video with editing instructions, and receive a modified video stream in return. The connection remains active as long as the input video stream continues, allowing you to apply different edits on-the-fly to modify the output video dynamically.

Installation

Basic Usage

Advanced Features

Character Reference

Use a reference image to transform yourself into a different character. Lucy 2.1 supports both text-only editing and character reference in the same realtime session. Use set() to replace the session state atomically. Include all fields you want to keep — omitted fields are cleared.
Supported formats: JPEG, PNG, WebP
set() replaces the entire state — fields you omit are cleared. Always include every field you want to keep. Use set() instead of separate setPrompt() and setImage() calls to avoid intermediate states.

Dynamic Video Editing

Connection State Management

Complete Example with Error Handling

WebSocket + WebRTC (Vanilla)

For direct WebSocket communication without the SDK: