Skip to main content

Magic Mix Endpoint

Overview

This endpoint allow you to magic mix image and prompt to produce an catching images

Magic-Mix endpoint result

Request

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

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

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorizationkey
promptText prompt with a description of the things you want in the image to be generatedstring
negative_promptItems you don't want in the imagestring
imageLink or valid base64 data following the format data:image/jpeg;base64,{your_base64_string} for the image you want your generations to resembleURL, base64 string
widthThe width of the image. Default: 768 pixels. Max: 1024 pixelsinteger
heightThe height of the image. Default: 768 pixels. Max: 1024 pixelsinteger
kminMinimum k value. Default: 0.3. Max: 1float
kmaxMaximum k value. Default: 0.5. Max: 1float
mix_factorMix factor for the task. Default: 0.5. Max: 1float
stepsNumber of denoising steps. Default: 20. Min: 1. Max: 50integer
base64If provided image is in base64 format or if you want your generated images as a base64 string, set this to true. Default: falseboolean (true, false)
samplesNumber of images to be returned in response. Max: 1integer
seedSeed used to reproduce results. Same seed will give you the same image again. Pass null for a random numberinteger, null
webhookSet a URL to receive a POST API call once the image generation is completeURL
track_idThis ID is returned in the response to the webhook API call and will be used to identify the webhook requestinteger

Example

Body

Body
{
"key":"",
"prompt":"Bed",
"height":768,
"width":768,
"image":"https://user-images.githubusercontent.com/59410571/209578593-141467c7-d831-4792-8b9a-b17dc5e47816.jpg",
"kmax":0.5,
"kmin":0.3,
"mix_factor":0.5,
"samples":1,
"negative_prompt":"low quality",
"seed":1829183163,
"steps":20,
"webhook": null,
"track_id": null
}

Request

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

var raw = JSON.stringify({
"key":"",
"prompt":"Bed",
"height":768,
"width":768,
"image":"https://user-images.githubusercontent.com/59410571/209578593-141467c7-d831-4792-8b9a-b17dc5e47816.jpg",
"kmax":0.5,
"kmin":0.3,
"mix_factor":0.5,
"samples":1,
"negative_prompt":"low quality",
"seed":1829183163,
"steps":20,
"webhook": null,
"track_id": null
});

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

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

Response

Example Response

{
"status": "success",
"generationTime": 7.986585378646851,
"id": 511,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/424151c6-00fd-4837-aaef-8b98a5c09f38.png"
],
"meta": {
"H": 768,
"W": 768,
"file_prefix": "424151c6-00fd-4837-aaef-8b98a5c09f38",
"image": "https://user-images.githubusercontent.com/59410571/209578593-141467c7-d831-4792-8b9a-b17dc5e47816.jpg",
"kmax": 0.5,
"kmin": 0.3,
"mix_factor": 0.5,
"n_samples": 1,
"negative_prompt": "low quality",
"outdir": "out",
"prompt": "Bed",
"seed": 1829183163,
"steps": 20
}
}