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)

API Endpoint

POSThttps://api.segmind.com/v1/seedream-5-pro-layer-decomposition

Parameters

imagerequired
string (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_modeoptional
string

standard gives higher quality separation and takes longer; fast trades some quality for speed.

Default: "standard"
Allowed values :
Standard"standard"
Fast"fast"
output_formatoptional
string

File format of the base image. Every element layer is always PNG with a transparent channel, whatever this is set to.

Default: "png"
Allowed values :
"png""jpeg"
promptoptional
string

Optional. 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.

sizeoptional
string

Resolution 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.

Default: "auto"
Allowed values :
Auto (match input)"auto"
"1K""1.5K""2K"
watermarkoptional
boolean

Adds a visible watermark to the output. Keep off for production assets.

Default: false

Response 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. 1
    POST /v2/seedream-5-pro-layer-decomposition

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • 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.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint 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