Video Generation
Text-to-video and image-to-video generation. Because a render takes minutes, video is an asynchronous task: you submit a prompt, receive a task_id, poll until it finishes, then download the MP4. Example models include veo-3.1-lite-generate-001, veo-3.1-fast-generate-001, dreamina-seedance-2-0-fast, and doubao-seedance-1-5-pro-251215 — see the model square for the full list and pricing.
1. POST a task → get task_id. 2. GET the task until status is SUCCESS → read result_url. 3. GET the content URL → download video/mp4.
Step 1 · Submit a Task
curl https://apicdn.xyc.ai/v1/video/generations \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "veo-3.1-lite-generate-001",
"prompt": "A golden retriever puppy running on grass, 4 seconds"
}'
import requests
base = "https://apicdn.xyc.ai"
key = "sk-xxxxxxxx"
headers = {"Authorization": f"Bearer {key}"}
resp = requests.post(
f"{base}/v1/video/generations",
headers=headers,
json={
"model": "veo-3.1-lite-generate-001",
"prompt": "A golden retriever puppy running on grass, 4 seconds",
},
)
task_id = resp.json()["task_id"]
print(task_id)
The response returns immediately with a queued task:
{
"id": "task_UrufFh4Ww57Q6XWZ7trGZJajiHGw88Md",
"task_id": "task_UrufFh4Ww57Q6XWZ7trGZJajiHGw88Md",
"object": "video",
"model": "veo-3.1-lite-generate-001",
"status": "queued",
"progress": 0
}
Request Parameters
| Parameter | Type | Notes |
|---|---|---|
model | string | Required. Video model name, e.g. veo-3.1-lite-generate-001 |
prompt | string | Required. Text description of the video |
image | string | Optional. Image URL or base64 for image-to-video (model dependent) |
Step 2 · Poll for Status
Poll every 5–10 seconds. status moves through queued → IN_PROGRESS → SUCCESS (or FAILURE). When it reaches SUCCESS, the response carries result_url.
curl https://apicdn.xyc.ai/v1/video/generations/task_UrufFh4Ww57Q6XWZ7trGZJajiHGw88Md \
-H "Authorization: Bearer sk-xxxxxxxx"
Completed response (trimmed):
{
"code": "success",
"data": {
"task_id": "task_UrufFh4Ww57Q6XWZ7trGZJajiHGw88Md",
"status": "SUCCESS",
"progress": "100%",
"result_url": "https://apicdn.xyc.ai/v1/videos/task_UrufFh4Ww57Q6XWZ7trGZJajiHGw88Md/content"
}
}
Step 3 · Download the Video
Fetch the result_url (or build the content URL from the task_id) to download the rendered video/mp4.
curl -L https://apicdn.xyc.ai/v1/videos/task_UrufFh4Ww57Q6XWZ7trGZJajiHGw88Md/content \
-H "Authorization: Bearer sk-xxxxxxxx" \
-o output.mp4
Full Python Example
import time, requests
base = "https://apicdn.xyc.ai"
headers = {"Authorization": "Bearer sk-xxxxxxxx"}
# 1. submit
task_id = requests.post(
f"{base}/v1/video/generations", headers=headers,
json={"model": "veo-3.1-lite-generate-001",
"prompt": "A puppy running on grass, 4 seconds"},
).json()["task_id"]
# 2. poll
while True:
data = requests.get(f"{base}/v1/video/generations/{task_id}", headers=headers).json()["data"]
if data["status"] == "SUCCESS":
break
if data["status"] == "FAILURE":
raise RuntimeError(data.get("fail_reason"))
time.sleep(8)
# 3. download
mp4 = requests.get(data["result_url"], headers=headers).content
open("output.mp4", "wb").write(mp4)
Veo models are billed per task (by duration). Seedance / Dreamina models are billed per token at the upstream official rate. Your account's vendor discount is applied automatically. Check the model square for current prices.