Flux 2 Max Serverless API
FLUX.2 Max generates photorealistic images with unparalleled consistency and contextual awareness for professional content creation.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-2-max"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "technical_specs:\nmedium: Commercial magazine photography\nstyle: Clean, high-energy editorial\ncamera: Phase One XF, 80mm medium format lens\nlighting: Professional studio lighting, soft key light, even fill to eliminate harsh shadows\ntexture: Sharp, high-resolution digital, smooth skin texture\n\nsetting:\nlocation:\nname: Professional Photography Studio\nzone: Seamless cyclorama wall with geometric props\nbackground_elements:\n- Solid peach-orange seamless backdrop\n- Stacked orange and apricot-colored geometric cubes and rectangular pedestals\n- Minimalist, clean studio floor\nmagazine_layout:\nmasthead: 'Women's Health' in large light green serif typography at the top\nheadlines:\n- 'Spring forward: How to eat, travel and sweat'\n- '15 skincare habits beauty founders swear by'\n- 'Fake Views: Inside the scroll holes'\n- 'The Workout'\ncolor_palette: Triadic scheme of Forest Green, Vibrant Orange, and Pastel Green/White\n\nsubject:\ncharacter: Fit athletic woman, mid-20s\nappearance:\nhair: Long, wavy honey blonde hair with a side part, cascading over one shoulder\nskin: Healthy, glowing, athletic tan with natural skin texture\nmakeup: Dewy 'no-makeup' look, neutral lip balm, groomed eyebrows\nattire:\ntop: Dark forest green lightweight zip-up windbreaker jacket, sleeves slightly bunched at elbows\nbase_layer: Matching vibrant orange sports bra and high-waisted athletic shorts\nfootwear: Classic white leather sneakers with three black stripes and gum-colored soles\naccessories: White crew-length athletic socks with bold black 'SAME' text branding\npose: Confident seated stance on stacked cubes, legs spread wide, leaning slightly forward, elbows resting on thighs\nemotion:\nprimary: Empowered, cool, and confident\ngaze: Direct, intense eye contact with the camera\n\nlighting_and_atmosphere:\nkey_light: Large overhead softbox providing even illumination\nfill_light: Reflected light from the orange props giving a warm glow to the skin\ncontrast: Crisp definition with soft, controlled shadows to emphasize muscle tone",
12 "seed": 123,
13 "width": 1024,
14 "height": 1024,
15 "safety_tolerance": 3,
16 "output_format": "png"
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-2-max"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "technical_specs:\nmedium: Commercial magazine photography\nstyle: Clean, high-energy editorial\ncamera: Phase One XF, 80mm medium format lens\nlighting: Professional studio lighting, soft key light, even fill to eliminate harsh shadows\ntexture: Sharp, high-resolution digital, smooth skin texture\n\nsetting:\nlocation:\nname: Professional Photography Studio\nzone: Seamless cyclorama wall with geometric props\nbackground_elements:\n- Solid peach-orange seamless backdrop\n- Stacked orange and apricot-colored geometric cubes and rectangular pedestals\n- Minimalist, clean studio floor\nmagazine_layout:\nmasthead: 'Women's Health' in large light green serif typography at the top\nheadlines:\n- 'Spring forward: How to eat, travel and sweat'\n- '15 skincare habits beauty founders swear by'\n- 'Fake Views: Inside the scroll holes'\n- 'The Workout'\ncolor_palette: Triadic scheme of Forest Green, Vibrant Orange, and Pastel Green/White\n\nsubject:\ncharacter: Fit athletic woman, mid-20s\nappearance:\nhair: Long, wavy honey blonde hair with a side part, cascading over one shoulder\nskin: Healthy, glowing, athletic tan with natural skin texture\nmakeup: Dewy 'no-makeup' look, neutral lip balm, groomed eyebrows\nattire:\ntop: Dark forest green lightweight zip-up windbreaker jacket, sleeves slightly bunched at elbows\nbase_layer: Matching vibrant orange sports bra and high-waisted athletic shorts\nfootwear: Classic white leather sneakers with three black stripes and gum-colored soles\naccessories: White crew-length athletic socks with bold black 'SAME' text branding\npose: Confident seated stance on stacked cubes, legs spread wide, leaning slightly forward, elbows resting on thighs\nemotion:\nprimary: Empowered, cool, and confident\ngaze: Direct, intense eye contact with the camera\n\nlighting_and_atmosphere:\nkey_light: Large overhead softbox providing even illumination\nfill_light: Reflected light from the orange props giving a warm glow to the skin\ncontrast: Crisp definition with soft, controlled shadows to emphasize muscle tone",
12 "seed": 123,
13 "width": 1024,
14 "height": 1024,
15 "safety_tolerance": 3,
16 "output_format": "png"
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-2-maxParameters
image_urlsrequiredstring[]Provide high-quality image URLs for reference. Use clear images for accuracy, diverse for variety.
promptrequiredstringGuide image creation using detailed phrases. Use vivid imagery for complexity, simple for minimalism.
heightoptionalintegerDetermine image height. Use larger values for quality, smaller for faster results.
1024output_formatoptionalstringSelect image format for output. Use 'jpeg' for compressed quality, 'png' for transparency needs.
"png""jpeg""png"safety_toleranceoptionalintegerAdjust safety for content moderation. Higher for strict checks, lower for flexibility.
3Range: 0 - 6seedoptionalintegerUse specific numbers for consistent images. Random values automatically generate new images.
123widthoptionalintegerDetermine image width. Set higher for detailed images, lower for speed.
1024Response 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