Flux Kontext Max Serverless API
FLUX.1 Kontext [max] transforms textual descriptions into stunning, high-fidelity images with seamless typography integration.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-kontext-max"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "seed": 30699,
12 "prompt": "Make her take a selfie in the streets of Freiburg, it's a lovely day out",
13 "input_image": "https://segmind-resources.s3.amazonaws.com/input/a1adf47e-bfba-45c4-a11f-ae2b732102ad-kontext-max-ip.webp",
14 "aspect_ratio": "16:9",
15 "output_format": "png",
16 "safety_tolerance": 6
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22 result = response.json()
23 print(json.dumps(result, indent=2))
24else:
25 print(f"Error: {response.status_code}")
26 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-kontext-max"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "seed": 30699,
12 "prompt": "Make her take a selfie in the streets of Freiburg, it's a lovely day out",
13 "input_image": "https://segmind-resources.s3.amazonaws.com/input/a1adf47e-bfba-45c4-a11f-ae2b732102ad-kontext-max-ip.webp",
14 "aspect_ratio": "16:9",
15 "output_format": "png",
16 "safety_tolerance": 6
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22 result = response.json()
23 print(json.dumps(result, indent=2))
24else:
25 print(f"Error: {response.status_code}")
26 print(response.text)API Endpoint
https://api.segmind.com/v1/flux-kontext-maxParameters
promptrequiredstringDescribe what you want to generate. Suggest vibrant scenes for maximum creativity.
aspect_ratiooptionalstringSelect the image aspect ratio. Common choices are 16:9 for landscapes or 1:1 for portraits.
"16:9""match_input_image""1:1""16:9""9:16""4:3""3:4""3:2""2:3""4:5""5:4"+4 moreinput_imageoptionalstring (uri)Provide a reference image URL. Use high quality images for best guidance.
"https://segmind-resources.s3.amazonaws.com/input/a1adf47e-bfba-45c4-a11f-ae2b732102ad-kontext-max-ip.webp"output_formatoptionalstringOutput format for the generated image.
"png""jpg""png"safety_toleranceoptionalintegerSafety tolerance, 1 is most strict and 6 is most permissive. 2 is currently the maximum allowed when input images are used.
2seedoptionalintegerSet a random seed for consistent results. Useful for generating identical outputs in repeated tasks.
123Response 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