Skip to main content

One-Click Test

Copy the script below, paste your API key, and run it. The script will create a task, poll until completion, and print the video URL.
import requests, time, sys

API_KEY = "YOUR_API_KEY"  # ← paste your API key here
BASE_URL = "https://seedance2-pro.com/api/v1"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# 1. Create task
print("Creating task...")
resp = requests.post(f"{BASE_URL}/jobs/createTask", headers=headers, json={
    "model": "seedance-20",
    "inputs": {
        "prompt": "A golden retriever running on a beach at sunset, waves crashing in the background, cinematic slow motion",
        "resolution": "1280x720",
        "duration": "5s"
    }
})

data = resp.json()
if not resp.ok:
    print(f"Error: {data['message']}")
    if resp.status_code == 402:
        print(f"  Need {data['required']} credits, you have {data['available']}")
    sys.exit(1)

task_id = data["taskId"]
print(f"Task created: {task_id}")

# 2. Poll for completion
print("Generating video", end="", flush=True)
start = time.time()

while time.time() - start < 300:
    resp = requests.get(f"{BASE_URL}/jobs/recordInfo?taskId={task_id}", headers=headers)
    result = resp.json()

    if result["status"] == "success":
        elapsed = int(time.time() - start)
        print(f"\n\nDone in {elapsed}s!")
        print(f"Video URL: {result['output'][0]['url']}")
        print(f"Resolution: {result['output'][0]['width']}x{result['output'][0]['height']}")
        sys.exit(0)

    if result["status"] == "fail":
        print(f"\n\nFailed: {result['error']}")
        sys.exit(1)

    print(".", end="", flush=True)
    time.sleep(5)

print("\n\nTimeout after 300s. Task may still be processing.")
print(f"Check manually: GET {BASE_URL}/jobs/recordInfo?taskId={task_id}")
Run
pip install requests
python demo.py

What This Demo Does

StepAPI CallCost
Create taskPOST /jobs/createTask200 credits (5s video)
Poll statusGET /jobs/recordInfoFree
Download videoDirect URLFree
5-second video at 1280x720 costs 200 credits. Generation typically finishes in 1-5 minutes.

Try Different Parameters

Replace resolution value:
  • 1280x720 — Landscape 16:9
  • 720x1280 — Portrait 9:16
  • 720x720 — Square 1:1
  • 960x720 — Landscape 4:3
  • 720x960 — Portrait 3:4
Replace duration value: 4s to 15s. Credits scale linearly (40 credits/sec).
Add urls to inputs (1-2 images):
{
  "model": "seedance-20",
  "inputs": {
    "urls": [
      "https://example.com/first-frame.jpg",
      "https://example.com/last-frame.jpg"
    ],
    "prompt": "Smooth transition between the two scenes",
    "resolution": "1280x720",
    "duration": "5s"
  }
}

Next Steps