Seedance 2.5: draft to final video

Only Seedance 2.5 Standard supports this workflow. Generate a 480p draft, then use its ID to produce a 1080p or 4k final video. The two tasks are billed separately.

Set SHANHAI_BASE_URL and SHANHAI_API_KEY as described in Connection basics. Run the examples in the same Bash session with curl and jq.

1. Create the draft

set -euo pipefail
API="${SHANHAI_BASE_URL%/}/v1/videos"
AUTH="Authorization: Bearer ${SHANHAI_API_KEY:?}"
MODEL="doubao-seedance-2-5-260628"

if [[ -z ${DRAFT_ID:-} ]]; then
  DRAFT_ID=$(curl --fail-with-body -sS "$API" -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{
    "model": "doubao-seedance-2-5-260628",
    "prompt": "A blue paper boat floats slowly across still water.",
    "seconds": "4",
    "metadata": {"draft": true, "resolution": "480p", "ratio": "16:9"}
  }' | jq -er '.id | strings | select(length > 0)')
fi
printf 'DRAFT_ID=%s\n' "$DRAFT_ID"

2. Preview the draft

Poll using the id returned at creation. Keep polling while queued or in progress; download only after completed. If polling times out, keep the ID and resume without resubmitting. If submission times out without an ID, check your task list first.

wait_video() {
  local id="$1" status task i
  for ((i=0; i<120; i++)); do
    task=$(curl --fail-with-body -sS --max-time 60 "$API/$id" -H "$AUTH") || return 1
    status=$(jq -er '.status' <<<"$task") || return 1
    case "$status" in
      completed) return 0 ;;
      queued|in_progress) sleep 10 ;;
      *) printf '%s\n' "$task" >&2; return 1 ;;
    esac
  done
  printf 'Timeout: %s\n' "$id" >&2; return 1
}
wait_video "$DRAFT_ID"
curl --fail -sSL "$API/$DRAFT_ID/content" -H "$AUTH" -o draft.mp4

For a preview only, deliver the draft and its ID and stop. Continue after approval or if the user already requested the final video. Reuse an existing successful draft ID without creating another draft.

3. Create and download the final video

Pass DRAFT_ID as metadata.content[0].draft_task.id, not a video URL. Do not resend the prompt, media or duration. Set FINAL_RES to the requested 1080p or 4k.

FINAL_RES=${FINAL_RES:-1080p}
if [[ -z ${FINAL_ID:-} ]]; then
  FINAL_ID=$(jq -n --arg model "$MODEL" --arg draft "$DRAFT_ID" --arg res "$FINAL_RES" \
  '{model:$model,metadata:{resolution:$res,content:[{type:"draft_task",draft_task:{id:$draft}}]}}' |
  curl --fail-with-body -sS "$API" -H "$AUTH" -H 'Content-Type: application/json' \
    --data-binary @- | jq -er '.id | strings | select(length > 0)')
fi
printf 'FINAL_ID=%s\n' "$FINAL_ID"
wait_video "$FINAL_ID"
curl --fail -sSL "$API/$FINAL_ID/content" -H "$AUTH" -o final.mp4

The second submission returns a new FINAL_ID. Use it for status and final download; DRAFT_ID still downloads the draft.

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, error time and error information to facilitate troubleshooting.