Multi Image Kontext Max Serverless API
FLUX.1 Kontext [max] creates stunning, photorealistic images from text prompts and input images seamlessly.
POST /v2/multi-image-kontext-max · 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 "multi-image-kontext-max",
9 seed=42,
10 prompt="put the green dress on the woman while maintaining the pose of the woman as it is",
11 aspect_ratio="1:1",
12 input_image_1="https://segmind-resources.s3.amazonaws.com/output/9cb479d3-5c5f-4d5d-a782-972acbc42598-c1.jpg",
13 input_image_2="https://segmind-resources.s3.amazonaws.com/output/79feee7b-d09f-4bde-bec3-c8e8a8703f04-d2.png",
14 output_format="jpg",
15 safety_tolerance=1,
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 "seed": 42,
27 "prompt": "put the green dress on the woman while maintaining the pose of the woman as it is",
28 "aspect_ratio": "1:1",
29 "input_image_1": "https://segmind-resources.s3.amazonaws.com/output/9cb479d3-5c5f-4d5d-a782-972acbc42598-c1.jpg",
30 "input_image_2": "https://segmind-resources.s3.amazonaws.com/output/79feee7b-d09f-4bde-bec3-c8e8a8703f04-d2.png",
31 "output_format": "jpg",
32 "safety_tolerance": 1,
33}
34job = client.submit_async("multi-image-kontext-max", **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 "multi-image-kontext-max",
9 seed=42,
10 prompt="put the green dress on the woman while maintaining the pose of the woman as it is",
11 aspect_ratio="1:1",
12 input_image_1="https://segmind-resources.s3.amazonaws.com/output/9cb479d3-5c5f-4d5d-a782-972acbc42598-c1.jpg",
13 input_image_2="https://segmind-resources.s3.amazonaws.com/output/79feee7b-d09f-4bde-bec3-c8e8a8703f04-d2.png",
14 output_format="jpg",
15 safety_tolerance=1,
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 "seed": 42,
27 "prompt": "put the green dress on the woman while maintaining the pose of the woman as it is",
28 "aspect_ratio": "1:1",
29 "input_image_1": "https://segmind-resources.s3.amazonaws.com/output/9cb479d3-5c5f-4d5d-a782-972acbc42598-c1.jpg",
30 "input_image_2": "https://segmind-resources.s3.amazonaws.com/output/79feee7b-d09f-4bde-bec3-c8e8a8703f04-d2.png",
31 "output_format": "jpg",
32 "safety_tolerance": 1,
33}
34job = client.submit_async("multi-image-kontext-max", **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/multi-image-kontext-maxParameters
input_image_1requiredstring (uri)First image for transformation
"https://segmind-resources.s3.amazonaws.com/output/9cb479d3-5c5f-4d5d-a782-972acbc42598-c1.jpg"input_image_2requiredstring (uri)Second image for transformation.
"https://segmind-resources.s3.amazonaws.com/output/79feee7b-d09f-4bde-bec3-c8e8a8703f04-d2.png"promptrequiredstringDescribes the prompt for image transformation.
"put the green dress on the woman while maintaining the pose of the woman as it is"aspect_ratiooptionalstringSets output aspect ratio. Use '16:9' for wide images.
"16:9""match_input_image""1:1""16:9""9:16""4:3""3:4""3:2""2:3""4:5""5:4"+4 moreoutput_formatoptionalstringSets output forma.
"jpg""jpg""png"safety_toleranceoptionalintegerControls content safety level. Use 1 for moderate strictness.
1Range: 0 - 2seedoptionalintegerSets seed for reproducibility.
42Response 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/multi-image-kontext-maxSubmit — 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