Seedance API quickstart: from API key to your first video
This guide walks through Seedance 2.0 end to end; for 2.5, 2.5 Flash, 2.0 Fast or 2.0 Mini just change the model ID. It takes about five minutes.
1. Create an account and top up
Create an account on the sign-up page, then top up in your wallet. For invoices and volume, contact us.
2. Create an API key
Open API keys and create one; it starts with sk-. Keep it on your server only:
export PXROUTER_API_KEY="sk-..."
3. Pick a base URL and model
| Base URL | Use for |
|---|---|
https://pxrouter.com | Default, outside mainland China |
https://cn.pxrouter.com | Mainland China; videos download from storage in China |
| Model | China model ID | Global model ID | Resolution | Duration (s) | Max reference images / videos / audio |
|---|---|---|---|---|---|
| Seedance 2.5 | doubao-seedance-2-5-261111 | dreamina-seedance-2-5-261111 | 480p、720p、1080p | 4–30 | 30 / 10 / 10 |
| Seedance 2.5 Flash | doubao-seedance-2-5-flash-261111 | dreamina-seedance-2-5-flash-261111 | 480p、720p | 4–30 | 10 / 5 / 5 |
| Seedance 2.0 | doubao-seedance-2-0-261111 | dreamina-seedance-2-0-261111 | 480p、720p、1080p、4K | 4–15 | 9 / 3 / 3 |
| Seedance 2.0 Fast | doubao-seedance-2-0-fast-261111 | dreamina-seedance-2-0-fast-261111 | 480p、720p | 4–15 | Set by upstream |
| Seedance 2.0 Mini | doubao-seedance-2-0-mini-261111 | dreamina-seedance-2-0-mini-261111 | 480p、720p | 4–15 | Set by upstream |
4. Submit a task
POST /api/v3/contents/generations/tasks returns a task ID. These samples submit and then poll until the task ends:
curl https://pxrouter.com/api/v3/contents/generations/tasks \
-H "Authorization: Bearer $PXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0-261111",
"content": [
{
"type": "text",
"text": "An orange cat stretches on a sunny windowsill, slow dolly-in, warm cinematic light"
}
],
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"generate_audio": true
}'import os
import time
import requests
BASE_URL = "https://pxrouter.com/api/v3/contents/generations/tasks"
HEADERS = {"Authorization": f"Bearer {os.environ['PXROUTER_API_KEY']}"}
payload = {
"model": "dreamina-seedance-2-0-261111",
"content": [
{
"type": "text",
"text": "An orange cat stretches on a sunny windowsill, slow dolly-in, warm cinematic light"
}
],
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"generate_audio": True
}
# 1. Submit the task and get its ID
task_id = requests.post(BASE_URL, headers=HEADERS, json=payload).json()["id"]
# 2. Poll every 10 seconds until it ends
while True:
task = requests.get(f"{BASE_URL}/{task_id}", headers=HEADERS).json()
if task["status"] in ("succeeded", "failed", "cancelled", "expired"):
break
time.sleep(10)
print(task["status"], task.get("content", {}).get("video_url"))const BASE_URL = 'https://pxrouter.com/api/v3/contents/generations/tasks'
const headers = {
Authorization: `Bearer ${process.env.PXROUTER_API_KEY}`,
'Content-Type': 'application/json',
}
const payload = {
"model": "dreamina-seedance-2-0-261111",
"content": [
{
"type": "text",
"text": "An orange cat stretches on a sunny windowsill, slow dolly-in, warm cinematic light"
}
],
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"generate_audio": true
}
// 1. Submit the task and get its ID
const { id } = await fetch(BASE_URL, {
method: 'POST',
headers,
body: JSON.stringify(payload),
}).then((res) => res.json())
// 2. Poll every 10 seconds until it ends
let task
do {
await new Promise((resolve) => setTimeout(resolve, 10_000))
task = await fetch(`${BASE_URL}/${id}`, { headers }).then((res) => res.json())
} while (['queued', 'running'].includes(task.status))
console.log(task.status, task.content?.video_url)Using images or references? See: Text to Video · Image to Video · Reference to Video
5. Poll and download the video
curl https://pxrouter.com/api/v3/contents/generations/tasks/task_xxxxxxxx \
-H "Authorization: Bearer $PXROUTER_API_KEY"Once the status is succeeded, download the MP4 from content.video_url. Videos are kept for 60 days.
Reference materials (optional)
Upload frequently used references once and reuse them as asset://ID:
curl https://pxrouter.com/v1/materials \
-H "Authorization: Bearer $PXROUTER_API_KEY" \
-F [email protected] \
-F name=product-front
A material is ready once status is active. Materials belong to one key and are removed after 30 days unused. See the material library docs.
Migrating from the official API
- Base URL: the Ark or BytePlus endpoint →
https://pxrouter.com/api/v3 - API key → your PxRouter
sk-key - Model → an ID from the table above
callback_urlis not supported; poll instead
Common errors
| HTTP | Cause |
|---|---|
| 401 | Invalid, disabled or expired key |
| 400 | Bad parameters, too many or rejected references, duration out of range (not charged) |
| 403 | Insufficient balance, or material storage/group limit reached |
| 404 | Task or material not found, or owned by another key |
| 429 | Too many requests |
Include the request id from the error when contacting support.
FAQ
I already use the official SDK. How do I switch?
Set the SDK base_url to https://pxrouter.com/api/v3, use your PxRouter key and the model IDs listed here; the request code stays the same.
Can I use it without code?
Yes. Sign in and use the video console to enter a prompt and upload references; manage files in the material library.
How long does generation take?
It depends on model, resolution, length and upstream queueing — typically tens of seconds to a few minutes. Poll about every 10 seconds.