Seedream 4.5 Serverless API
Seedream 4.5 delivers photorealistic image generation with unmatched accuracy and creative control for professional applications.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/seedream-4.5"
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": "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.",
15 "max_images": 1,
16 "image_input": [
17 "https://segmind-inference-inputs.s3.amazonaws.com/273f368e-3274-4a6e-8a2c-2cdd5881948e-d61283c9-839e-4107-9185-4ea883ecaded.webp",
18 "https://segmind-inference-inputs.s3.amazonaws.com/d47c85b4-f584-45e7-97ea-2ae0eeae4880-548c2fcfa1e14e301329ef45b8e093af.jpg",
19 "https://segmind-inference-inputs.s3.amazonaws.com/d4545759-47ba-4c92-afa3-49fb260e8c51-IMG_7135.webp",
20 "https://segmind-inference-inputs.s3.amazonaws.com/2d803ba1-7c89-4d54-996f-11c9572d8db9-IMG_7137.webp",
21 "https://segmind-inference-inputs.s3.amazonaws.com/a461a78b-6db9-443a-8882-69ed7ccc2390-IMG_7138.webp"
22 ],
23 "aspect_ratio": "match_input_image",
24 "sequential_image_generation": "disabled"
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/seedream-4.5"
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": "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.",
15 "max_images": 1,
16 "image_input": [
17 "https://segmind-inference-inputs.s3.amazonaws.com/273f368e-3274-4a6e-8a2c-2cdd5881948e-d61283c9-839e-4107-9185-4ea883ecaded.webp",
18 "https://segmind-inference-inputs.s3.amazonaws.com/d47c85b4-f584-45e7-97ea-2ae0eeae4880-548c2fcfa1e14e301329ef45b8e093af.jpg",
19 "https://segmind-inference-inputs.s3.amazonaws.com/d4545759-47ba-4c92-afa3-49fb260e8c51-IMG_7135.webp",
20 "https://segmind-inference-inputs.s3.amazonaws.com/2d803ba1-7c89-4d54-996f-11c9572d8db9-IMG_7137.webp",
21 "https://segmind-inference-inputs.s3.amazonaws.com/a461a78b-6db9-443a-8882-69ed7ccc2390-IMG_7138.webp"
22 ],
23 "aspect_ratio": "match_input_image",
24 "sequential_image_generation": "disabled"
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text)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).
"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
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