동영상 작업 생성
Seedance API(v3)
https://api.tokenlio.ai와 플랫폼 Bearer Key, 현재 목록의 정확한 model ID를 사용하세요. 상세 필드는 공식 자료를 참고할 수 있으며 호출 주소·인증·예시는 본문을 따르세요.
model/content를 보내 동영상 작업을 만듭니다. HTTP200/id는 접수이며 최종 결과는 조회 또는 콜백으로 얻습니다.
요청 매개변수
| 필드 | 타입 | 기본값 | 설명 |
|---|---|---|---|
model | string | 필수 | 현재 목록의 정확한 공개 모델 ID. 모델과 입력을 확인하세요. |
content | object[] | 필수 | 비어 있지 않은 텍스트·미디어 배열. |
resolution | string | 720p | 모델이 지원하는 출력 해상도. |
ratio | string | adaptive | 16:9, 9:16, 3:4, 1:1, 4:3, 21:9, adaptive. Mini의 adaptive는 지원 시 사용. |
duration | integer | 모델 기본값 | 2.0 계열 4~15초, 2.5는 4~30초. -1은 자동 길이. 2.5 기본값은 -1, Mini의 -1은 지원 시 사용. |
generate_audio | boolean | true | 오디오 생성. Fast/Mini 예시는 false이며 오디오 기능은 지원 시 사용. |
return_last_frame | boolean | false | 지원 시 마지막 프레임 URL 반환. |
watermark | boolean | false | 생성 콘텐츠 워터마크. |
seed | integer | — | 난수 시드. 동일한 출력은 보장되지 않음. |
output_format | string | mp4 | 2.5는 mov도 지원. |
priority | integer | 0 | 0~9. |
execution_expires_after | integer | 172800 | 유효 기간(초), 3600~259200. |
tools | object[] | — | 텍스트 입력 전용, {"type":"web_search"} 최대 1개. |
omni_reference_task_type | string | auto | 2.5의 auto / reference. edit / extend는 지원 시 사용. |
draft | boolean | false | 지원되는 2.5 드래프트 모드. |
callback_url | string | — | 플랫폼 작업 객체를 받는 public HTTPS 생성 콜백. X-Tokenlio-Event-Id로 멱등 처리. |
JSON 필드는 대소문자를 구분합니다. 실제 불리언·정수 타입을 사용하고 불필요한 필드는 생략하세요. 요청은 64 MiB 이내입니다. 생성·개별 조회·DELETE는 쿼리 매개변수를 사용하지 않으며 목록 매개변수는작업 관리를 확인하세요.
content 요소
| type | 값 | role |
|---|---|---|
text | text | — |
image_url | image_url.url | reference_image, first_frame, last_frame |
video_url | video_url.url | reference_video |
audio_url | audio_url.url | reference_audio |
draft_task | draft_task.id | — |
role은 미디어 객체와 같은 계층입니다. 공개 HTTPS URL 또는 asset://ASSET_ID를 사용할 수 있으며, 이미지는 image_url.url에 Base64 Data URL을 직접 넣을 수도 있습니다. 이미지 입력을 확인하세요. URL에 API Key를 넣지 마세요. 첫·마지막 프레임과 참조 미디어는 혼합할 수 없습니다. 2.0 계열의 참조 오디오는 이미지 또는 동영상과 함께 사용하며 2.5는 오디오만 참조할 수 있습니다. 2.5 첫·마지막 프레임은 ratio=adaptive가 필요합니다.
이미지 입력: URL, Base64, 에셋 ID
첫 프레임, 마지막 프레임, 참조 이미지의 content[].image_url.url은 다음 세 가지 방식을 지원합니다.
| 방식 | image_url.url 값 | 사용 방법 |
|---|---|---|
| 공개 이미지 URL | https://example.com/valley.png | 직접 접근할 수 있고 처리 중에도 유효한 이미지 주소. |
| 로컬 이미지 Base64 | data:image/png;base64,<전체 Base64 데이터> | 인코딩한 파일을 JSON에 넣습니다. 이미지 호스팅이나 CreateAsset 사전 호출이 필요하지 않습니다. |
| 에셋 ID | asset://ASSET_ID | 기존 에셋을 참조합니다. 에셋 관리를 확인하세요. |
전체 형식 data:image/<이미지 형식>;base64,<Base64 데이터>를 사용하세요. 이미지 형식은 소문자이며 실제 파일과 일치해야 합니다. PNG는 image/png, JPEG는 image/jpeg, WebP는 image/webp입니다. 접두사 없는 Base64, 로컬 경로, file:// URL은 Data URL을 대신할 수 없습니다. 표준 Base64를 줄바꿈 없는 연속 문자열로 사용하고 예시의 모든 자리표시자를 바꾸세요.
이미지 요구 사항은 공식 생성 API를 따릅니다.
- 형식:
jpeg,png,webp,bmp,tiff,gif. Seedance 2.0 이상은heic,heif도 지원합니다. - 이미지 한 장은 30 MB 미만이어야 합니다. 너비와 높이는 각각 300–6000 px, 너비/높이 비율은 0.4–2.5입니다.
- 플랫폼 생성 요청의 총상한은 64 MiB이며 JSON, 모든 인코딩 이미지, 기타 필드를 포함합니다. Base64 크기는 원본의 약 4/3이므로 여러 이미지는 합산하고 큰 파일은 공개 URL이나 에셋 ID를 사용하세요.
- 인코딩 방식은 미디어 개수, role, 모델 제한을 바꾸지 않습니다. 모델과 입력을 확인하세요.
first_frame은 시작 프레임이고reference_image는 생성 참조입니다. 참조 이미지와 첫·마지막 프레임 모드는 혼합할 수 없습니다.
전체 예시는 로컬 이미지 Base64 동영상 생성을 확인하세요. 인라인 이미지는 에셋 Action 업로드가 아닌 생성 요청에 넣습니다. 에셋 Action의 32 KiB 제한은 이 생성 요청에 적용되지 않습니다.
생성과 조회
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "A ceramic teapot in soft window light, slow camera orbit"
}
],
"resolution": "1080p",
"duration": 5,
"generate_audio": false
}'
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/contents/generations/tasks/TASK_ID" \
-H "Authorization: Bearer $TOKENLIO_API_KEY"생성 응답:
{
"id": "dfc68868-d388-4d83-a173-d44e47a8bec7"
}입력·모드 예시
다음 JSON은 같은 생성 API로 전송합니다. URL과 ID는 자신의 사용 가능한 입력으로 바꾸세요. 모드 지원 및 미디어 제한은 모델 문서를 확인하세요.
첫 프레임
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "The camera slowly approaches the subject"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first.png"
},
"role": "first_frame"
}
],
"duration": 5,
"generate_audio": false
}첫·마지막 프레임
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A smooth transition from sunrise to evening"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/last.png"
},
"role": "last_frame"
}
],
"ratio": "adaptive",
"duration": 8,
"generate_audio": false
}참조 이미지
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Use the character from image 1 walking through a garden"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/character.png"
},
"role": "reference_image"
}
],
"duration": 5,
"generate_audio": false
}로컬 이미지 Base64 동영상 생성
Python 3 표준 라이브러리로 로컬 PNG를 읽어 request.json을 만듭니다. 이 단계는 로컬 파일만 처리하며 생성을 시작하지 않습니다. ./valley.png를 자신의 이미지로 바꾸세요. JPEG를 쓰면 Data URL 접두사도 data:image/jpeg;base64,로 바꿔야 합니다. 확장자만 바꾸면 안 됩니다.
import base64
import json
from pathlib import Path
image = Path("./valley.png").read_bytes()
if not image or len(image) >= 30_000_000:
raise ValueError("Image must be nonempty and smaller than 30 MB")
payload = {
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Use the reference valley, lake and clouds. Cloud shadows move slowly, subtle ripples cross the water, and the camera steadily advances. Natural, realistic footage.",
},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64," + base64.b64encode(image).decode("ascii")
},
"role": "reference_image",
},
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": False,
}
body = json.dumps(payload, ensure_ascii=False).encode("utf-8")
if len(body) > 64 * 1024 * 1024:
raise ValueError("Encoded request exceeds 64 MiB; use a URL or asset ID")
Path("request.json").write_bytes(body)매개변수를 확인한 후 다음 명령으로 실제 생성 요청을 보내세요. 실제 사용량에 따라 과금됩니다. --data-binary @request.json은 전체 본문을 파일에서 읽으므로 큰 Base64 문자열을 명령줄 인수에 넣지 않아도 됩니다.
curl -sS --fail-with-body "https://api.tokenlio.ai/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $SEEDANCE_REQUEST_ID" \
--data-binary @request.json플랫폼 Key와 이번 의도에 고유한 SEEDANCE_REQUEST_ID를 미리 설정하세요. 복구할 때는 원래 멱등 키와 request.json을 유지하고 새 의도에는 새 키를 사용하세요. 생성을 자동 재전송하지 마세요. 접수되면 {"id":"플랫폼UUID"}를 반환합니다. 저장한 뒤 작업 조회로 상태와 content.video_url을 확인하세요. 접수는 생성 완료를 의미하지 않습니다.
원본 이미지를 동영상 시작 화면으로 사용하려면 reference_image를 first_frame으로 바꾸세요. Seedance 2.5 첫 프레임 모드에는 ratio:"adaptive"도 필요합니다. request.json에는 전체 이미지가 있으므로 원본 자료처럼 보관하고 로그나 소스 관리에 넣지 마세요.
참조 동영상
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Follow the camera movement in video 1 in a snowy street"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/movement.mp4"
},
"role": "reference_video"
}
],
"duration": 5,
"generate_audio": false
}이미지·동영상·오디오 참조
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "Use the character from image 1, the motion from video 1 and the rhythm of audio 1"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/character.png"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/movement.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/rhythm.mp3"
},
"role": "reference_audio"
}
],
"duration": 8,
"generate_audio": false
}2.5 오디오만 참조
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "An abstract landscape whose movement follows the rhythm of audio 1"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/rhythm.mp3"
},
"role": "reference_audio"
}
],
"duration": 10,
"generate_audio": false
}에셋 ID 참조
{
"model": "seedance-2.0-mini",
"content": [
{
"type": "text",
"text": "The referenced character waves at the camera"
},
{
"type": "image_url",
"image_url": {
"url": "asset://ASSET_ID"
},
"role": "reference_image"
}
],
"resolution": "720p",
"duration": 5,
"generate_audio": false
}생성 방법은 에셋·인물 인증 Action을 참고하세요.
웹 검색
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A documentary-style introduction to the city described in the prompt"
}
],
"tools": [
{
"type": "web_search"
}
],
"duration": 10,
"generate_audio": false
}마지막 프레임 출력
{
"model": "seedance-2.0",
"content": [
{
"type": "text",
"text": "A boat arrives at a quiet dock"
}
],
"duration": 5,
"return_last_frame": true,
"generate_audio": false
}성공하면 content.last_frame_url을 읽습니다.
MOV 출력
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A slow overhead shot of a forest canopy"
}
],
"duration": 8,
"output_format": "mov",
"generate_audio": false
}긴 장면
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A continuous 20-second shot: a traveler leaves the station, crosses a courtyard and approaches a waiting train"
}
],
"resolution": "1080p",
"duration": 20,
"generate_audio": false
}2.5 편집과 연장
두 모드 모두 참조 동영상과 ratio=adaptive가 필요합니다. 편집은 duration=-1을 사용하며 입력 영상은 4~30초입니다. 연장 프롬프트는 다음 행동을 설명하세요. 각 모드는 지원되는 경우 사용할 수 있습니다.
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "Change the setting in video 1 from daytime to sunset"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/source.mp4"
},
"role": "reference_video"
}
],
"omni_reference_task_type": "edit",
"ratio": "adaptive",
"duration": -1,
"generate_audio": false
}{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "Continue video 1 as the subject turns and walks toward the sea"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/source.mp4"
},
"role": "reference_video"
}
],
"omni_reference_task_type": "extend",
"ratio": "adaptive",
"duration": 8,
"generate_audio": false
}드래프트를 정식 동영상으로 변환
480p 드래프트를 만든 뒤 성공한 작업 ID만 content의 유일한 요소로 넣고 출력은 1080p로 지정합니다. 상속되는 draft, duration, ratio, seed, generate_audio, omni_reference_task_type, tools, bitrate_mode는 생략합니다. 드래프트에서는 마지막 프레임을 요청하지 마세요.
{
"model": "seedance-2.5",
"content": [
{
"type": "text",
"text": "A cinematic tracking shot through a bamboo forest"
}
],
"draft": true,
"resolution": "480p",
"duration": 5,
"generate_audio": false
}{
"model": "seedance-2.5",
"content": [
{
"type": "draft_task",
"draft_task": {
"id": "dfc68868-d388-4d83-a173-d44e47a8bec7"
}
}
],
"resolution": "1080p"
}