Seedream 4.5 Serverless API

Seedream 4.5 delivers photorealistic image generation with unmatched accuracy and creative control for professional applications.

~32.23s
$0.04 per generation
 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

POSThttps://api.segmind.com/v1/seedream-4.5

Parameters

promptrequired
string

Describe the image. Include subjects like 'serene evening at the beach'.

aspect_ratiooptional
string

Image 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).

Default: "match_input_image"
Allowed values :
"match_input_image""1:1""4:3""3:4""16:9""9:16""3:2""2:3""21:9"
heightoptional
integer

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

Default: 2048Range: 1024 - 4096
image_inputoptional
string[]

Input images to guide creation, use 1-3 URLs for reference.

max_imagesoptional
integer

Limit generated images: 1 for single output, 5 for more variety.

Default: 1Range: 1 - 15
sequential_image_generationoptional
string

Choose sequence: 'auto' for batch, 'disabled' for individual images.

Default: "disabled"
Allowed values :
"disabled""auto"
sizeoptional
string

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

Default: "2K"
Allowed values :
"1K""2K""4K""custom"
widthoptional
integer

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

Default: 2048Range: 1024 - 4096

Response Type

Returns: Image

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