Seedream 4.0 (4k) Serverless API
Seedream 4.0 generates high-resolution, professional-grade visuals with superior text rendering for impactful design.
POST /v2/seedream-4 · 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",
9 size="2K",
10 width=2048,
11 height=2048,
12 prompt="Action hero into an apocalypse survivor zombie hunter, torn leather jacket with spikes, glowing red cybernetic eye, dual chainsaw weapons, burning city ruins background, blood splatter effects, horror movie aesthetic, badass energy, ultra-detailed gore",
13 max_images=1,
14 image_input=["https://segmind-resources.s3.amazonaws.com/input/ee043397-b857-4bf2-9ad0-70258a286e96-504cf296-f8c3-40af-b200-9b52bdae240c.png"],
15 sequential_image_generation="disabled",
16)
17print(result["status"]) # COMPLETED
18print(result.get("output")) # model output (e.g. media URL)
19print(result["metrics"]["inference_time"]) # server compute seconds
20
21# --- Or submit + poll manually (track request_id, control the cadence) ---
22from segmind import SegmindClient, InferenceFailed, InferenceTimeout
23
24client = SegmindClient() # reads SEGMIND_API_KEY
25payload = {
26 "size": "2K",
27 "width": 2048,
28 "height": 2048,
29 "prompt": "Action hero into an apocalypse survivor zombie hunter, torn leather jacket with spikes, glowing red cybernetic eye, dual chainsaw weapons, burning city ruins background, blood splatter effects, horror movie aesthetic, badass energy, ultra-detailed gore",
30 "max_images": 1,
31 "image_input": ["https://segmind-resources.s3.amazonaws.com/input/ee043397-b857-4bf2-9ad0-70258a286e96-504cf296-f8c3-40af-b200-9b52bdae240c.png"],
32 "sequential_image_generation": "disabled",
33}
34job = client.submit_async("seedream-4", **payload)
35print(job.request_id) # available immediately
36try:
37 result = job.wait(timeout=600, interval=1.0)
38except InferenceTimeout as e:
39 print("still running:", e.request_id)
40except InferenceFailed as e:
41 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",
9 size="2K",
10 width=2048,
11 height=2048,
12 prompt="Action hero into an apocalypse survivor zombie hunter, torn leather jacket with spikes, glowing red cybernetic eye, dual chainsaw weapons, burning city ruins background, blood splatter effects, horror movie aesthetic, badass energy, ultra-detailed gore",
13 max_images=1,
14 image_input=["https://segmind-resources.s3.amazonaws.com/input/ee043397-b857-4bf2-9ad0-70258a286e96-504cf296-f8c3-40af-b200-9b52bdae240c.png"],
15 sequential_image_generation="disabled",
16)
17print(result["status"]) # COMPLETED
18print(result.get("output")) # model output (e.g. media URL)
19print(result["metrics"]["inference_time"]) # server compute seconds
20
21# --- Or submit + poll manually (track request_id, control the cadence) ---
22from segmind import SegmindClient, InferenceFailed, InferenceTimeout
23
24client = SegmindClient() # reads SEGMIND_API_KEY
25payload = {
26 "size": "2K",
27 "width": 2048,
28 "height": 2048,
29 "prompt": "Action hero into an apocalypse survivor zombie hunter, torn leather jacket with spikes, glowing red cybernetic eye, dual chainsaw weapons, burning city ruins background, blood splatter effects, horror movie aesthetic, badass energy, ultra-detailed gore",
30 "max_images": 1,
31 "image_input": ["https://segmind-resources.s3.amazonaws.com/input/ee043397-b857-4bf2-9ad0-70258a286e96-504cf296-f8c3-40af-b200-9b52bdae240c.png"],
32 "sequential_image_generation": "disabled",
33}
34job = client.submit_async("seedream-4", **payload)
35print(job.request_id) # available immediately
36try:
37 result = job.wait(timeout=600, interval=1.0)
38except InferenceTimeout as e:
39 print("still running:", e.request_id)
40except InferenceFailed as e:
41 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/seedream-4Parameters
promptrequiredstringText describing the image to generate. Include subjects like 'sunset mountain view'.
"Action hero into an apocalypse survivor zombie hunter, torn leather jacket with spikes, glowing red cybernetic eye, dual chainsaw weapons, burning city ruins background, blood splatter effects, horror movie aesthetic, badass energy, ultra-detailed gore"aspect_ratiooptionalstringImage proportions. When combined with size preset, one dimension is fixed (1K=1024, 2K=2048, 4K=4096). For best quality with non-square ratios, consider using 'custom' size with manual dimensions. Options: '1:1' square, '16:9' widescreen, '9:16' portrait, etc.
null"1:1""4:3""3:4""16:9""9:16""3:2""2:3""21:9"heightoptionalintegerCustom height in pixels (only used when size='custom'). Range: 1024-4096. Both width and height must be set for custom sizing. Dimensions will be validated and rounded to nearest 64 pixels.
2048Range: 1024 - 4096image_inputoptionalstring[]List of image URLs to guide generation. Use for reference; add 1-3 URLs.
max_imagesoptionalintegerSets image generation limit. Choose 1 for single outcome, 5 for multiple.
1Range: 1 - 15sequential_image_generationoptionalstringControls image creation order. Enable 'auto' for batch generation, 'disabled' otherwise.
"disabled""disabled""auto"sizeoptionalstringImage resolution preset. '1K/2K/4K' sets one dimension (1024/2048/4096), other dimension calculated from aspect_ratio. Use 'custom' to specify exact width/height. Note: Combining with aspect_ratio may not maximize quality for all ratios.
"2K""1K""2K""4K""custom"widthoptionalintegerCustom width in pixels (only used when size='custom'). Range: 1024-4096. Both width and height must be set for custom sizing. Dimensions will be validated and rounded to nearest 64 pixels.
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-4Submit — 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