illusion-diffusion-hq Serverless API

Monster Labs QrCode ControlNet on top of SD Realistic Vision v5.1

~60.03s
POST /v2/illusion-diffusion-hq · submit + poll
 1# pip install "segmind>=1.1.0"
 2# export SEGMIND_API_KEY="YOUR_API_KEY"
 3import segmind
 4
 5# Async (v2): submit to the queue and block until COMPLETED.
 6# run() returns the final result dict (600s deadline, 1.0s poll by default).
 7result = segmind.run(
 8    "illusion-diffusion-hq",
 9    seed=-1,
10    image="https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png",
11    width=768,
12    border=1,
13    height=768,
14    prompt="(masterpiece:1.4), (best quality), (detailed), Medieval village scene with busy streets and castle in the distance",
15    num_outputs=1,
16    guidance_scale=7.5,
17    negative_prompt="ugly, disfigured, low quality, blurry, nsfw",
18    qrcode_background="gray",
19    num_inference_steps=40,
20    controlnet_conditioning_scale=1,
21)
22print(result["status"])                      # COMPLETED
23print(result.get("output"))                  # model output (e.g. media URL)
24print(result["metrics"]["inference_time"])   # server compute seconds
25
26# --- Or submit + poll manually (track request_id, control the cadence) ---
27from segmind import SegmindClient, InferenceFailed, InferenceTimeout
28
29client = SegmindClient()                      # reads SEGMIND_API_KEY
30payload = {
31    "seed": -1,
32    "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png",
33    "width": 768,
34    "border": 1,
35    "height": 768,
36    "prompt": "(masterpiece:1.4), (best quality), (detailed), Medieval village scene with busy streets and castle in the distance",
37    "num_outputs": 1,
38    "guidance_scale": 7.5,
39    "negative_prompt": "ugly, disfigured, low quality, blurry, nsfw",
40    "qrcode_background": "gray",
41    "num_inference_steps": 40,
42    "controlnet_conditioning_scale": 1,
43}
44job = client.submit_async("illusion-diffusion-hq", **payload)
45print(job.request_id)                         # available immediately
46try:
47    result = job.wait(timeout=600, interval=1.0)
48except InferenceTimeout as e:
49    print("still running:", e.request_id)
50except InferenceFailed as e:
51    print("failed:", e.detail)

API Endpoint

POSThttps://api.segmind.com/v1/illusion-diffusion-hq

Parameters

promptrequired
string

The prompt to guide QR Code generation.

Default: "(masterpiece:1.4), (best quality), (detailed), Medieval village scene with busy streets and castle in the distance"
borderoptional
integer

QR code border size

Default: 1Range: 0 - 4
controlnet_conditioning_scaleoptional
number

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

Default: 1Range: 0 - 4
guidance_scaleoptional
number

Scale for classifier-free guidance

Default: 7.5Range: 0.1 - 30
heightoptional
integer

Height out the output image

Default: 768
imageoptional
string (uri)

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

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png"
negative_promptoptional
string

The negative prompt to guide image generation.

Default: "ugly, disfigured, low quality, blurry, nsfw"
num_inference_stepsoptional
integer

Number of diffusion steps

Default: 40Range: 20 - 100
num_outputsoptional
integer

Number of outputs

Default: 1Range: 1 - 4
qr_code_contentoptional
string

The website/content your QR Code will point to.

Default: ""
qrcode_backgroundoptional
string

An enumeration.

Default: "gray"
Allowed values :
"gray""white"
seedoptional
integer

Seed

Default: -1
widthoptional
integer

Width out the output image

Default: 768

Response Type

Returns: Image

Asynchronous requests (v2)

Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.

  1. 1
    POST /v2/illusion-diffusion-hq

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • A FAILED request is served as HTTP 422 — the body still carries the error detail.
  • An unknown or expired request_id returns HTTP 404.
  • Results are retained for 1 hour, then expire.
  • Content / RAI blocks surface as FAILED, not a separate state.
  • Track completion by polling the status endpoint.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out