> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudsome-inc.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Video quickstart

Create a task → check its status → get the video URL. Replace the API key and confirm access to the example model and videos scope to generate a 5-second, 720p video. No media upload or separate estimate request is needed.

> [tab] Python
>
> Run pip install requests, then copy and run this Python example to poll automatically and print the video URL.
>
> ```python theme={null}
> import time
> import requests
>
> BASE = "https://api.cloudsome-inc.ai/v1"
> HEADERS = {"Authorization": "Bearer sk_live_your_key_here"}
>
> response = requests.post(f"{BASE}/videos", headers=HEADERS, json={
>     "model": "dreamina-seedance-2.5",
>     "prompt": "A golden retriever running on the beach at sunset",
>     "duration": 5,
>     "resolution": "720p",
> }, timeout=60)
> response.raise_for_status()
> task_id = response.json()["tasks"][0]["id"]
> print("Task ID:", task_id)
>
> for _ in range(120):
>     response = requests.get(f"{BASE}/videos/{task_id}", headers=HEADERS, timeout=30)
>     response.raise_for_status()
>     task = response.json()
>     if task["status"] == "completed":
>         url = task.get("download_url") or task.get("url")
>         if not url:
>             raise RuntimeError(f"Video URL unavailable; query task {task_id} again.")
>         print(url)
>         break
>     if task["status"] in ("failed", "cancelled", "expired"):
>         raise RuntimeError(task.get("error") or task["status"])
>     time.sleep(5)
> else:
>     raise TimeoutError(f"Keep querying task {task_id}; do not create it again.")
> ```

> [tab] Node.js
>
> Use Node.js 18+. Save the example as video.mjs and run node video.mjs to poll automatically and print the video URL.
>
> ```javascript theme={null}
> const BASE = "https://api.cloudsome-inc.ai/v1";
> const headers = {
>   Authorization: "Bearer sk_live_your_key_here",
>   "Content-Type": "application/json",
> };
>
> async function request(path, options = {}) {
>   const response = await fetch(BASE + path, {
>     ...options, headers, signal: AbortSignal.timeout(60_000),
>   });
>   if (!response.ok) throw new Error(await response.text());
>   return response.json();
> }
>
> const batch = await request("/videos", {
>   method: "POST",
>   body: JSON.stringify({
>     model: "dreamina-seedance-2.5",
>     prompt: "A golden retriever running on the beach at sunset",
>     duration: 5,
>     resolution: "720p",
>   }),
> });
> const taskId = batch.tasks[0].id;
> console.log("Task ID:", taskId);
>
> for (let attempt = 0; ; attempt++) {
>   if (attempt === 120) throw new Error("Keep querying task " + taskId + "; do not create it again.");
>   const task = await request("/videos/" + taskId);
>   if (task.status === "completed") {
>     const url = task.download_url || task.url;
>     if (!url) throw new Error("Video URL unavailable; query task " + taskId + " again.");
>     console.log(url);
>     break;
>   }
>   if (["failed", "cancelled", "expired"].includes(task.status)) {
>     throw new Error(JSON.stringify(task.error || task.status));
>   }
>   await new Promise((resolve) => setTimeout(resolve, 5000));
> }
> ```

> [tab] cURL
>
> Run the first command to create a task, then replace VIDEO\_ID in the second command with tasks\[0].id from the response (not the top-level batch id). Repeat the second command about every 5 seconds until status is completed, failed, cancelled or expired.
>
> ```bash theme={null}
> curl --fail-with-body -sS https://api.cloudsome-inc.ai/v1/videos \
>   -H "Authorization: Bearer sk_live_your_key_here" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "dreamina-seedance-2.5",
>     "prompt": "A golden retriever running on the beach at sunset",
>     "duration": 5,
>     "resolution": "720p"
>   }'
>
> curl --fail-with-body -sS https://api.cloudsome-inc.ai/v1/videos/VIDEO_ID \
>   -H "Authorization: Bearer sk_live_your_key_here"
> ```

On success, open download\_url or url to download; failures are explained in error. Links expire after 15 minutes; query the task again for a fresh link. Save the task ID. If the script reaches its polling limit or a query is interrupted, keep querying the original task instead of creating another.

Task stage distinguishes waiting\_submission, submitting, upstream\_queued, generating, saving, completed, failed and verification\_pending. status and billing fields remain compatible. request\_id identifies the request; created\_at and completed\_at are platform timestamps, not model computation or browser first-frame times. Poll every 5 seconds while processing or settlement is pending, and stop after completion and settlement.

A saving task may return save\_retrying=true; keep querying the same task. Only a failed task with retryable=true can be regenerated with a new idempotency key and n=1, and it will be charged as a new request. error.category distinguishes input\_review, output\_review and copyright; the original upstream code is available in error.provider\_code. Queue capacity and rate limits return 429; retry later. Unknown submissions and incomplete usage require verification, never automatic regeneration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.