UGC Tutorial Video Creation with Seedance 2.0 Serverless API

Create captivating UGC video tutorials effortlessly with Seedance 2.0 and Claude 4.5.

 1import requests
 2import time
 3import json
 4
 5api_key = "YOUR_API_KEY"
 6url = "https://api.segmind.com/workflows/v2/6a212a5325d09e2ed3925e18-v1"
 7
 8data = {
 9    "model_input_image": "https://segmind-inference-inputs.s3.amazonaws.com/3aeeaa02-0a44-4a69-a0bc-6795d076fce9-81386-output.jpg",
10    "product_input_image": "https://segmind-inference-inputs.s3.amazonaws.com/386ecc78-442c-4b00-ae81-992420996383-ae990-output.jpg",
11    "input_prompt": "MindRelax – Smart Head Massager\nExperience professional-grade relaxation at home with the MindRelax Smart Head Massager. Designed for modern stress relief, it combines intelligent technology with a premium build to deliver a deeply soothing massage whenever you need it most.\nKey Features:\nDeep Kneading Nodes — Multi-finger massage nodes replicate the feel of real hands, targeting the scalp, neck, and temples for thorough tension relief.\nMultiple Modes & Intensity Levels — Switch between massage modes and adjust intensity using the dedicated Power, Mode, and Intensity buttons to personalise every session.\nOLED Smart Display — A crisp built-in screen shows your battery level, active massage mode, and Bluetooth status in real time, so you're always in control.\nBluetooth Connectivity — Pair wirelessly with your smartphone to access personalised massage programs and settings right from your phone.\nLong-Lasting Battery — A built-in rechargeable battery keeps you going through multiple sessions, with live charge percentage always visible on the display.\nPremium Ergonomic Design — Lightweight and comfortable to hold, the MindRelax features a soft-touch white shell with brushed silver accents — built for both performance and style.\nIdeal for stress relief, scalp care, relaxation before sleep, or unwinding after a long day. The MindRelax brings the spa experience to your fingertips."
12}
13
14def poll_for_result(poll_url):
15    """Poll the API until the generation is complete"""
16    while True:
17        response = requests.get(
18            poll_url,
19            headers={'Authorization': f'Bearer {api_key}'}
20        )
21        result = response.json()
22
23        if result['status'] == 'COMPLETED':
24            # Parse the output (it's a JSON string)
25            outputs = json.loads(result['output'])
26            return outputs
27        elif result['status'] == 'FAILED':
28            raise Exception(result.get('error', 'Generation failed'))
29
30        # Wait 7 seconds before polling again
31        time.sleep(7)
32
33# Make the initial request
34response = requests.post(
35    url,
36    json=data,
37    headers={
38        'Authorization': f'Bearer {api_key}',
39        'Content-Type': 'application/json'
40    }
41)
42
43if response.status_code == 200:
44    result = response.json()
45    print('Request queued:', result)
46
47    # Start polling for results
48    outputs = poll_for_result(result['poll_url'])
49    print('Generation complete:', outputs)
50else:
51    print(f"Error: {response.status_code}")
52    print(response.text)

API Endpoint

POSThttps://api.segmind.com/workflows/v2/6a212a5325d09e2ed3925e18-v1

Parameters

model_input_imageoptional
string (uri)

Model Input Image

Default: "https://segmind-inference-inputs.s3.amazonaws.com/3aeeaa02-0a44-4a69-a0bc-6795d076fce9-81386-output.jpg"
product_input_imageoptional
string (uri)

Product Input Image

Default: "https://segmind-inference-inputs.s3.amazonaws.com/386ecc78-442c-4b00-ae81-992420996383-ae990-output.jpg"
input_promptoptional
string

Input Prompt

Default: "MindRelax – Smart Head Massager\nExperience professional-grade relaxation at home with the MindRelax Smart Head Massager. Designed for modern stress relief, it combines intelligent technology with a premium build to deliver a deeply soothing massage whenever you need it most.\nKey Features:\nDeep Kneading Nodes — Multi-finger massage nodes replicate the feel of real hands, targeting the scalp, neck, and temples for thorough tension relief.\nMultiple Modes & Intensity Levels — Switch between massage modes and adjust intensity using the dedicated Power, Mode, and Intensity buttons to personalise every session.\nOLED Smart Display — A crisp built-in screen shows your battery level, active massage mode, and Bluetooth status in real time, so you're always in control.\nBluetooth Connectivity — Pair wirelessly with your smartphone to access personalised massage programs and settings right from your phone.\nLong-Lasting Battery — A built-in rechargeable battery keeps you going through multiple sessions, with live charge percentage always visible on the display.\nPremium Ergonomic Design — Lightweight and comfortable to hold, the MindRelax features a soft-touch white shell with brushed silver accents — built for both performance and style.\nIdeal for stress relief, scalp care, relaxation before sleep, or unwinding after a long day. The MindRelax brings the spa experience to your fingertips."

Response Format

Returns: Polling-based asynchronous response

Initial request returns a poll_url. Poll every 7 seconds until status is COMPLETED.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Workflow not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out