Flux 2 Max Serverless API
Photorealistic images with maximum consistency and fine detail.
POST /v2/flux-2-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 "flux-2-max",
9 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",
10 seed=123,
11 width=1024,
12 height=1024,
13 safety_tolerance=3,
14 output_format="png",
15)
16print(result["status"]) # COMPLETED
17print(result.get("output")) # model output (e.g. media URL)
18print(result["metrics"]["inference_time"]) # server compute seconds
19
20# --- Or submit + poll manually (track request_id, control the cadence) ---
21from segmind import SegmindClient, InferenceFailed, InferenceTimeout
22
23client = SegmindClient() # reads SEGMIND_API_KEY
24payload = {
25 "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",
26 "seed": 123,
27 "width": 1024,
28 "height": 1024,
29 "safety_tolerance": 3,
30 "output_format": "png",
31}
32job = client.submit_async("flux-2-max", **payload)
33print(job.request_id) # available immediately
34try:
35 result = job.wait(timeout=600, interval=1.0)
36except InferenceTimeout as e:
37 print("still running:", e.request_id)
38except InferenceFailed as e:
39 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 "flux-2-max",
9 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",
10 seed=123,
11 width=1024,
12 height=1024,
13 safety_tolerance=3,
14 output_format="png",
15)
16print(result["status"]) # COMPLETED
17print(result.get("output")) # model output (e.g. media URL)
18print(result["metrics"]["inference_time"]) # server compute seconds
19
20# --- Or submit + poll manually (track request_id, control the cadence) ---
21from segmind import SegmindClient, InferenceFailed, InferenceTimeout
22
23client = SegmindClient() # reads SEGMIND_API_KEY
24payload = {
25 "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",
26 "seed": 123,
27 "width": 1024,
28 "height": 1024,
29 "safety_tolerance": 3,
30 "output_format": "png",
31}
32job = client.submit_async("flux-2-max", **payload)
33print(job.request_id) # available immediately
34try:
35 result = job.wait(timeout=600, interval=1.0)
36except InferenceTimeout as e:
37 print("still running:", e.request_id)
38except InferenceFailed as e:
39 print("failed:", e.detail)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
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/flux-2-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