Seedream 4.5 Serverless API
Photorealistic image generation with precise text understanding.
POST /v2/seedream-4.5 · 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-4.5",
9 size="2K",
10 width=2048,
11 height=2048,
12 prompt="Create a professional H&M clothing brand photoshoot of the man wearing all the reference clothes, striking confident model poses against an urban city street background with skyscrapers and vibrant daylight.",
13 max_images=1,
14 image_input=["https://segmind-inference-inputs.s3.amazonaws.com/273f368e-3274-4a6e-8a2c-2cdd5881948e-d61283c9-839e-4107-9185-4ea883ecaded.webp", "https://segmind-inference-inputs.s3.amazonaws.com/d47c85b4-f584-45e7-97ea-2ae0eeae4880-548c2fcfa1e14e301329ef45b8e093af.jpg", "https://segmind-inference-inputs.s3.amazonaws.com/d4545759-47ba-4c92-afa3-49fb260e8c51-IMG_7135.webp", "https://segmind-inference-inputs.s3.amazonaws.com/2d803ba1-7c89-4d54-996f-11c9572d8db9-IMG_7137.webp", "https://segmind-inference-inputs.s3.amazonaws.com/a461a78b-6db9-443a-8882-69ed7ccc2390-IMG_7138.webp"],
15 aspect_ratio="match_input_image",
16 sequential_image_generation="disabled",
17)
18print(result["status"]) # COMPLETED
19print(result.get("output")) # model output (e.g. media URL)
20print(result["metrics"]["inference_time"]) # server compute seconds
21
22# --- Or submit + poll manually (track request_id, control the cadence) ---
23from segmind import SegmindClient, InferenceFailed, InferenceTimeout
24
25client = SegmindClient() # reads SEGMIND_API_KEY
26payload = {
27 "size": "2K",
28 "width": 2048,
29 "height": 2048,
30 "prompt": "Create a professional H&M clothing brand photoshoot of the man wearing all the reference clothes, striking confident model poses against an urban city street background with skyscrapers and vibrant daylight.",
31 "max_images": 1,
32 "image_input": ["https://segmind-inference-inputs.s3.amazonaws.com/273f368e-3274-4a6e-8a2c-2cdd5881948e-d61283c9-839e-4107-9185-4ea883ecaded.webp", "https://segmind-inference-inputs.s3.amazonaws.com/d47c85b4-f584-45e7-97ea-2ae0eeae4880-548c2fcfa1e14e301329ef45b8e093af.jpg", "https://segmind-inference-inputs.s3.amazonaws.com/d4545759-47ba-4c92-afa3-49fb260e8c51-IMG_7135.webp", "https://segmind-inference-inputs.s3.amazonaws.com/2d803ba1-7c89-4d54-996f-11c9572d8db9-IMG_7137.webp", "https://segmind-inference-inputs.s3.amazonaws.com/a461a78b-6db9-443a-8882-69ed7ccc2390-IMG_7138.webp"],
33 "aspect_ratio": "match_input_image",
34 "sequential_image_generation": "disabled",
35}
36job = client.submit_async("seedream-4.5", **payload)
37print(job.request_id) # available immediately
38try:
39 result = job.wait(timeout=600, interval=1.0)
40except InferenceTimeout as e:
41 print("still running:", e.request_id)
42except InferenceFailed as e:
43 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-4.5",
9 size="2K",
10 width=2048,
11 height=2048,
12 prompt="Create a professional H&M clothing brand photoshoot of the man wearing all the reference clothes, striking confident model poses against an urban city street background with skyscrapers and vibrant daylight.",
13 max_images=1,
14 image_input=["https://segmind-inference-inputs.s3.amazonaws.com/273f368e-3274-4a6e-8a2c-2cdd5881948e-d61283c9-839e-4107-9185-4ea883ecaded.webp", "https://segmind-inference-inputs.s3.amazonaws.com/d47c85b4-f584-45e7-97ea-2ae0eeae4880-548c2fcfa1e14e301329ef45b8e093af.jpg", "https://segmind-inference-inputs.s3.amazonaws.com/d4545759-47ba-4c92-afa3-49fb260e8c51-IMG_7135.webp", "https://segmind-inference-inputs.s3.amazonaws.com/2d803ba1-7c89-4d54-996f-11c9572d8db9-IMG_7137.webp", "https://segmind-inference-inputs.s3.amazonaws.com/a461a78b-6db9-443a-8882-69ed7ccc2390-IMG_7138.webp"],
15 aspect_ratio="match_input_image",
16 sequential_image_generation="disabled",
17)
18print(result["status"]) # COMPLETED
19print(result.get("output")) # model output (e.g. media URL)
20print(result["metrics"]["inference_time"]) # server compute seconds
21
22# --- Or submit + poll manually (track request_id, control the cadence) ---
23from segmind import SegmindClient, InferenceFailed, InferenceTimeout
24
25client = SegmindClient() # reads SEGMIND_API_KEY
26payload = {
27 "size": "2K",
28 "width": 2048,
29 "height": 2048,
30 "prompt": "Create a professional H&M clothing brand photoshoot of the man wearing all the reference clothes, striking confident model poses against an urban city street background with skyscrapers and vibrant daylight.",
31 "max_images": 1,
32 "image_input": ["https://segmind-inference-inputs.s3.amazonaws.com/273f368e-3274-4a6e-8a2c-2cdd5881948e-d61283c9-839e-4107-9185-4ea883ecaded.webp", "https://segmind-inference-inputs.s3.amazonaws.com/d47c85b4-f584-45e7-97ea-2ae0eeae4880-548c2fcfa1e14e301329ef45b8e093af.jpg", "https://segmind-inference-inputs.s3.amazonaws.com/d4545759-47ba-4c92-afa3-49fb260e8c51-IMG_7135.webp", "https://segmind-inference-inputs.s3.amazonaws.com/2d803ba1-7c89-4d54-996f-11c9572d8db9-IMG_7137.webp", "https://segmind-inference-inputs.s3.amazonaws.com/a461a78b-6db9-443a-8882-69ed7ccc2390-IMG_7138.webp"],
33 "aspect_ratio": "match_input_image",
34 "sequential_image_generation": "disabled",
35}
36job = client.submit_async("seedream-4.5", **payload)
37print(job.request_id) # available immediately
38try:
39 result = job.wait(timeout=600, interval=1.0)
40except InferenceTimeout as e:
41 print("still running:", e.request_id)
42except InferenceFailed as e:
43 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/seedream-4.5Parameters
promptrequiredstringDescribe the image. Include subjects like 'serene evening at the beach'.
aspect_ratiooptionalstringImage proportions. 'match_input_image' (recommended with image_input) lets API match input aspect ratio and optimize quality. Other ratios (1:1, 16:9, 9:16, etc.) calculate dimensions from size preset. Note: Non-square ratios with 4K may produce lower pixel counts than maximum (e.g., 9:16 gives ~9M pixels vs 16.7M max). Ignored when size is set to custom and both height and width are provided
"match_input_image""match_input_image""1:1""4:3""3:4""16:9""9:16""3:2""2:3""21:9"heightoptionalintegerCustom height in pixels (only when size='custom'). Range: 1024-4096. Total pixels (width × height) must be 3.7M-16.7M. Dimensions rounded to 64-pixel increments. Images below 3.7M pixels will be auto-scaled up.
2048Range: 1024 - 4096image_inputoptionalstring[]Input images to guide creation, use 1-3 URLs for reference.
max_imagesoptionalintegerLimit generated images: 1 for single output, 5 for more variety.
1Range: 1 - 15sequential_image_generationoptionalstringChoose sequence: 'auto' for batch, 'disabled' for individual images.
"disabled""disabled""auto"sizeoptionalstringImage resolution quality level. '2K' for standard (8-9M pixels), '4K' for high-res (up to 16.7M pixels). When used alone, API optimizes dimensions. When combined with aspect_ratio, dimensions are calculated but may not reach full 4K quality for extreme ratios (e.g., 9:16). Use 'custom' for exact control.
"2K""1K""2K""4K""custom"widthoptionalintegerCustom width in pixels (only when size='custom'). Range: 1024-4096. Total pixels (width × height) must be 3.7M-16.7M. Dimensions rounded to 64-pixel increments. For maximum 4K quality with aspect ratios, calculate dimensions manually.
2048Range: 1024 - 4096Response 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-4.5Submit — 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