Vidu Start End to Video Image to Video
About
Vidu Q1 Start-End to Video API: Generate a smooth transition video between start and end frames using the Q1 model.
1. Calling the API#
Install the client#
The client provides a convenient way to interact with the model API.
npm install --save @fal-ai/clientMigrate to @fal-ai/client
The @fal-ai/serverless-client package has been deprecated in favor of @fal-ai/client. Please check the migration guide for more information.
Setup your API Key#
Set FAL_KEY as an environment variable in your runtime.
export FAL_KEY="YOUR_API_KEY"Submit a request#
The client API handles the API submit protocol. It will handle the request status updates and return the result when the request is completed.
import { fal } from "@fal-ai/client";
const result = await fal.subscribe("fal-ai/vidu/q1/start-end-to-video", {
input: {
prompt: "Dragon lands on a rock",
start_image_url: "https://v3.fal.media/files/zebra/sgsdKvPigPhJ1S7Hl5bWc_first_frame_q1.png",
end_image_url: "https://v3.fal.media/files/kangaroo/CASBu_OmOnZ8IafirarFL_last_frame_q1.png"
},
logs: true,
onQueueUpdate: (update) => {
if (update.status === "IN_PROGRESS") {
update.logs.map((log) => log.message).forEach(console.log);
}
},
});
console.log(result.data);
console.log(result.requestId);2. Authentication#
The API uses an API Key for authentication. It is recommended you set the FAL_KEY environment variable in your runtime when possible.
API Key#
import { fal } from "@fal-ai/client";
fal.config({
credentials: "YOUR_FAL_KEY"
});Protect your API Key
When running code on the client-side (e.g. in a browser, mobile app or GUI applications), make sure to not expose your FAL_KEY. Instead, use a server-side proxy to make requests to the API. For more information, check out our server-side integration guide.
3. Queue#
Submit a request#
The client API provides a convenient way to submit requests to the model.
import { fal } from "@fal-ai/client";
const { request_id } = await fal.queue.submit("fal-ai/vidu/q1/start-end-to-video", {
input: {
prompt: "Dragon lands on a rock",
start_image_url: "https://v3.fal.media/files/zebra/sgsdKvPigPhJ1S7Hl5bWc_first_frame_q1.png",
end_image_url: "https://v3.fal.media/files/kangaroo/CASBu_OmOnZ8IafirarFL_last_frame_q1.png"
},
webhookUrl: "https://optional.webhook.url/for/results",
});Fetch request status#
You can fetch the status of a request to check if it is completed or still in progress.
import { fal } from "@fal-ai/client";
const status = await fal.queue.status("fal-ai/vidu/q1/start-end-to-video", {
requestId: "764cabcf-b745-4b3e-ae38-1200304cf45b",
logs: true,
});Get the result#
Once the request is completed, you can fetch the result. See the Output Schema for the expected result format.
import { fal } from "@fal-ai/client";
const result = await fal.queue.result("fal-ai/vidu/q1/start-end-to-video", {
requestId: "764cabcf-b745-4b3e-ae38-1200304cf45b"
});
console.log(result.data);
console.log(result.requestId);4. Files#
Some attributes in the API accept file URLs as input. Whenever that's the case you can pass your own URL or a Base64 data URI.
Data URI (base64)#
You can pass a Base64 data URI as a file input. The API will handle the file decoding for you. Keep in mind that for large files, this alternative although convenient can impact the request performance.
Hosted files (URL)#
You can also pass your own URLs as long as they are publicly accessible. Be aware that some hosts might block cross-site requests, rate-limit, or consider the request as a bot.
Uploading files#
We provide a convenient file storage that allows you to upload files and use them in your requests. You can upload files using the client API and use the returned URL in your requests.
import { fal } from "@fal-ai/client";
const file = new File(["Hello, World!"], "hello.txt", { type: "text/plain" });
const url = await fal.storage.upload(file);Auto uploads
The client will auto-upload the file for you if you pass a binary object (e.g. File, Data).
Read more about file handling in our file upload guide.
5. Schema#
Input#
prompt string* requiredText prompt for video generation, max 1500 characters
start_image_url string* requiredURL of the image to use as the first frame
end_image_url string* requiredURL of the image to use as the last frame
seed integerSeed for the random number generator
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
{
"prompt": "Dragon lands on a rock",
"start_image_url": "https://v3.fal.media/files/zebra/sgsdKvPigPhJ1S7Hl5bWc_first_frame_q1.png",
"end_image_url": "https://v3.fal.media/files/kangaroo/CASBu_OmOnZ8IafirarFL_last_frame_q1.png",
"movement_amplitude": "auto"
}Output#
The generated transition video between start and end frames using the Q1 model
{
"video": {
"url": "https://fal.media/files/zebra/-ACpJE6m4JQSBCCeNB51S_output.mp4"
}
}Other types#
Q2TextToVideoRequest#
prompt string* requiredText prompt for video generation, max 3000 characters
seed integerRandom seed for generation. Use -1 for random seed
duration DurationEnumDuration of the video in seconds Default value: "4"
Possible enum values: 2, 3, 4, 5, 6, 7, 8
resolution ResolutionEnumOutput video resolution Default value: "720p"
Possible enum values: 360p, 520p, 720p, 1080p
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16, 1:1
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
bgm booleanWhether to add background music to the video (only for 4-second videos)
Q2VideoExtensionRequest#
video_url string* requiredURL of the video to extend
prompt stringtext prompt to guide the video extension
seed integerRandom seed for generation. Use -1 for random seed
duration DurationEnumDuration of the extension in seconds Default value: "4"
Possible enum values: 2, 3, 4, 5, 6, 7
resolution ResolutionEnumOutput video resolution Default value: "720p"
Possible enum values: 720p, 1080p
mode ModeEnumGeneration mode: turbo for faster generation, pro for higher quality Default value: "turbo"
Possible enum values: turbo, pro
Image#
url string* requiredThe URL where the file can be downloaded from.
content_type stringThe mime type of the file.
file_name stringThe name of the file. It will be auto-generated if not provided.
file_size integerThe size of the file in bytes.
file_data stringFile data
width integerThe width of the image in pixels.
height integerThe height of the image in pixels.
ImageToVideoRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
image_url string* requiredURL of the image to use as the first frame
seed integerRandom seed for generation
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
File#
url string* requiredThe URL where the file can be downloaded from.
content_type stringThe mime type of the file.
file_name stringThe name of the file. It will be auto-generated if not provided.
file_size integerThe size of the file in bytes.
file_data stringFile data
ReferenceToVideoRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
URLs of the reference images to use for consistent subject appearance
seed integerRandom seed for generation
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16, 1:1
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
Q1ImageToVideoRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
image_url string* requiredURL of the image to use as the first frame
seed integerSeed for the random number generator
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
Q2ReferenceToVideoRequest#
prompt string* requiredText prompt for video generation, max 3000 characters
URLs of the reference images to use for consistent subject appearance (up to 7 images)
seed integerRandom seed for generation. Use -1 for random seed
duration DurationEnumDuration of the video in seconds Default value: "4"
Possible enum values: 1, 2, 3, 4, 5, 6, 7, 8
resolution ResolutionEnumOutput video resolution Default value: "720p"
Possible enum values: 360p, 520p, 720p, 1080p
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16, 1:1
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
bgm booleanWhether to add background music to the video (only for 4-second videos)
ReferenceToImageRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
URLs of the reference images to use for consistent subject appearance
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16, 1:1
seed integerRandom seed for generation
StartEndToVideoRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
start_image_url string* requiredURL of the image to use as the first frame
end_image_url string* requiredURL of the image to use as the last frame
seed integerRandom seed for generation
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
Q1ReferenceToVideoRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
URLs of the reference images to use for consistent subject appearance. Q1 model supports up to 7 reference images.
seed integerRandom seed for generation
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16, 1:1
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
bgm booleanWhether to add background music to the generated video
TemplateToVideoRequest#
template TemplateEnumAI video template to use. Pricing varies by template: Standard templates (hug, kiss, love_pose, etc.) cost 4 credits ($0.20), Premium templates (lunar_newyear, dynasty_dress, dreamy_wedding, etc.) cost 6 credits ($0.30), and Advanced templates (live_photo) cost 10 credits ($0.50). Default value: "hug"
Possible enum values: dreamy_wedding, romantic_lift, sweet_proposal, couple_arrival, cupid_arrow, pet_lovers, lunar_newyear, hug, kiss, dynasty_dress, wish_sender, love_pose, hair_swap, youth_rewind, morphlab, live_photo, emotionlab, live_memory, interaction, christmas, pet_finger, eat_mushrooms, beast_chase_library, beast_chase_supermarket, petal_scattered, emoji_figure, hair_color_change, multiple_people_kissing, beast_chase_amazon, beast_chase_mountain, balloonman_explodes_pro, get_thinner, jump2pool, bodyshake, jiggle_up, shake_it_dance, subject_3, pubg_winner_hit, shake_it_down, blueprint_supreme, hip_twist, motor_dance, rat_dance, kwok_dance, leg_sweep_dance, heeseung_march, shake_to_max, dame_un_grrr, i_know, lit_bounce, wave_dance, chill_dance, hip_flicking, sakura_season, zongzi_wrap, zongzi_drop, dragonboat_shot, rain_kiss, child_memory, couple_drop, couple_walk, flower_receive, love_drop, cheek_kiss, carry_me, blow_kiss, love_fall, french_kiss_8s, workday_feels, love_story, bloom_magic, ghibli, minecraft, box_me, claw_me, clayshot, manga_meme, quad_meme, pixel_me, clayshot_duo, irasutoya, american_comic, simpsons_comic, yayoi_kusama_style, pop_art, jojo_style, slice_therapy, balloon_flyaway, flying, paperman, pinch, bloom_doorobear, gender_swap, nap_me, sexy_me, spin360, smooth_shift, paper_fall, jump_to_cloud, pilot, sweet_dreams, soul_depart, punch_hit, watermelon_hit, split_stance_pet, make_face, break_glass, split_stance_human, covered_liquid_metal, fluffy_plunge, pet_belly_dance, water_float, relax_cut, head_to_balloon, cloning, across_the_universe_jungle, clothes_spinning_remnant, across_the_universe_jurassic, across_the_universe_moon, fisheye_pet, hitchcock_zoom, cute_bangs, earth_zoom_out, fisheye_human, drive_yacht, virtual_singer, earth_zoom_in, aliens_coming, drive_ferrari, bjd_style, virtual_fitting, orbit, zoom_in, ai_outfit, spin180, orbit_dolly, orbit_dolly_fast, auto_spin, walk_forward, outfit_show, zoom_in_fast, zoom_out_image, zoom_out_startend, muscling, captain_america, hulk, cap_walk, hulk_dive, exotic_princess, beast_companion, cartoon_doll, golden_epoch, oscar_gala, fashion_stride, star_carpet, flame_carpet, frost_carpet, mecha_x, style_me, tap_me, saber_warrior, pet2human, graduation, fishermen, happy_birthday, fairy_me, ladudu_me, ladudu_me_random, squid_game, superman, grow_wings, clevage, fly_with_doraemon, creatice_product_down, pole_dance, hug_from_behind, creatice_product_up_cybercity, creatice_product_up_bluecircuit, creatice_product_up, run_fast, background_explosion
URLs of the images to use with the template. Number of images required varies by template: 'dynasty_dress' and 'shop_frame' accept 1-2 images, 'wish_sender' requires exactly 3 images, all other templates accept only 1 image.
seed integerRandom seed for generation
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16
Q1TextToVideoRequest#
prompt string* requiredText prompt for video generation, max 1500 characters
style StyleEnumThe style of output video Default value: "general"
Possible enum values: general, anime
seed integerSeed for the random number generator
aspect_ratio AspectRatioEnumThe aspect ratio of the output video Default value: "16:9"
Possible enum values: 16:9, 9:16, 1:1
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
Q2ImageToVideoRequest#
prompt string* requiredText prompt for video generation, max 3000 characters
image_url string* requiredURL of the image to use as the starting frame
seed integerRandom seed for generation. Use -1 for random seed
duration DurationEnumDuration of the video in seconds Default value: "4"
Possible enum values: 2, 3, 4, 5, 6, 7, 8
resolution ResolutionEnumOutput video resolution Default value: "720p"
Possible enum values: 720p, 1080p
movement_amplitude MovementAmplitudeEnumThe movement amplitude of objects in the frame Default value: "auto"
Possible enum values: auto, small, medium, large
mode ModeEnumGeneration mode: turbo for faster generation, pro for higher quality Default value: "turbo"
Possible enum values: turbo, pro
bgm booleanWhether to add background music to the video (only for 4-second videos)