Text-to-Video
AI-generatedSummary
Generate a video from a text prompt using the selected Sora 2 model variant via the Kie.ai API, optionally waiting for the generation task to complete before returning the result.
Inputs
- Model — Select which Sora variant to use for text-to-video generation (Sora 2 Pro or Sora 2). Defaults to Sora 2 Pro.
- Prompt (required) — The text prompt describing the desired content of the video.
- Aspect Ratio — Choose the video's aspect ratio: Landscape (16:9) or Portrait (9:16). Defaults to Landscape.
- Duration — Select video length, either 10 or 15 seconds. Defaults to 10 seconds.
- Quality — Select video resolution: High (1080p) or Standard (720p). Defaults to High.
- Seed — Optional random seed number for reproducible results; 0 means random seed.
- Reply URL — Optional webhook URL to which Kie.ai will send a callback upon task completion.
- Reply Ref — Optional custom reference string passed back in the webhook callback.
- Captcha Token — Optional reCAPTCHA token if required by the API.
- Wait for Completion — Boolean flag to wait (poll every 3 seconds up to 5 minutes) for the video generation task to finish before returning.
Output shape
a JSON object representing the API response data from Kie.ai; if 'Wait for Completion' is true, includes the final completed task data, else includes initial task creation response.
If waiting for completion, this operation polls the Kie.ai API and returns the completed video generation result or failure status. If not waiting, it returns the task creation response containing the task ID. Errors throw exceptions unless 'Continue On Fail' is enabled.
Examples
Example 1: Generate a 10-second high-quality landscape video from a text prompt using Sora 2 Pro model, waiting synchronously for completion.
Model='Sora 2 Pro', Prompt='A serene mountain landscape at dawn', Aspect Ratio='Landscape', Duration=10, Quality='High', Seed=0, Wait for Completion=true.
Example 2: Start a video generation task without waiting, using Sora 2 model with portrait aspect ratio.
Model='Sora 2', Prompt='A futuristic cityscape at night', Aspect Ratio='Portrait', Duration=15, Quality='Standard', Wait for Completion=false.