Relighting Serverless API
Prompts to auto-magically relight your images.
POST /v2/ic-light · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "ic-light",
9 cfg=2,
10 seed=42,
11 steps=25,
12 width=512,
13 height=640,
14 prompt="cat, photoshoot, 4k",
15 highres_scale=1.5,
16 output_format="webp",
17 subject_image="https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg",
18 lowres_denoise=0.9,
19 output_quality=80,
20 appended_prompt="best quality",
21 highres_denoise=0.5,
22 negative_prompt="lowres, bad anatomy, bad hands, cropped, worst quality",
23 number_of_images=1,
24)
25print(result["status"]) # COMPLETED
26print(result.get("output")) # model output (e.g. media URL)
27print(result["metrics"]["inference_time"]) # server compute seconds
28
29# --- Or submit + poll manually (track request_id, control the cadence) ---
30from segmind import SegmindClient, InferenceFailed, InferenceTimeout
31
32client = SegmindClient() # reads SEGMIND_API_KEY
33payload = {
34 "cfg": 2,
35 "seed": 42,
36 "steps": 25,
37 "width": 512,
38 "height": 640,
39 "prompt": "cat, photoshoot, 4k",
40 "highres_scale": 1.5,
41 "output_format": "webp",
42 "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg",
43 "lowres_denoise": 0.9,
44 "output_quality": 80,
45 "appended_prompt": "best quality",
46 "highres_denoise": 0.5,
47 "negative_prompt": "lowres, bad anatomy, bad hands, cropped, worst quality",
48 "number_of_images": 1,
49}
50job = client.submit_async("ic-light", **payload)
51print(job.request_id) # available immediately
52try:
53 result = job.wait(timeout=600, interval=1.0)
54except InferenceTimeout as e:
55 print("still running:", e.request_id)
56except InferenceFailed as e:
57 print("failed:", e.detail) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "ic-light",
9 cfg=2,
10 seed=42,
11 steps=25,
12 width=512,
13 height=640,
14 prompt="cat, photoshoot, 4k",
15 highres_scale=1.5,
16 output_format="webp",
17 subject_image="https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg",
18 lowres_denoise=0.9,
19 output_quality=80,
20 appended_prompt="best quality",
21 highres_denoise=0.5,
22 negative_prompt="lowres, bad anatomy, bad hands, cropped, worst quality",
23 number_of_images=1,
24)
25print(result["status"]) # COMPLETED
26print(result.get("output")) # model output (e.g. media URL)
27print(result["metrics"]["inference_time"]) # server compute seconds
28
29# --- Or submit + poll manually (track request_id, control the cadence) ---
30from segmind import SegmindClient, InferenceFailed, InferenceTimeout
31
32client = SegmindClient() # reads SEGMIND_API_KEY
33payload = {
34 "cfg": 2,
35 "seed": 42,
36 "steps": 25,
37 "width": 512,
38 "height": 640,
39 "prompt": "cat, photoshoot, 4k",
40 "highres_scale": 1.5,
41 "output_format": "webp",
42 "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg",
43 "lowres_denoise": 0.9,
44 "output_quality": 80,
45 "appended_prompt": "best quality",
46 "highres_denoise": 0.5,
47 "negative_prompt": "lowres, bad anatomy, bad hands, cropped, worst quality",
48 "number_of_images": 1,
49}
50job = client.submit_async("ic-light", **payload)
51print(job.request_id) # available immediately
52try:
53 result = job.wait(timeout=600, interval=1.0)
54except InferenceTimeout as e:
55 print("still running:", e.request_id)
56except InferenceFailed as e:
57 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/ic-lightParameters
promptrequiredstringA text description guiding the relighting and generation process
"cat, photoshoot, 4k"subject_imagerequiredstring (uri)The main foreground image to be relighted
"https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg"appended_promptoptionalstringAdditional text to be appended to the main prompt, enhancing image quality
"best quality"cfgoptionalnumberClassifier-Free Guidance scale - higher values encourage adherence to prompt, lower values encourage more creative interpretation
2Range: 1 - 32heightoptionalintegerAn enumeration.
640256320384448512576640704768832+3 morehighres_denoiseoptionalnumberControls the amount of denoising applied when refining the high resolution output (higher = more adherence to the upscaled latent, lower = more creative details added)
0.5Range: 0.1 - 1highres_scaleoptionalnumberThe multiplier for the final output resolution relative to the initial latent resolution
1.5Range: 1 - 3light_sourceoptionalstringAn enumeration.
"None""Left Light""Right Light""Top Light""Bottom Light"lowres_denoiseoptionalnumberControls the amount of denoising applied when generating the initial latent from the background image (higher = more adherence to the background, lower = more creative interpretation)
0.9Range: 0.1 - 1negative_promptoptionalstringA text description of attributes to avoid in the generated images
"lowres, bad anatomy, bad hands, cropped, worst quality"number_of_imagesoptionalintegerThe number of unique images to generate from the given input and settings
1Range: 1 - 12output_formatoptionalstringAn enumeration.
"webp""webp""jpg""png"output_qualityoptionalintegerThe image compression quality (for lossy formats like JPEG and WebP). 100 = best quality, 0 = lowest quality.
80Range: 0 - 100seedoptionalintegerA fixed random seed for reproducible results (omit this parameter for a randomized seed)
42stepsoptionalintegerThe number of diffusion steps to perform during generation (more steps generally improves image quality but increases processing time)
25Range: 1 - 100widthoptionalintegerAn enumeration.
512256320384448512576640704768832+3 moreResponse Type
Returns: Image
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/ic-lightSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out