> ## 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.

# 동영상 생성 빠른 시작

작업 생성 → 상태 조회 → 동영상 URL 확인. API 키를 교체하고 예제 모델 접근 권한과 videos 권한을 확인하면 5초, 720p 동영상을 생성할 수 있습니다. 미디어 업로드나 별도 비용 견적 요청은 필요하지 않습니다.

> [tab] Python
>
> pip install requests 실행 후 아래 Python 예제를 복사하여 실행하세요. 자동으로 상태를 조회하고 동영상 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
>
> Node.js 18+를 사용하세요. 예제를 video.mjs로 저장하고 node video.mjs를 실행하면 자동으로 상태를 조회하고 동영상 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
>
> 첫 번째 명령으로 작업을 생성한 후 응답의 tasks\[0].id를 두 번째 명령의 VIDEO\_ID에 입력하세요(최상위 배치 id가 아닙니다). status가 completed, failed, cancelled 또는 expired가 될 때까지 약 5초마다 두 번째 명령을 반복하세요.
>
> ```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"
> ```

성공하면 download\_url 또는 url을 열어 다운로드하세요. 실패 원인은 error에 표시됩니다. 링크는 15분 후 만료되며 작업을 다시 조회하면 새 링크를 받을 수 있습니다. 작업 ID를 저장하세요. 조회 횟수 제한에 도달하거나 조회가 중단되면 새로 생성하지 말고 기존 작업을 계속 조회하세요.

작업 stage는 waiting\_submission, submitting, upstream\_queued, generating, saving, completed, failed, verification\_pending을 구분합니다. 기존 status와 요금 필드는 호환됩니다. request\_id는 요청 ID이며 created\_at과 completed\_at은 플랫폼 관측 시간으로 모델 계산 시간이나 브라우저 첫 프레임 시간이 아닙니다. 처리 또는 정산이 대기 중이면 5초마다 조회하고 완료 및 정산 후 중지합니다.

save\_retrying=true는 저장 재시도 중이므로 같은 작업을 계속 조회하세요. status=failed이고 retryable=true인 작업만 새 멱등 키와 n=1로 다시 생성할 수 있으며 새 요청으로 과금됩니다. error.category는 입력 검토, 출력 검토, 저작권 제한을 구분하고 error.provider\_code는 공급자의 원래 코드를 유지합니다. 대기열 포화 또는 속도 제한은 429를 반환하므로 나중에 다시 시도하세요. 제출 결과 불명확 또는 사용량 불완전 상태에서는 확인을 기다리며 자동으로 다시 생성하지 않습니다.


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