Flux.1 Schnell
Flux Schnell is a state-of-the-art text-to-image generation model engineered for speed and efficiency.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-schnell"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "a bengal tiger in an astronaut suit on mars, cubist style holding a sign saying 'awesome text gen'",
12 "steps": 4,
13 "seed": 123456789,
14 "sampler_name": "euler",
15 "scheduler": "normal",
16 "samples": 1,
17 "width": 1024,
18 "height": 1024,
19 "denoise": 1
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/flux-schnell"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "a bengal tiger in an astronaut suit on mars, cubist style holding a sign saying 'awesome text gen'",
12 "steps": 4,
13 "seed": 123456789,
14 "sampler_name": "euler",
15 "scheduler": "normal",
16 "samples": 1,
17 "width": 1024,
18 "height": 1024,
19 "denoise": 1
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)API Endpoint
https://api.segmind.com/v1/flux-schnellParameters
promptrequiredstringText prompt for generating the image
"a bengal tiger in an astronaut suit on mars, cubist style holding a sign saying 'awesome text gen'"denoiseoptionalnumberDenoise level for the generated image
1Range: 0 - 1heightoptionalintegerImage height can be between 512 and 2048 in multiples of 8
1024sampler_nameoptionalstringSampler for the image generation process
"euler""euler""euler_pp""euler_ancestral""euler_ancestral_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+17 moresamplesoptionalintegerNumber of samples to generate
1scheduleroptionalstringScheduler for the image generation process
"normal""normal""karras""exponential""sgm_uniform""simple""ddim_uniform"seedoptionalintegerSeed for random number generation
123456789stepsoptionalintegerNumber of inference steps for image generation
4Range: 1 - 8widthoptionalintegerImage height can be between 512 and 2048 in multiples of 8
1024Response Type
Returns: Text/JSON
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