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
30
31
32
33
34
35
36
37
38
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/flux-kontext-pro";
const reqBody = {
"prompt": "make this a real photograph",
"input_image": "https://segmind-resources.s3.amazonaws.com/input/e9150752-b054-445c-a988-c13c6038dfa9-kontext-pro-ip.webp",
"aspect_ratio": "match_input_image"
};
(async function() {
try {
const formData = new FormData();
// Append regular fields
for (const key in reqBody) {
if (reqBody.hasOwnProperty(key)) {
formData.append(key, reqBody[key]);
}
}
// Convert and append images as Base64 if necessary
const response = await axios.post(url, formData, {
headers: {
'x-api-key': api_key,
...formData.getHeaders()
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
})();
Sets the random seed for generation consistency. Use specific numbers for repeatable results.
Describes the desired output or edit. To create lively imagery, try instructions like 'Turn this into a cyberpunk cityscape.'
Image to edit or guide the generation. Use high-resolution images for the best quality results.
Defines the image's width-to-height ratio. Choose '16:9' for widescreen or '1:1' for square images.
Allowed values:
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.
FLUX.1 Kontext Pro by Black Forest Labs is redefining the landscape of text-guided image editing, providing a robust solution for developers, creators, and executives seeking precision and efficiency in creative tasks. This state-of-the-art AI model stands out for its capabilities to interpret natural language prompts with remarkable accuracy, delivering high-quality and consistent outputs.
FLUX.1 Kontext Pro integrates seamlessly into tech stacks via APIs like ComfyUI and Replicate, facilitating automation and enhancing existing workflows. Developers can benefit from its ability to execute complex, multi-step image edits by crafting clear and concise textual prompts, making it an invaluable tool for projects requiring detailed image manipulation.
This model simplifies and accelerates creative processes, allowing users to modify objects, execute style transfers, replace backgrounds, and more through intuitive text commands. Whether it's generating professional headshots or creating marketing content, FLUX.1 Kontext Pro ensures consistent subject likeness and integrates smoothly into creative pipelines, optimizing productivity and creative output.
FLUX.1 Kontext Pro offers significant business value by enabling the rapid generation of tailored marketing visuals and product mockups. Its superior performance—up to six times faster than previous iterations—translates into time and cost efficiencies. The model's robust text and typography integration features also allow for creating context-aware brand visuals, enhancing competitive advantage.
By leveraging FLUX.1 Kontext Pro, Segmind's audience can approach image editing with enhanced control and creativity, paving the way for groundbreaking advancements in AI-driven content generation.