Seedance portrait photos and videos

Before use, press Access Basics to set SHANHAI_BASE_URL (this site’s root address) and SHANHAI_API_KEY (this site’s token). The following command is suitable for Bash; the material example address must be replaced with a real address that can be downloaded directly.

API: Generate directly from a photo link

With the consent of the person pictured, you can generate a video directly from an HTTPS photo link. No asset registration is required.

Replace image_url.url with a direct HTTPS link to the original photo, not a sharing page. It must download without signing in and stay valid until the video task finishes.

curl --fail-with-body "$SHANHAI_BASE_URL/v1/videos" \
  -H "Authorization: Bearer $SHANHAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-mini-260615",
    "prompt": "The person in the photo looks at the camera and smiles.",
    "seconds": "4",
    "metadata": {
      "resolution": "480p",
      "content": [
        {"type": "image_url", "role": "reference_image", "image_url": {"url": "https://media.example.com/portrait.jpg"}}
      ]
    }
  }'

POST /v1/videos → id → GET /v1/videos/{task_id} → GET /v1/videos/{task_id}/content

Video task status and downloads

API: Register assets before generating

To reuse authorized photos or videos, register them on the site that issued your key. Only the four models below support registration. For 2.5 Flash, use the photo link method above.

Submit each asset separately and save the receipt. Check its status with the same account and model until it is Active, then use the returned asset_url.

  1. POST /v1/portrait-assets → data.id
  2. GET /v1/portrait-assets/{id}?model=MODEL → Active → data.asset_url
  3. POST /v1/videos → id
  4. GET /v1/videos/{id} → completed → GET /v1/videos/{id}/content
type url consent
Image HTTPS · JPEG / PNG / WebP · ≤ 10 MiB true
Video HTTPS · MP4 / MOV · ≤ 50 MiB true

Use a direct link to the image. You can disable the link once the asset is ready.

export AUTHORIZED_PHOTO_HTTPS_URL='https://media.example.com/portrait.png'
# Optional: export AUTHORIZED_VIDEO_HTTPS_URL='https://media.example.com/motion.mp4'
python -m pip install requests
import os
import time
import requests

base = os.environ["SHANHAI_BASE_URL"].rstrip("/") + "/v1"
model = "doubao-seedance-2-5-260628"
headers = {"Authorization": "Bearer " + os.environ["SHANHAI_API_KEY"]}

# Image: PNG / JPG / WebP, ≤ 10 MiB. Video: MP4 / MOV, ≤ 50 MiB.
def register(kind, https_url):
    r = requests.post(f"{base}/portrait-assets", headers=headers, timeout=30,
                      json={"model": model, "type": kind, "url": https_url, "consent": True})
    r.raise_for_status()
    receipt = r.json()["data"]["id"]
    print("Receipt:", receipt)
    return receipt

def wait_ready(receipt):
    for _ in range(60):
        r = requests.get(f"{base}/portrait-assets/{receipt}", headers=headers,
                         params={"model": model}, timeout=30)
        r.raise_for_status()
        data = r.json()["data"]
        if data["status"] == "Active":
            return data["asset_url"]
        if data["status"] == "Failed":
            raise ValueError("Material processing failed")
        time.sleep(3)
    raise TimeoutError("Call wait_ready again with the saved receipt")

photo = register("Image", os.environ["AUTHORIZED_PHOTO_HTTPS_URL"])
content = [
    {"type": "image_url", "role": "reference_image", "image_url": {"url": wait_ready(photo)}},
]
if clip_url := os.getenv("AUTHORIZED_VIDEO_HTTPS_URL"):
    clip = register("Video", clip_url)
    content.append({"type": "video_url", "role": "reference_video", "video_url": {"url": wait_ready(clip)}})
r = requests.post(f"{base}/videos", headers=headers, timeout=60, json={
    "model": model, "prompt": "The person in the photo looks at the camera and smiles.",
    "seconds": "4", "metadata": {"resolution": "480p", "ratio": "9:16", "content": content},
})
r.raise_for_status()
task_id = r.json()["id"]
print("TASK_ID=" + task_id)

Video task status and downloads

Video Studio

In Video Studio, select a supported Seedance model and choose reference image or reference video. Check the box confirming that you have the person’s consent to register the asset, then upload it. Once processing finishes, enter your prompt and generate the video.

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.