Flux Krea Dev Serverless API
FLUX.1 Krea generates stunning, photorealistic images with fine-tuned aesthetic control for diverse creative applications.
POST /v2/flux-krea-dev · 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-krea-dev",
9 seed=42,
10 prompt="A miniature raccoon explorer made of wool wearing all kinds of equipment, the whole world is made of felt textile, holding a signboard which says 'Flux krea dev on Segmind'",
11 go_fast=True,
12 guidance=3,
13 megapixels="1",
14 num_outputs=2,
15 aspect_ratio="16:9",
16 output_format="jpg",
17 output_quality=90,
18 prompt_strength=0.7,
19 num_inference_steps=40,
20 disable_safety_checker=False,
21)
22print(result["status"]) # COMPLETED
23print(result.get("output")) # model output (e.g. media URL)
24print(result["metrics"]["inference_time"]) # server compute seconds
25
26# --- Or submit + poll manually (track request_id, control the cadence) ---
27from segmind import SegmindClient, InferenceFailed, InferenceTimeout
28
29client = SegmindClient() # reads SEGMIND_API_KEY
30payload = {
31 "seed": 42,
32 "prompt": "A miniature raccoon explorer made of wool wearing all kinds of equipment, the whole world is made of felt textile, holding a signboard which says 'Flux krea dev on Segmind'",
33 "go_fast": True,
34 "guidance": 3,
35 "megapixels": "1",
36 "num_outputs": 2,
37 "aspect_ratio": "16:9",
38 "output_format": "jpg",
39 "output_quality": 90,
40 "prompt_strength": 0.7,
41 "num_inference_steps": 40,
42 "disable_safety_checker": False,
43}
44job = client.submit_async("flux-krea-dev", **payload)
45print(job.request_id) # available immediately
46try:
47 result = job.wait(timeout=600, interval=1.0)
48except InferenceTimeout as e:
49 print("still running:", e.request_id)
50except InferenceFailed as e:
51 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-krea-dev",
9 seed=42,
10 prompt="A miniature raccoon explorer made of wool wearing all kinds of equipment, the whole world is made of felt textile, holding a signboard which says 'Flux krea dev on Segmind'",
11 go_fast=True,
12 guidance=3,
13 megapixels="1",
14 num_outputs=2,
15 aspect_ratio="16:9",
16 output_format="jpg",
17 output_quality=90,
18 prompt_strength=0.7,
19 num_inference_steps=40,
20 disable_safety_checker=False,
21)
22print(result["status"]) # COMPLETED
23print(result.get("output")) # model output (e.g. media URL)
24print(result["metrics"]["inference_time"]) # server compute seconds
25
26# --- Or submit + poll manually (track request_id, control the cadence) ---
27from segmind import SegmindClient, InferenceFailed, InferenceTimeout
28
29client = SegmindClient() # reads SEGMIND_API_KEY
30payload = {
31 "seed": 42,
32 "prompt": "A miniature raccoon explorer made of wool wearing all kinds of equipment, the whole world is made of felt textile, holding a signboard which says 'Flux krea dev on Segmind'",
33 "go_fast": True,
34 "guidance": 3,
35 "megapixels": "1",
36 "num_outputs": 2,
37 "aspect_ratio": "16:9",
38 "output_format": "jpg",
39 "output_quality": 90,
40 "prompt_strength": 0.7,
41 "num_inference_steps": 40,
42 "disable_safety_checker": False,
43}
44job = client.submit_async("flux-krea-dev", **payload)
45print(job.request_id) # available immediately
46try:
47 result = job.wait(timeout=600, interval=1.0)
48except InferenceTimeout as e:
49 print("still running:", e.request_id)
50except InferenceFailed as e:
51 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/flux-krea-devParameters
promptrequiredstringGuide the AI with text for the image generation. Short and imaginative prompts work best; imaginative scenes suggest detailed descriptions.
aspect_ratiooptionalstringDecide image proportions. Use '1:1' for square or other ratios for landscapes or portraits.
"16:9""1:1""16:9""21:9""3:2""2:3""4:5""5:4""3:4""4:3""9:16"+1 moredisable_safety_checkeroptionalbooleanToggle safety checker to allow all image outputs. Disable to maximize creative freedom.
falsego_fastoptionalbooleanEnable faster predictions; less deterministic but quicker. Disable for exact replication and improved detail.
trueguidanceoptionalnumberControls adherence to prompt. Increase for more accuracy; decrease for creative variance.
7Range: 0 - 10imageoptionalstring (uri)Input an image to guide the output. Match aspect ratio to maintain consistency; use any for unique results.
nullmegapixelsoptionalnumberChoose resolution size. Use '1' for high-quality or '0.25' for faster, lower-resolution outputs.
110.25num_inference_stepsoptionalintegerAdjust the number of processing steps. Higher gives better quality; lower speeds up.
40Range: 1 - 50num_outputsoptionalintegerSet the number of images generated. Choose more for variability or single for speed.
2Range: 1 - 4output_formatoptionalstringSelect image format. Use 'webp' for web-friendly, 'jpg' for compression, or 'png' for quality.
"jpg""webp""jpg""png"output_qualityoptionalintegerSet image saving quality. Choose 100 for best or lower for smaller file size.
90Range: 0 - 100prompt_strengthoptionalnumberDefines prompt influence in img2img mode. High values alter original image more significantly.
0.7Range: 0 - 1seedoptionalintegerThe seed ensures reproducibility. Use specific numbers for consistent results or leave random for variability.
42Response 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-krea-devSubmit — 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