Reference to Video

POST /api/tasks/reference2video
X-Api-Key: sk-live-xxxx
Content-Type: application/json
Idempotency-Key: optional, see below

Reference to Video uses the images you provide as a reference for how characters, scenes, or objects look, then generates entirely new footage based on your prompt.

How it differs from Image to Video:

Image to Video Reference to Video
API POST /api/tasks/video-generation POST /api/tasks/reference2video
What the image is for Used as the first frame; the video starts moving from this image A reference for how characters, scenes, or objects look; the footage is recomposed based on prompt and doesn't necessarily start from this image
Number of images 1 Depends on the model: YUYU_N1 up to 5 (or none), YUYU_M6 1, or use people for 1–3 people with up to 3 images in total
Aspect ratio Follows the image Depends on the model: both YUYU_N1 and YUYU_M6 accept aspect_ratio; if you don't set it, YUYU_M6 follows the reference image
Task type (type) 1 4

The same model can have different specs and prices in the two APIs. For example, YUYU_N1 supports 2–15 seconds in Image to Video but 3–10 seconds in Reference to Video. Always check each model's page.

The credits actually charged are the credits value in the response. Videos are billed in 5-second billing units, and anything shorter than 5 seconds counts as 5 seconds. See Credits and Billing.

Supported models

Model Reference images Video length Resolution and aspect ratio Audio
YUYU_N1 Optional, up to 5, mapped to characters in order 3–10 seconds (default 5) Only 540p for now; 5 aspect ratios available With audio or silent (default: with audio)
YUYU_M6 1 in images; or use people for 1–3 people with up to 3 images in total, optionally with reference audio 5 or 10 seconds About 480p; 6 aspect ratios available, follows the reference image if not set Not adjustable

How to choose:

  • More than 3 reference images: choose YUYU_N1
  • 5- or 10-second clips, or you want prompt enhancement or reference audio: choose YUYU_M6; use images for a single image, and people for multiple people or multiple images

Common parameters

The fields below apply to both models. For model-specific fields (such as duration, aspect_ratio, and audio), see each model's page.

Field Type Required Description
model string Yes YUYU_N1 or YUYU_M6
prompt string Yes Describes the footage and action you want. The character limit depends on the model: 1500 for YUYU_N1, 10000 for YUYU_M6
images string[] Depends on model Reference images as base64 data URIs (data:image/{png|jpeg|webp};base64,...). The number of images depends on the model
payload object No Custom data, such as your order number. The system never reads or modifies it, and returns it as-is when you query the task and in webhook notifications
callback_url string No The URL to notify when the task finishes. Must start with https://, up to 2000 characters. See Callbacks (Webhook)
age_declared boolean No When you include reference images, the system first detects the age of the people in them. Send true to confirm that everyone in the images is an adult. See Pre-generation Age Check

If model is a model that doesn't exist, you get 422: Unknown model alias: {model}. Parameters not listed on a model's page return 422; they are not ignored.

Idempotency-Key

Prevents creating duplicate tasks. Send a custom string in this header. We recommend a value that never repeats in your system, such as an order number:

Idempotency-Key: order-20261001-00042

If you send the same request repeatedly within a short time with the same API key and the same Idempotency-Key, only one task is created and credits are charged only once. Subsequent duplicate requests return 200 OK with the original task.

Without this header, every request creates a new task.

Response and download

On success, you get 201 Created with the task data, and type is 4. For the data format, see Query Tasks and Download Results.

When the task completes, the video field in result is named video. Download it the same way as for Image to Video, using the url in files. You can also send callback_url to receive a completion notification via Callbacks (Webhook) instead.

Errors

Status code Cause Response
422 Invalid parameters, such as a missing required field, a wrong type, a number of images the model doesn't allow, or duration or another field outside the model's allowed range The errors field lists the reason for each field
422 model is a model that doesn't exist { "message": "Unknown model alias: {model}" }
402 Not enough credits { "message": "Insufficient credits to complete this charge." }
429 Too many Reference to Video tasks waiting in the queue { "message": "Too many pending tasks of this type; please retry later." }. Use the Retry-After header in the response to decide when to retry

For all error codes, see Error Reference.