API 快速开始
创建并轮询一个图生视频任务。
export SEEDANCE_BASE_URL="https://api.seedance2video.io/v1"
export SEEDANCE_API_KEY="sd_live_replace_me"Key 只保存在服务端 Secret Manager 或 n8n Credential 中。
curl --request POST "$SEEDANCE_BASE_URL/videos" \
--header "Authorization: Bearer $SEEDANCE_API_KEY" \
--header "Idempotency-Key: order-10086-shot-1" \
--header "Content-Type: application/json" \
--data '{
"model": "seedance-2.0-pro",
"mode": "image-to-video",
"prompt": "主体缓慢转向镜头,背景保持稳定。",
"inputs": [{
"type": "image",
"url": "https://media.example.com/reference.png"
}],
"parameters": {
"duration_seconds": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"generate_audio": true
}
}'输入域名需要提前加入该客户的白名单。接口返回 202、任务 id、status_url 和实际的 billing.cost_credits。
curl "$SEEDANCE_BASE_URL/generations/GENERATION_ID" \
--header "Authorization: Bearer $SEEDANCE_API_KEY"状态为 queued 或 processing 时按 retry_after_seconds 继续轮询;完成后读取 output.video_url 或 output.image_urls。
创建请求超时时,必须使用完全相同的请求体和 Idempotency-Key 重试,不能自动换新 Key 再创建一次。