Seedream 5.0 Pro Layer Decomposition Serverless API
Split any image into editable transparent PNG layers.
POST /v2/seedream-5-pro-layer-decomposition · 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 "seedream-5-pro-layer-decomposition",
9 image="https://segmind-resources.s3.amazonaws.com/input/seedream-5-pro-layer-decomposition-input.jpeg",
10 prompt="Separate three layers: the orange coffee mug, the green potted succulent, and the stack of books.",
11 size="2K",
12 output_format="png",
13 optimize_prompt_mode="standard",
14 watermark=False,
15)
16print(result["status"]) # COMPLETED
17print(result.get("output")) # model output (e.g. media URL)
18print(result["metrics"]["inference_time"]) # server compute seconds
19
20# --- Or submit + poll manually (track request_id, control the cadence) ---
21from segmind import SegmindClient, InferenceFailed, InferenceTimeout
22
23client = SegmindClient() # reads SEGMIND_API_KEY
24payload = {
25 "image": "https://segmind-resources.s3.amazonaws.com/input/seedream-5-pro-layer-decomposition-input.jpeg",
26 "prompt": "Separate three layers: the orange coffee mug, the green potted succulent, and the stack of books.",
27 "size": "2K",
28 "output_format": "png",
29 "optimize_prompt_mode": "standard",
30 "watermark": False,
31}
32job = client.submit_async("seedream-5-pro-layer-decomposition", **payload)
33print(job.request_id) # available immediately
34try:
35 result = job.wait(timeout=600, interval=1.0)
36except InferenceTimeout as e:
37 print("still running:", e.request_id)
38except InferenceFailed as e:
39 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 "seedream-5-pro-layer-decomposition",
9 image="https://segmind-resources.s3.amazonaws.com/input/seedream-5-pro-layer-decomposition-input.jpeg",
10 prompt="Separate three layers: the orange coffee mug, the green potted succulent, and the stack of books.",
11 size="2K",
12 output_format="png",
13 optimize_prompt_mode="standard",
14 watermark=False,
15)
16print(result["status"]) # COMPLETED
17print(result.get("output")) # model output (e.g. media URL)
18print(result["metrics"]["inference_time"]) # server compute seconds
19
20# --- Or submit + poll manually (track request_id, control the cadence) ---
21from segmind import SegmindClient, InferenceFailed, InferenceTimeout
22
23client = SegmindClient() # reads SEGMIND_API_KEY
24payload = {
25 "image": "https://segmind-resources.s3.amazonaws.com/input/seedream-5-pro-layer-decomposition-input.jpeg",
26 "prompt": "Separate three layers: the orange coffee mug, the green potted succulent, and the stack of books.",
27 "size": "2K",
28 "output_format": "png",
29 "optimize_prompt_mode": "standard",
30 "watermark": False,
31}
32job = client.submit_async("seedream-5-pro-layer-decomposition", **payload)
33print(job.request_id) # available immediately
34try:
35 result = job.wait(timeout=600, interval=1.0)
36except InferenceTimeout as e:
37 print("still running:", e.request_id)
38except InferenceFailed as e:
39 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/seedream-5-pro-layer-decompositionParameters
imagerequiredstring (uri)The image to decompose. Exactly one image — png, jpeg, bmp, tiff or gif, up to 30 MB, between 512x512 and 6000x6000 pixels. Mark the elements you want separated: box one to name it and send its coordinates in the prompt, or point, circle and scribble to mark it on the picture alone.
optimize_prompt_modeoptionalstringstandard gives higher quality separation and takes longer; fast trades some quality for speed.
"standard""standard""fast"output_formatoptionalstringFile format of the base image. Every element layer is always PNG with a transparent channel, whatever this is set to.
"png""png""jpeg"promptoptionalstringOptional. List the elements to separate, one by one, naming each by its object and a distinguishing feature (colour, position). Leave empty and the model detects every major element itself. Each element you name becomes a billed layer, so listing them keeps the cost predictable. Boxing an element on the image adds its name and coordinates here as a <bbox> tag; the canvas rewrites those whenever the boxes change, so edit your own wording freely and leave the tags to it.
sizeoptionalstringResolution of the output base image and layers. auto follows the input image's own size; 1K, 1.5K and 2K pin it. Larger outputs cost more per image.
"auto""auto""1K""1.5K""2K"watermarkoptionalbooleanAdds a visible watermark to the output. Keep off for production assets.
falseResponse 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/seedream-5-pro-layer-decompositionSubmit — 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