FLUX.1 Kontext [dev]
FLUX.1 Kontext [dev] creates coherent and editable images by integrating text and visual cues for iterative design.
API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import requests
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/flux-kontext-dev"
# Prepare data and files
data = {}
files = {}
data['seed'] = 42
data['prompt'] = "Replace the background with a bokeh light effect, zooming in on the subject, keeping the person’s pose, position, scale, and camera angle identical. Only change the surrounding environment. "
data['guidance'] = 7
# For parameter "input_image", you can send a raw file or a URI:
# files['input_image'] = open('IMAGE_PATH', 'rb') # To send a file
data['input_image'] = 'https://images.segmind.com/generations/901b78cd-381a-4284-8391-306d4c7409e1/6852c6602b5db2d623cc373cfa699b55.webp' # To send a URI
data['aspect_ratio'] = "match_input_image"
data['output_format'] = "png"
data['output_quality'] = 90
data['num_inference_steps'] = 35
data['disable_safety_checker'] = False
headers = {'x-api-key': api_key}
# If no files, send as JSON
if files:
response = requests.post(url, data=data, files=files, headers=headers)
else:
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Set a random seed for reproducibility. Use for consistent results; leave blank for randomness.
Describe generation task or image edits. Use clear and specific instructions for best results.
Determines adherence to prompt. Use higher values for more precision.
min : 0,
max : 10
Reference image for context. Use jpeg, png, gif, or webp for varied image integrations.
Select aspect ratio. Match input for consistency; use fixed for specific dimensions.
Allowed values:
Specify output format. Use webp for compressibility; jpg or png for compatibility.
Allowed values:
Determine output image quality. Use high values for detailed images and adjustments for jpg outputs.
min : 0,
max : 100
Specify number of processing steps. Use more steps for complex images and fewer for faster results.
min : 4,
max : 50
Turn off NSFW filter. Use with caution if needing unrestricted content.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Resources to get you started
Everything you need to know to get the most out of FLUX.1 Kontext [dev]
# FLUX.1 Kontext User Guide
FLUX.1 Kontext is a unified text-to-image and in-context editing model. It leverages generative flow matching to maintain object and character consistency across multi‐step edits, making it ideal for concept art, style transfer, prototyping and more.
---
## 1. Core Parameters
- **prompt** (required): Describe the scene or edit in clear, specific language.
- **input_image** (required for editing): Use JPEG/PNG/GIF/WebP. Serves as your visual anchor.
- **guidance** (0–10, default 7):
- Low (2–4): creative freedom, looser adherence
- Medium (5–7): balanced fidelity and innovation
- High (8–10): strict prompt compliance
- **num_inference_steps** (4–50, default 35):
- Fewer steps (4–15): faster, rough drafts
- Medium (20–35): balanced quality/speed
- More steps (40–50): fine details, high-res outputs
- **aspect_ratio**: Match input or choose from presets (1:1, 16:9, 21:9, etc.)
- **output_format**: `png` (default) or `jpg`/`webp`
- **output_quality** (0–100, default 90): JPEG quality control
- **seed** (int, default 42): For reproducible results
---
## 2. Use Case Recipes
### A. Concept Art & Illustration
- guidance: 6–8
- steps: 30–40 (greater detail)
- aspect_ratio: match_input_image or widescreen (16:9)
- seed: leave random to explore variations
### B. Style Transfer & Recoloring
- guidance: 7–9 (to preserve structure)
- steps: 25–35
- aspect_ratio: use original dimensions
- input_image: your source artwork
- output_format: `png` for lossless fidelity
### C. Product Mockups & Branding
- guidance: 8–10 (precise placement)
- steps: 20–30
- aspect_ratio: 1:1 for social media or 4:5 for print ads
- seed: fixed for consistent batch outputs
### D. Rapid Prototyping / Real-Time Edits
- guidance: 5–7 (more exploration)
- steps: 10–20 (faster turnaround)
- aspect_ratio: match_input_image
- output_format: `jpg` + quality 80 for smaller files
---
## 3. Tips & Best Practices
1. **Prompt Engineering**
- Be explicit: “Add neon reflections on wet asphalt.”
- Use style keywords: “oil painting,” “low-poly 3D,” “vaporwave.”
2. **Iterative Refinement**
- Start with low steps & guidance, then boost for final render.
- Lock seed when comparing style variations.
3. **Consistency Across Frames**
- Reuse the same seed+guidance for storyboarding.
- Keep aspect_ratio constant to preserve framing.
4. **Safety & Compliance**
- Disable safety only if absolutely necessary (advanced users).
---
## 4. Troubleshooting
- **Too abstract?** Increase guidance or add detail to the prompt.
- **Artifacts / Blurry regions?** Raise num_inference_steps.
- **Color shifts?** Use “consistent palette” or reference a color swatch image.
---
Unlock your creative flow with FLUX.1 Kontext—iterate fast, stay consistent, and produce high-quality imagery every time.
Other Popular Models
Discover other models you might be interested in.
sdxl-img2img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers

fooocus
Fooocus enables high-quality image generation effortlessly, combining the best of Stable Diffusion and Midjourney.

insta-depth
InstantID aims to generate customized images with various poses or styles from only a single reference ID image while ensuring high fidelity

sdxl1.0-txt2img
The SDXL model is the official upgrade to the v1.5 model. The model is released as open-source software
