SDK 및 코드 예제

Seedance 2.0 API는 표준 REST 인터페이스를 사용하므로 어떤 HTTP 클라이언트에서든 호출할 수 있으며 별도의 SDK가 필요하지 않습니다. 이 페이지는 세 가지 생성 모드 모두에 대해 그대로 복사해 쓸 수 있는 코드를 제공합니다.

베이스 URL

https://api.evolink.ai

모든 예제는 export EVOLINK_API_KEY="your-api-key-here"가 설정되어 있다고 가정합니다.

Text-to-Video

Python

import os
import time
import requests

API_KEY = os.environ["EVOLINK_API_KEY"]
BASE_URL = "https://api.evolink.ai"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# 1. 작업 생성
response = requests.post(
    f"{BASE_URL}/v1/videos/generations",
    headers=headers,
    json={
        "model": "seedance-2.0-text-to-video",
        "prompt": "A cinematic sunset over the ocean, wide shot",
        "duration": 5,
        "quality": "720p",
        "aspect_ratio": "16:9"
    }
)
task_id = response.json()["id"]
print(f"Task created: {task_id}")

# 2. 폴링
while True:
    result = requests.get(f"{BASE_URL}/v1/tasks/{task_id}", headers=headers).json()

    if result["status"] == "completed":
        print(f"Video URL: {result['results'][0]}")
        break
    if result["status"] == "failed":
        print("Generation failed")
        break

    print(f"Progress: {result['progress']}%")
    time.sleep(5)

Node.js

const API_KEY = process.env.EVOLINK_API_KEY;
const BASE_URL = "https://api.evolink.ai";

const headers = {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
};

// 1. 작업 생성
const createRes = await fetch(`${BASE_URL}/v1/videos/generations`, {
    method: "POST",
    headers,
    body: JSON.stringify({
        model: "seedance-2.0-text-to-video",
        prompt: "A cinematic sunset over the ocean, wide shot",
        duration: 5,
        quality: "720p",
        aspect_ratio: "16:9"
    })
});
const { id: taskId } = await createRes.json();
console.log(`Task created: ${taskId}`);

// 2. 폴링
while (true) {
    const res = await fetch(`${BASE_URL}/v1/tasks/${taskId}`, { headers });
    const result = await res.json();

    if (result.status === "completed") {
        console.log(`Video URL: ${result.results[0]}`);
        break;
    }
    if (result.status === "failed") {
        console.log("Generation failed");
        break;
    }

    console.log(`Progress: ${result.progress}%`);
    await new Promise(r => setTimeout(r, 5000));
}

cURL

# 1. 작업 생성
curl -X POST https://api.evolink.ai/v1/videos/generations \
  -H "Authorization: Bearer $EVOLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2.0-text-to-video",
    "prompt": "A cinematic sunset over the ocean, wide shot",
    "duration": 5,
    "quality": "720p"
  }'

# 응답: {"id": "task-unified-...", "status": "pending", ...}

# 2. 상태 조회
curl https://api.evolink.ai/v1/tasks/TASK_ID \
  -H "Authorization: Bearer $EVOLINK_API_KEY"

Image-to-Video

첫 프레임 모드 (이미지 1장)

response = requests.post(
    f"{BASE_URL}/v1/videos/generations",
    headers=headers,
    json={
        "model": "seedance-2.0-image-to-video",
        "prompt": "The model slowly turns, hair flowing gently in the wind",
        "image_urls": ["https://example.com/portrait.jpg"],
        "duration": 5,
        "quality": "720p",
        "aspect_ratio": "adaptive"
    }
)

첫-마지막 프레임 전환 (이미지 2장)

response = requests.post(
    f"{BASE_URL}/v1/videos/generations",
    headers=headers,
    json={
        "model": "seedance-2.0-image-to-video",
        "prompt": "A smooth transition from sunrise to sunset over the same ocean",
        "image_urls": [
            "https://example.com/sunrise.jpg",
            "https://example.com/sunset.jpg"
        ],
        "duration": 6,
        "quality": "720p"
    }
)

Reference-to-Video

단일 요청에 이미지, 비디오, 오디오 참조 자료를 함께 사용할 수 있습니다.

response = requests.post(
    f"{BASE_URL}/v1/videos/generations",
    headers=headers,
    json={
        "model": "seedance-2.0-reference-to-video",
        "prompt": (
            "Replicate video 1's first-person perspective and pacing; "
            "use audio 1 as background music throughout. "
            "Scene: a young rider weaving through rain-soaked city streets "
            "at night, neon reflections on wet asphalt."
        ),
        "image_urls": ["https://example.com/rider-style.jpg"],
        "video_urls": ["https://example.com/pov-reference.mp4"],
        "audio_urls": ["https://example.com/synthwave-bgm.mp3"],
        "duration": 10,
        "quality": "720p",
        "aspect_ratio": "16:9"
    }
)

참고: reference-to-video에는 @Image1, @Video1 같은 태그 문법이 없습니다. 각 자료의 역할은 자연어로 설명하세요.

Fast 모델 사용

model 필드를 seedance-2.0-xxx에서 seedance-2.0-fast-xxx로 바꾸기만 하면 됩니다. 다른 매개변수는 모두 동일합니다.

response = requests.post(
    f"{BASE_URL}/v1/videos/generations",
    headers=headers,
    json={
        "model": "seedance-2.0-fast-text-to-video",  # ← 이 부분만 변경
        "prompt": "A cinematic sunset over the ocean, wide shot",
        "duration": 5,
        "quality": "720p"
    }
)

Fast 모델을 참고하세요.

폴링 대신 웹훅 사용

response = requests.post(
    f"{BASE_URL}/v1/videos/generations",
    headers=headers,
    json={
        "model": "seedance-2.0-text-to-video",
        "prompt": "A cat playing piano",
        "duration": 5,
        "callback_url": "https://yourapp.com/api/video-callback"
    }
)
# 웹훅 엔드포인트는 작업 조회 엔드포인트와 동일한 본문 형식의 POST 요청을 받습니다

Webhooks를 참고하세요.

OpenAI 스타일 컨벤션

API는 OpenAI 스타일의 REST 컨벤션(Bearer 토큰, JSON 본문, 통합된 응답 스키마)을 따릅니다. 어떤 HTTP 클라이언트 라이브러리든 사용할 수 있으며 전용 SDK는 필요하지 않습니다.

관련 문서