Flux.1 Schnell

Flux Schnell  is a state-of-the-art text-to-image generation model engineered for speed and efficiency.

~10.23s
~$0.008
 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

POSThttps://api.segmind.com/v1/flux-schnell

Parameters

promptrequired
string

Text prompt for generating the image

Default: "a bengal tiger in an astronaut suit on mars, cubist style holding a sign saying 'awesome text gen'"
denoiseoptional
number

Denoise level for the generated image

Default: 1Range: 0 - 1
heightoptional
integer

Image height can be between 512 and 2048 in multiples of 8

Default: 1024
sampler_nameoptional
string

Sampler for the image generation process

Default: "euler"
Allowed values (27 total):
"euler""euler_pp""euler_ancestral""euler_ancestral_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+17 more
samplesoptional
integer

Number of samples to generate

Default: 1
scheduleroptional
string

Scheduler for the image generation process

Default: "normal"
Allowed values :
"normal""karras""exponential""sgm_uniform""simple""ddim_uniform"
seedoptional
integer

Seed for random number generation

Default: 123456789
stepsoptional
integer

Number of inference steps for image generation

Default: 4Range: 1 - 8
widthoptional
integer

Image height can be between 512 and 2048 in multiples of 8

Default: 1024

Response Type

Returns: Text/JSON

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