Segmind Soliton Serverless API

Film your actor on a plain wall and get the finished scene: a new set and costume with their real face, every expression, blink and finger movement kept.

~9m 25s
~$3.3896
 1import requests
 2import time
 3import json
 4
 5api_key = "YOUR_API_KEY"
 6url = "https://api.segmind.com/workflows/v2/6afdf1b48dfdddbd877eb285-v1"
 7
 8data = {
 9    "take": "https://images.segmind.com/public/32e9f970236ead7f3a0e60d6553a6de7.mp4",
10    "actor_photo": "https://images.segmind.com/public/69bc45ea6fdf903609dfcb9bc10c7054.jpeg",
11    "scene_image": "https://images.segmind.com/public/ba0170c0050c9f6c0f2d870fc55531eb.jpeg",
12    "costume_photo": "https://images.segmind.com/public/f4affd1fe09e1b770092b72d065e283b.jpeg",
13    "scene_notes": "Night, light monsoon rain. She stands by the glass railing, lit by the warm light from the open door on her left, with the city lights soft behind her.",
14    "resolution": "1080p",
15    "delivery": "H.264 mp4 (plays everywhere)"
16}
17
18def poll_for_result(poll_url):
19    """Poll the API until the generation is complete"""
20    while True:
21        response = requests.get(
22            poll_url,
23            headers={'x-api-key': api_key}
24        )
25        result = response.json()
26
27        if result['status'] == 'COMPLETED':
28            # Parse the output (it's a JSON string)
29            outputs = json.loads(result['output'])
30            return outputs
31        elif result['status'] == 'FAILED':
32            raise Exception(result.get('error', 'Generation failed'))
33
34        # Wait 7 seconds before polling again
35        time.sleep(7)
36
37# Make the initial request
38response = requests.post(
39    url,
40    json=data,
41    headers={
42        'x-api-key': api_key,
43        'Content-Type': 'application/json'
44    }
45)
46
47if response.status_code == 200:
48    result = response.json()
49    print('Request queued:', result)
50
51    # Start polling for results
52    outputs = poll_for_result(result['poll_url'])
53    print('Generation complete:', outputs)
54else:
55    print(f"Error: {response.status_code}")
56    print(response.text)

API Endpoint

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

Parameters

takeoptional
string (uri)

Take

Default: "https://images.segmind.com/public/32e9f970236ead7f3a0e60d6553a6de7.mp4"
actor_photooptional
string (uri)

Actor Photo

Default: "https://images.segmind.com/public/69bc45ea6fdf903609dfcb9bc10c7054.jpeg"
scene_imageoptional
string (uri)

Scene Image

Default: "https://images.segmind.com/public/ba0170c0050c9f6c0f2d870fc55531eb.jpeg"
costume_photooptional
string (uri)

Costume Photo

Default: "https://images.segmind.com/public/f4affd1fe09e1b770092b72d065e283b.jpeg"
scene_notesoptional
string

Scene Notes

Default: "Night, light monsoon rain. She stands by the glass railing, lit by the warm light from the open door on her left, with the city lights soft behind her."
resolutionoptional
string

Resolution

Default: "1080p"
deliveryoptional
string

Delivery

Default: "H.264 mp4 (plays everywhere)"

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