Skip to main content

Enterprise: Relighting Endpoint

Overview

This endpoint helps to create lighting around image

Request

--request POST 'https://modelslab.com/api/v1/enterprise/image_editing/relighting' \

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

Body Attributes

ParameterDescription
keyYour API Key used for request authorization
promptText prompt with description of the things you want in the image to be generated
negative_promptItems you don't want in the image
init_imageLink or provide valid base64 data which follows the format data:image/jpeg;base64,{your_base64_string} to the image you want your generations to resemble.
widthMax Height: Width: 1024x1024
heightMax Height: Width: 1024x1024
lightingHow lightening should be place. Available data are none, left, right, top, bottom
guidance_scaleOptional. Scale for classifier-free guidance (minimum: 1; maximum: 20). Default is 7
highres_scalehigh resolution scale. Defaults to 1.5
lowres_denoiselow resolution denoise. Defaults ot 0.9
highres_denoisehigh resolution denoise defaults to 0.5
num_inference_stepsNumber of denoising steps. Default: 20, Max: 50
base64If provided image is in base64 format or if you want your generated images as a base64 string, must be set to true. Default: false.
seedSeed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number.
samplesNumber of images to be returned in response. The maximum value is 2.
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://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": null
}

Request

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

var raw = JSON.stringify({
"key":"",
"init_image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": null
});

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

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

Response

Example Response

{
"status": "success",
"generationTime": 7.328356504440308,
"id": 67,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/f5a759d2-9af0-4965-8894-7e4433ee76e9-0.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/f5a759d2-9af0-4965-8894-7e4433ee76e9-0.png"
],
"meta": {
"base64": "no",
"file_prefix": "f5a759d2-9af0-4965-8894-7e4433ee76e9",
"guidance_scale": 7,
"height": 512,
"highres_denoise": 0.5,
"highres_scale": 1.5,
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"lowres_denoise": 0.9,
"negative_prompt": "low quality",
"num_inference_steps": 20,
"outdir": "out",
"prompt": "woman, detailed, neon lighting",
"samples": 1,
"seed": -1,
"temp": "no",
"width": 1024
}
}