Seedream 4.0 (4k)
Seedream 4.0 generates high-resolution, professional-grade visuals with superior text rendering for impactful design.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/seedream-4"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "size": "2K",
12 "width": 2048,
13 "height": 2048,
14 "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",
15 "max_images": 1,
16 "image_input": [
17 "https://segmind-resources.s3.amazonaws.com/input/ee043397-b857-4bf2-9ad0-70258a286e96-504cf296-f8c3-40af-b200-9b52bdae240c.png"
18 ],
19 "sequential_image_generation": "disabled"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/seedream-4"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "size": "2K",
12 "width": 2048,
13 "height": 2048,
14 "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",
15 "max_images": 1,
16 "image_input": [
17 "https://segmind-resources.s3.amazonaws.com/input/ee043397-b857-4bf2-9ad0-70258a286e96-504cf296-f8c3-40af-b200-9b52bdae240c.png"
18 ],
19 "sequential_image_generation": "disabled"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)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_ratiooptionalstringDetermines image proportions. Select '16:9' for widescreen, '1:1' for square format.
null"1:1""4:3""3:4""16:9""9:16""3:2""2:3""21:9"heightoptionalintegerDefines height when size is 'custom'. Set 1024 for small images, 4096 for large posters.
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"sizeoptionalstringSpecifies image resolution. Use '2K' for standard images, '4K' for high-res, 'custom' for unique needs.
"2K""1K""2K""4K""custom"widthoptionalintegerDefines width when size is 'custom'. Use 1024 for thumbnails, 4096 for detailed art.
2048Range: 1024 - 4096Response Type
Returns: Image
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