Skip to main content

Magic Mix Endpoint

Overview

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

Image to image endpoint result

Request

--request POST 'https://stablediffusionapi.com/api/v5/magic_mix' \

Make a POST request to https://stablediffusionapi.com/api/v5/magic_mix 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
imageurl of the image you want magic mix
widthMax Height: Default 768
heightMax Height: Default 768
kminOptional. Minimum k value. Default is 0.3
kmaxOptional. Maximum k value. Default is 0.5
mix_factorOptional. Mix factor for the task. Default is 0.5
stepsNumber of denoising steps (minimum: 1; maximum: 50) Default is 20
samplesNumber of images to be returned in response. The maximum value is 4.
seedSeed is used to reproduce results, same seed will give you same image in return again. Pass null for a
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":"",
"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://stablediffusionapi.com/api/v5/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
}
}