Best practices for character and style reference images in realtime models
Reference images guide how realtime models transform your video. Lucy 2 uses them for character transformation — your face maps onto the reference identity. Lucy Restyle Live uses them for style guidance — the visual aesthetic of the reference carries into the output.This guide covers image requirements, best practices for character portraits, style references, and troubleshooting.
Upload a face photo and Lucy 2 maps your movements, expressions, and gestures onto that character in realtime. The reference image provides the visual identity — your camera provides the motion.
import { createDecartClient, models } from "@decartai/sdk";const client = createDecartClient({ apiKey: "your-api-key-here" });const model = models.realtime("lucy_2_rt");const stream = await navigator.mediaDevices.getUserMedia({ video: { frameRate: model.fps, width: model.width, height: model.height },});const realtimeClient = await client.realtime.connect(stream, { model, onRemoteStream: (s) => { document.getElementById("output").srcObject = s; },});// Upload a character referenceconst photo = document.querySelector("input[type=file]").files[0];await realtimeClient.set({ prompt: "Transform into this character", image: photo, enhance: true,});
Upload a style image and Lucy Restyle Live uses its visual aesthetic — colors, textures, lighting — to guide the transformation of your live stream.
You can change the reference image at any time without reconnecting. The transition is near-instant:
// Switch to a new characterconst newCharacter = document.querySelector("input[type=file]").files[0];await realtimeClient.set({ prompt: "Transform into this character", image: newCharacter, enhance: true,});// Or clear the reference entirely to fall back to text-only editingawait realtimeClient.set({ image: null });
set() replaces the entire state — always include every field you want to keep. When changing the prompt, include the image again to preserve it.
Character reference and text prompts work together. The reference sets the identity; the prompt adds modifications:
// Character reference + text modificationawait realtimeClient.set({ prompt: "Transform into this character, wearing a red cape", image: characterPhoto, enhance: true,});// Change the prompt while keeping the character — include the image to preserve itawait realtimeClient.set({ prompt: "Same character but in a dark room with dramatic lighting", image: characterPhoto,});
// Set initial style with a reference imageconst styleRef = await fetch("/monet-painting.jpg").then((r) => r.blob());await realtimeClient.setImage(styleRef);// Combine with a text prompt for more controlrealtimeClient.setPrompt("Apply this painting style with warm golden lighting");
Remove the reference image to return to text-only editing:
// Clear the character referenceawait realtimeClient.set({ image: null });// Now text prompts apply directly to your camera feedawait realtimeClient.set({ prompt: "Add sunglasses" });