Seedance
seedance · Video · unitool
Seedance 1.5 Pro — это модель генерации аудио- и видеоконтента от ByteDance, которая создает видео кинематографического качества, синхронизированный звук и многоязычные диалоги с использованием кинематографических приемов ведения камеры.
Generations are async: create, wait or poll, the result by link for 7 days. Details: Media generations
Seedance 2.5
Mode seedance-2-5 · seedance:seedance-2-5
Price
Depends on the parameters: 200 tokens for the example below, base 440. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 440,
"example_price": 200,
"matrix": [
{
"when": {
"resolution": "480p"
},
"when_set": [
"video_url"
],
"rate": 7,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "480p"
},
"when_unset": [
"video_url"
],
"rate": 11,
"per": "duration"
},
{
"when": {
"resolution": "720p"
},
"when_set": [
"video_url"
],
"rate": 15,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "720p"
},
"when_unset": [
"video_url"
],
"rate": 25,
"per": "duration"
},
{
"when": {
"resolution": "1080p"
},
"when_set": [
"video_url"
],
"rate": 26,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "1080p"
},
"when_unset": [
"video_url"
],
"rate": 44,
"per": "duration"
},
{
"when": {
"resolution": "4k"
},
"when_set": [
"video_url"
],
"rate": 87,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "4k"
},
"when_unset": [
"video_url"
],
"rate": 141,
"per": "duration"
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | |
aspect_ratio | adaptive | 16:9 | 4:3 | 1:1 | 3:4 | 9:16 | 21:9 | Соотношение сторон. «Авто» подбирает кадр под задачу и входные файлы. При монтаже и продлении видео, а также при первом/последнем кадре модель принимает только «Авто».Default "adaptive" |
resolution | 480p | 720p | 1080p | 4k | Качество. 480p, 720p, 1080p или 4K. Чем выше качество, тем дороже секунда генерации. 4K кодируется в 10-битный H.265 — часть плееров и браузеров его не открывает.Default "720p" |
duration | number 4–30 | Длительность. 4–30 секунд. Длительность умножается на стоимость секунды; с референс-видео тарифицируются секунды входа и выхода вместе. При включённой «Длительности по видео» ползунок не действует.Default 8 |
duration_auto | boolean | Длительность по видео. Для монтажа и продления загруженного видео: длину и формат кадра модель берёт из исходного клипа. Ползунок длительности при этом не действует, кадр переключается на «Авто». Работает только вместе с референс-видео. |
generate_audio | boolean | Добавить звук. Модель озвучит ролик: речь, шумы и музыку по смыслу промпта. Реплики берите в кавычки. Выключено — видео без звука.Default true |
first_frame_url | file | Первый кадр. Одно изображение: jpeg, png, webp, bmp, tiff, gif, heic, heif. Стороны 300–6000 px, соотношение 0.4–2.5, до 30 МБ. Нельзя использовать вместе с референсами. Реальные лица модель отклоняет. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
last_frame_url | file | Последний кадр. Одно изображение, требования как у первого кадра. Передаётся только вместе с первым кадром; при разных пропорциях кадрируется под него. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
video_url | file | Референс-видео. Одно видео mp4 или mov, 2–30 секунд, до 200 МБ, 24–60 FPS, стороны 300–6000 px. Реальные лица модель отклоняет. С референс-видео ставка за секунду ниже, но оплачиваются секунды входного клипа плюс секунды результата. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
audio_url | file | Референс-аудио. Одно аудио wav или mp3, 2–30 секунд, до 15 МБ. Seedance 2.5 принимает аудио и без изображения или видео. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
reference_image_urls | array of file (≤ 10) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "seedance",
"mode": "seedance-2-5",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "seedance",
"mode": "seedance-2-5",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "seedance",
"mode": "seedance-2-5",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));Seedance 2.0
Mode seedance-2-0 · seedance:seedance-2-0
Price
Depends on the parameters: 128 tokens for the example below, base 100. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 100,
"example_price": 128,
"matrix": [
{
"when": {
"resolution": "480p"
},
"when_set": [
"video_url"
],
"rate": 4,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "480p"
},
"when_unset": [
"video_url"
],
"rate": 7,
"per": "duration"
},
{
"when": {
"resolution": "720p"
},
"when_set": [
"video_url"
],
"rate": 10,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "720p"
},
"when_unset": [
"video_url"
],
"rate": 16,
"per": "duration"
},
{
"when": {
"resolution": "1080p"
},
"when_set": [
"video_url"
],
"rate": 25,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "1080p"
},
"when_unset": [
"video_url"
],
"rate": 40,
"per": "duration"
},
{
"when": {
"resolution": "4k"
},
"when_set": [
"video_url"
],
"rate": 50,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "4k"
},
"when_unset": [
"video_url"
],
"rate": 82,
"per": "duration"
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | |
aspect_ratio | adaptive | 16:9 | 4:3 | 1:1 | 3:4 | 9:16 | 21:9 | Соотношение сторон. «Авто» подбирает кадр под задачу и входные файлы.Default "adaptive" |
resolution | 480p | 720p | 1080p | 4k | Качество. 480p, 720p, 1080p или 4K. 4K кодируется в 10-битный H.265 — часть плееров и браузеров его не открывает.Default "720p" |
duration | number 4–15 | Длительность. 4–15 секунд. Длительность напрямую умножается на стоимость.Default 8 |
generate_audio | boolean | Добавить звук. Модель озвучит ролик: речь, шумы и музыку по смыслу промпта. Реплики берите в кавычки. Выключено — видео без звука.Default true |
first_frame_url | file | Первый кадр. Одно изображение: jpeg, png, webp, bmp, tiff, gif, heic, heif. Стороны 300–6000 px, соотношение 0.4–2.5, до 30 МБ. Нельзя использовать вместе с референсами. Реальные лица модель отклоняет. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
last_frame_url | file | Последний кадр. Одно изображение, требования как у первого кадра. Передаётся только вместе с первым кадром; при разных пропорциях кадрируется под него. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
video_url | file | Референс-видео. Одно видео mp4 или mov, 2–15 секунд, до 200 МБ, 24–60 FPS, стороны 300–6000 px. Через шлюз уходит один клип, хотя API модели принимает до 3 общей длиной до 15 секунд. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
audio_url | file | Референс-аудио. Одно аудио wav или mp3, 2–15 секунд, до 15 МБ. Без изображения или видео Seedance 2.0 аудио не принимает — добавьте хотя бы один визуальный референс. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
reference_image_urls | array of file (≤ 9) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "seedance",
"mode": "seedance-2-0",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "seedance",
"mode": "seedance-2-0",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "seedance",
"mode": "seedance-2-0",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));Seedance 2 Fast
Mode seedance-2-fast · seedance:seedance-2-fast
Price
Depends on the parameters: 128 tokens for the example below, base 128. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 128,
"example_price": 128,
"matrix": [
{
"when": {
"resolution": "480p"
},
"when_set": [
"video_url"
],
"rate": 4,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "480p"
},
"when_unset": [
"video_url"
],
"rate": 8,
"per": "duration"
},
{
"when": {
"resolution": "720p"
},
"when_set": [
"video_url"
],
"rate": 10,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "720p"
},
"when_unset": [
"video_url"
],
"rate": 16,
"per": "duration"
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | |
aspect_ratio | adaptive | 16:9 | 4:3 | 1:1 | 3:4 | 9:16 | 21:9 | Соотношение сторонDefault "adaptive" |
resolution | 480p | 720p | КачествоDefault "720p" |
duration | number 4–15 | ДлительностьDefault 8 |
generate_audio | boolean | Добавить звукDefault true |
first_frame_url | file | Первый кадр. Используйте отдельно от референсов. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
last_frame_url | file | Последний кадр. Добавьте вместе с первым кадром. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
video_url | file | Референс-видео. Одно видео mp4 или mov, 2–15 секунд. С референс-видео ставка за секунду ниже, но оплачиваются секунды входного клипа плюс секунды результата. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
audio_url | file | Референс-аудио. Одно аудио wav или mp3, 2–15 секунд. Также добавьте фото или видео. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
reference_image_urls | array of file (≤ 9) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "seedance",
"mode": "seedance-2-fast",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "seedance",
"mode": "seedance-2-fast",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "seedance",
"mode": "seedance-2-fast",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));Seedance 2 Mini
Mode seedance-2-mini · seedance:seedance-2-mini
Price
Depends on the parameters: 112 tokens for the example below, base 112. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 112,
"example_price": 112,
"matrix": [
{
"when": {
"resolution": "480p"
},
"when_set": [
"video_url"
],
"rate": 4,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "480p"
},
"when_unset": [
"video_url"
],
"rate": 6,
"per": "duration"
},
{
"when": {
"resolution": "720p"
},
"when_set": [
"video_url"
],
"rate": 9,
"per": "duration",
"plus": [
"video_url_duration_sec"
],
"plus_mode": "sum"
},
{
"when": {
"resolution": "720p"
},
"when_unset": [
"video_url"
],
"rate": 14,
"per": "duration"
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | |
aspect_ratio | adaptive | 16:9 | 4:3 | 1:1 | 3:4 | 9:16 | 21:9 | Соотношение сторонDefault "adaptive" |
resolution | 480p | 720p | КачествоDefault "720p" |
duration | number 4–15 | ДлительностьDefault 8 |
generate_audio | boolean | Добавить звукDefault true |
first_frame_url | file | Первый кадр. Используйте отдельно от референсов. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
last_frame_url | file | Последний кадр. Добавьте вместе с первым кадром. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
video_url | file | Референс-видео. Одно видео mp4 или mov, 2–15 секунд. С референс-видео ставка за секунду ниже, но оплачиваются секунды входного клипа плюс секунды результата. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
audio_url | file | Референс-аудио. Одно аудио wav или mp3, 2–15 секунд. Также добавьте фото или видео. A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
reference_image_urls | array of file (≤ 9) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "seedance",
"mode": "seedance-2-mini",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "seedance",
"mode": "seedance-2-mini",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "seedance",
"mode": "seedance-2-mini",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"generate_audio": true
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));seedance-1.5-pro
Mode seedance-1.5-pro · seedance:seedance-1.5-pro
Price
Depends on the parameters: 9 tokens for the example below, base 25. Get the exact price of your request from POST /v1/quotes.
Price make-up (pricing from GET /v1/models/{id})
{
"unit": "tokens",
"kind": "by_parameters",
"base": 25,
"example_price": 9,
"matrix": [
{
"when": {
"resolution": "480p"
},
"rate": 1.1,
"per": "duration"
},
{
"when": {
"resolution": "720p"
},
"rate": 2.4,
"per": "duration"
},
{
"when": {
"resolution": "1080p"
},
"rate": 5.1,
"per": "duration"
}
],
"addons": [
{
"when": {
"generate_audio": "true"
},
"multiply": 2
}
]
}Parameters
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | |
aspect_ratio | 1:1 | 21:9 | 4:3 | 3:4 | 16:9 | 9:16 | Соотношение сторон. Соотношение сторон генерируемого видеоDefault "16:9" |
duration | 4 | 8 | 12 | ДлительностьDefault "8" |
fixed_lens | boolean | Фиксированная камера. Включите, чтобы изображение с камеры оставалось неподвижным и стабильным. Отключите для динамичного перемещения камеры.Default false |
generate_audio | boolean | ЗвукDefault false |
resolution | 480p | 720p | 1080p | Качество. Качество генерируемого видеоDefault "480p" |
image_urls | array of file (≤ 2) | A file_ref (asset:… or attachment:…), an https URL or a data: URL. |
Example request
curl https://api.unitool.ai/v1/generations \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Prefer: wait=60" \
-d '{
"model": "seedance",
"mode": "seedance-1.5-pro",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"duration": "8",
"generate_audio": false,
"resolution": "480p"
}
}'import json, os, time, uuid, requests
API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
"model": "seedance",
"mode": "seedance-1.5-pro",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"duration": "8",
"generate_audio": false,
"resolution": "480p"
}
}''')
gen = requests.post(f"{API}/generations", json=body,
headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
"model": "seedance",
"mode": "seedance-1.5-pro",
"input": {
"prompt": "A red fox running through fresh snow at sunrise",
"aspect_ratio": "16:9",
"duration": "8",
"generate_audio": false,
"resolution": "480p"
}
};
let gen = await (await fetch(`${API}/generations`, {
method: "POST", body: JSON.stringify(body),
headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
await new Promise((resolve) => setTimeout(resolve, 5000));
gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));