Skip to main content

Flux Endpoint

Overview

This endpoint helps to to edit an image using Flux.

Request

--request POST 'https://modelslab.com/api/v6/image_editing/flux_edit' \

Make a POST request to https://modelslab.com/api/v6/image_editing/flux_edit endpoint and pass the required parameters as a request body to the endpoint.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization
init_imageLink to the actual image
num_inference_stepsThe number of denoising steps. The acceptable values are 1-10
guidance_scaleThe scale for classifier-free guidance. The minimum is 1 and the maximum is 50
base64true or false
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body
{
"key": "",
"init_image":"https://i.pinimg.com/736x/0d/22/64/0d226454abe91bc4828425c47bd9da74.jpg",
"prompt":"change the colour of the dress to red",
"guidance_scale":"50",
"num_inference_steps":"10",
"track_id": null,
"webhook": null
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key":"",
"init_image":"https://i.pinimg.com/736x/0d/22/64/0d226454abe91bc4828425c47bd9da74.jpg",
"prompt":"change the colour of the dress to red",
"guidance_scale":"50",
"num_inference_steps":"10"
"track_id": null,
"webhook": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v6/image_editing/flux_edit", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"generationTime": 5.358475685119629,
"id": 1942,
"future_links": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/temp/2e91ee4e-8863-4c7d-9eb9-8a9e5e7158cd.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/temp/2e91ee4e-8863-4c7d-9eb9-8a9e5e7158cd.png"
],
"meta": {
"padding_down": 10,
"padding_right": 10,
"prompt": "change the colour of the dress to red",
"scale_down": 6,
"seed": 3491630746,
"system_webhook": "http://sdapi-website-v2.test/generation_handler/imagen/1942",
"temp": "yes",
"track_id": null,
"watermark": "no",
"webhook": null
}
}