Flux 2 Max Serverless API

FLUX.2 Max generates photorealistic images with unparalleled consistency and contextual awareness for professional content creation.

~54.03s
~$0.227
 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

POSThttps://api.segmind.com/v1/flux-2-max

Parameters

image_urlsrequired
string[]

Provide high-quality image URLs for reference. Use clear images for accuracy, diverse for variety.

promptrequired
string

Guide image creation using detailed phrases. Use vivid imagery for complexity, simple for minimalism.

heightoptional
integer

Determine image height. Use larger values for quality, smaller for faster results.

Default: 1024
output_formatoptional
string

Select image format for output. Use 'jpeg' for compressed quality, 'png' for transparency needs.

Default: "png"
Allowed values :
"jpeg""png"
safety_toleranceoptional
integer

Adjust safety for content moderation. Higher for strict checks, lower for flexibility.

Default: 3Range: 0 - 6
seedoptional
integer

Use specific numbers for consistent images. Random values automatically generate new images.

Default: 123
widthoptional
integer

Determine image width. Set higher for detailed images, lower for speed.

Default: 1024

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