Dress people in live or recorded video with text prompts, garment images, or both.
Try on clothing and accessories in realtime. Stream a live camera feed, describe the outfit or provide a reference image of the garment, and Lucy VTON will realistically dress the subject while preserving motion and body shape — all with minimal latency.
import { createDecartClient, models } from "@decartai/sdk";const model = models.realtime("lucy-vton-latest");const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: { frameRate: model.fps, width: model.width, height: model.height, },});const client = createDecartClient({ apiKey: "your-api-key-here" });const realtimeClient = await client.realtime.connect(stream, { model, onRemoteStream: (editedStream) => { document.querySelector("#video-output").srcObject = editedStream; },});// Try on with a garment image and descriptive promptconst garmentFile = document.querySelector('input[type="file"]').files[0];await realtimeClient.set({ prompt: "Substitute the current top with a navy blue hoodie with a white cross logo on the chest", image: garmentFile, enhance: false,});// Disconnect when donerealtimeClient.disconnect();
For the best results, provide a garment reference image paired with a descriptive prompt. This gives the model the clearest signal of what to apply.
// Best approach: reference image + descriptive promptawait realtimeClient.set({ prompt: "Substitute the current top with a black bomber jacket with a blue logo on the chest and a zip front", image: garmentFile, enhance: false,});// Reference image only — the model dresses the person to matchawait realtimeClient.set({ image: garmentFile });
Reference image tips:
Clean garment images work best — just the clothing item, no person wearing it
White or plain backgrounds are ideal
At least 512×512 pixels — the model reproduces what it sees, so a clear image produces better results
If your source image shows a person wearing the garment, consider using an image editing model to extract just the clothing item first
Switch outfits instantly during a live session — call setPrompt() or set() again at any time without reconnecting:
// Start with a casual lookrealtimeClient.setPrompt("Substitute the current top with a grey crewneck sweatshirt with a large blue logo on the front");// Switch to formalrealtimeClient.setPrompt("Substitute the current top with a navy blue blazer, worn over a light blue dress shirt");// Try an accessoryrealtimeClient.setPrompt("Add a black baseball cap with a blue logo to the person's head");
In production, never expose your permanent API key (sk-*) to the browser. Instead, create a short-lived client token on your server and pass it to the frontend:
Client tokens have a 10-minute TTL. Create a new token each time a user opens a try-on session. Active WebRTC sessions continue working even after the token expires. See the Client Tokens guide for details.
Lucy VTON works best with structured prompts that follow a substitute or add pattern. Focus on what needs to change — you don’t need to describe the entire scene.
✅ "Substitute the current top with a bright red hoodie with an oversized casual fit"✅ "Substitute the current top with a black leather bomber jacket with ribbed cuffs"✅ "Substitute the current top with a navy blue polo shirt with a white logo on the chest"✅ "Add a navy baseball cap with a blue logo to the person's head"✅ "Substitute the current bottoms with dark blue slim-fit jeans"❌ "Put a jacket on the person" (too vague — no color, material, or fit)❌ "Red hoodie" (missing action and context)❌ "Wearing a jacket" (no detail about the garment)
Be specific — include color, material, texture, pattern, and fit. Aim for 20–30 words.
Describe only what you see — don’t guess details like zippers or pockets unless they’re clearly visible in the reference image.
One garment per prompt — combining multiple unrelated changes can produce unpredictable results.
Reference image + prompt — when you have a garment image, always pair it with a descriptive prompt for maximum control.
Use enhance: true as a fallback — the built-in enhance option can improve short or vague prompts automatically, but detailed prompts you write yourself will produce the best results.
For user-uploaded garment images where you don’t have a pre-written prompt, you can use any vision LLM (GPT-4o-mini, Claude, Gemini) to auto-generate a descriptive prompt from the garment image:
// Send the garment image (and optionally a camera frame) to your LLMconst formData = new FormData();formData.append("image", garmentBlob);formData.append("personFrame", cameraFrameBlob); // optional — improves accuracyconst res = await fetch("/api/enhance-prompt", { method: "POST", body: formData });const { prompt } = await res.json();// → "Substitute the grey crewneck sweater with a blue and pink flame print hoodie with an oversized fit"
Sending a camera frame of the person gives the LLM context about what they’re currently wearing, so it generates more accurate prompts (e.g. “Substitute the grey sweater” instead of generic “Substitute the current top”).
When users upload photos from fashion websites where a model is wearing the garment, the image contains a person and background rather than a clean garment shot. Use an image editing model to extract just the clothing item on a white background before sending it to the try-on model.
Lucy VTON is also available as a batch/queue model for processing pre-recorded videos asynchronously. Submit a job, poll for completion, then download the result.
# Submit jobJOB_ID=$(curl -s -X POST https://api.decart.ai/v1/jobs/lucy-2.1-vton \ -H "X-API-KEY: $DECART_API_KEY" \ -F "data=@person.mp4" \ -F "prompt=Substitute the current top with a red leather jacket with a zip front" \ -F "reference_image=@garment.jpg" | jq -r '.job_id')# Poll until completedwhile true; do STATUS=$(curl -s -H "X-API-KEY: $DECART_API_KEY" \ https://api.decart.ai/v1/jobs/$JOB_ID | jq -r '.status') echo "Status: $STATUS" [ "$STATUS" = "completed" ] && break [ "$STATUS" = "failed" ] && exit 1 sleep 2done# Download resultcurl -H "X-API-KEY: $DECART_API_KEY" \ https://api.decart.ai/v1/jobs/$JOB_ID/content --output output.mp4