POST
javascript
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 39 40 41 42 43 44 45 46 47 const axios = require('axios'); const FormData = require('form-data'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/illusion-diffusion-hq"; const reqBody = { "seed": -1, "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png", "width": 768, "border": 1, "height": 768, "prompt": "(masterpiece:1.4), (best quality), (detailed), Medieval village scene with busy streets and castle in the distance", "num_outputs": 1, "guidance_scale": 7.5, "negative_prompt": "ugly, disfigured, low quality, blurry, nsfw", "qrcode_background": "gray", "num_inference_steps": 40, "controlnet_conditioning_scale": 1 }; (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); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


seedint ( default: -1 )

Seed


imagestr ( default: https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png )

Input image. If none is provided, a QR code will be generated


widthint ( default: 768 )

Width out the output image


borderint ( default: 1 )

QR code border size

min : 0,

max : 4


heightint ( default: 768 )

Height out the output image


promptstr *

The prompt to guide QR Code generation.


num_outputsint ( default: 1 )

Number of outputs

min : 1,

max : 4


guidance_scalefloat ( default: 7.5 )

Scale for classifier-free guidance

min : 0.1,

max : 30


negative_promptstr ( default: ugly, disfigured, low quality, blurry, nsfw )

The negative prompt to guide image generation.


qr_code_contentstr ( default: 1 )

The website/content your QR Code will point to.


qrcode_backgroundenum:str ( default: gray )

An enumeration.

Allowed values:


num_inference_stepsint ( default: 40 )

Number of diffusion steps

min : 20,

max : 100


controlnet_conditioning_scalefloat ( default: 1 )

The outputs of the controlnet are multiplied by `controlnet_conditioning_scale` before they are added to the residual in the original unet.

min : 0,

max : 4

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.

Illusion Diffusion

Illusion Diffusion is an innovative application that uses Stable Diffusion and Controlnet AI models to transform ordinary images into optical illusions and surreal artworks.

Users can upload photos, enter text prompts, and adjust parameters to customize the effect and style of their creations. The result is stunning high-quality illusion artwork. This tool opens up a new realm of possibilities for digital art, allowing users to create unique and captivating images with ease.