Skip to content

REST API

Dowon edited this page Nov 10, 2024 · 6 revisions

Default

{
  "prompt": "masterpiece, 1girl, <lora:march7th:1>",
  "sampler_name": "Euler",
  "alwayson_scripts": {
    "ADetailer": {
      "args": [
        true,
        false,
        {
          "ad_model": "face_yolov8n.pt",
          "ad_model_classes": "",
          "ad_tab_enable": true,
          "ad_prompt": "",
          "ad_negative_prompt": "",
          "ad_confidence": 0.3,
          "ad_mask_filter_method": "Area",
          "ad_mask_k": 0,
          "ad_mask_min_ratio": 0.0,
          "ad_mask_max_ratio": 1.0,
          "ad_dilate_erode": 4,
          "ad_x_offset": 0,
          "ad_y_offset": 0,
          "ad_mask_merge_invert": "None",
          "ad_mask_blur": 4,
          "ad_denoising_strength": 0.4,
          "ad_inpaint_only_masked": true,
          "ad_inpaint_only_masked_padding": 32,
          "ad_use_inpaint_width_height": false,
          "ad_inpaint_width": 512,
          "ad_inpaint_height": 512,
          "ad_use_steps": false,
          "ad_steps": 28,
          "ad_use_cfg_scale": false,
          "ad_cfg_scale": 7.0,
          "ad_use_checkpoint": false,
          "ad_checkpoint": null,
          "ad_use_vae": false,
          "ad_vae": null,
          "ad_use_sampler": false,
          "ad_sampler": "DPM++ 2M Karras",
          "ad_scheduler": "Use same scheduler",
          "ad_use_noise_multiplier": false,
          "ad_noise_multiplier": 1.0,
          "ad_use_clip_skip": false,
          "ad_clip_skip": 1,
          "ad_restore_face": false,
          "ad_controlnet_model": "None",
          "ad_controlnet_module": "None",
          "ad_controlnet_weight": 1.0,
          "ad_controlnet_guidance_start": 0.0,
          "ad_controlnet_guidance_end": 1.0
        }
      ]
    }
  }
}

The first true is ad_enable.

The second false is skip_img2img, which is used with img2img and can be omitted in the API call.

The two arguments can be ignored, in which case the defaults will be used (true, false respectively)

However, ignoring these two arguments can lead to unpredictable behavior, so please include them whenever possible.

Minimum

{
  "prompt": "masterpiece, 1girl, <lora:march7th:1>",
  "sampler_name": "Euler",
  "alwayson_scripts": {
    "ADetailer": {
      "args": [
        {
          "ad_model": "face_yolov8n.pt"
        }
      ]
    }
  }
}

All omitted arguments will have default values. Note that the default value for ad_model is "None".

Default means adetailer's default, not user's default.

3 or more models

{
  "prompt": "masterpiece, 1girl, <lora:march7th:1>",
  "sampler_name": "Euler",
  "alwayson_scripts": {
    "ADetailer": {
      "args": [
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "person_yolov8s-seg.pt"
        },
        {
          "ad_model": "face_yolov8n.pt"
        }
      ]
    }
  }
}

You can send as many models as you want. However, requests that exceed the max models set in the settings tab can cause errors.

Json Schema

{
  "title": "ADetailerArgs",
  "type": "object",
  "properties": {
    "ad_model": { "title": "Ad Model", "default": "None", "type": "string" },
    "ad_model_classes": {
      "title": "Ad Model Classes",
      "default": "",
      "type": "string"
    },
    "ad_tab_enable": {
      "title": "Ad Tab Enable",
      "default": true,
      "type": "boolean"
    },
    "ad_prompt": { "title": "Ad Prompt", "default": "", "type": "string" },
    "ad_negative_prompt": {
      "title": "Ad Negative Prompt",
      "default": "",
      "type": "string"
    },
    "ad_confidence": {
      "title": "Ad Confidence",
      "default": 0.3,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    },
    "ad_mask_filter_method": {
      "title": "Ad Mask Filter Method",
      "default": "Area",
      "enum": ["Area", "Confidence"],
      "type": "string"
    },
    "ad_mask_k": {
      "title": "Ad Mask K",
      "default": 0,
      "minimum": 0,
      "type": "integer"
    },
    "ad_mask_min_ratio": {
      "title": "Ad Mask Min Ratio",
      "default": 0.0,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    },
    "ad_mask_max_ratio": {
      "title": "Ad Mask Max Ratio",
      "default": 1.0,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    },
    "ad_dilate_erode": {
      "title": "Ad Dilate Erode",
      "default": 4,
      "type": "integer"
    },
    "ad_x_offset": { "title": "Ad X Offset", "default": 0, "type": "integer" },
    "ad_y_offset": { "title": "Ad Y Offset", "default": 0, "type": "integer" },
    "ad_mask_merge_invert": {
      "title": "Ad Mask Merge Invert",
      "default": "None",
      "enum": ["None", "Merge", "Merge and Invert"],
      "type": "string"
    },
    "ad_mask_blur": {
      "title": "Ad Mask Blur",
      "default": 4,
      "minimum": 0,
      "type": "integer"
    },
    "ad_denoising_strength": {
      "title": "Ad Denoising Strength",
      "default": 0.4,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    },
    "ad_inpaint_only_masked": {
      "title": "Ad Inpaint Only Masked",
      "default": true,
      "type": "boolean"
    },
    "ad_inpaint_only_masked_padding": {
      "title": "Ad Inpaint Only Masked Padding",
      "default": 32,
      "minimum": 0,
      "type": "integer"
    },
    "ad_use_inpaint_width_height": {
      "title": "Ad Use Inpaint Width Height",
      "default": false,
      "type": "boolean"
    },
    "ad_inpaint_width": {
      "title": "Ad Inpaint Width",
      "default": 512,
      "exclusiveMinimum": 0,
      "type": "integer"
    },
    "ad_inpaint_height": {
      "title": "Ad Inpaint Height",
      "default": 512,
      "exclusiveMinimum": 0,
      "type": "integer"
    },
    "ad_use_steps": {
      "title": "Ad Use Steps",
      "default": false,
      "type": "boolean"
    },
    "ad_steps": {
      "title": "Ad Steps",
      "default": 28,
      "exclusiveMinimum": 0,
      "type": "integer"
    },
    "ad_use_cfg_scale": {
      "title": "Ad Use Cfg Scale",
      "default": false,
      "type": "boolean"
    },
    "ad_cfg_scale": {
      "title": "Ad Cfg Scale",
      "default": 7.0,
      "minimum": 0,
      "type": "number"
    },
    "ad_use_checkpoint": {
      "title": "Ad Use Checkpoint",
      "default": false,
      "type": "boolean"
    },
    "ad_checkpoint": { "title": "Ad Checkpoint", "type": "string" },
    "ad_use_vae": {
      "title": "Ad Use Vae",
      "default": false,
      "type": "boolean"
    },
    "ad_vae": { "title": "Ad Vae", "type": "string" },
    "ad_use_sampler": {
      "title": "Ad Use Sampler",
      "default": false,
      "type": "boolean"
    },
    "ad_sampler": {
      "title": "Ad Sampler",
      "default": "DPM++ 2M Karras",
      "type": "string"
    },
    "ad_scheduler": {
      "title": "Ad Scheduler",
      "default": "Use same scheduler",
      "type": "string"
    },
    "ad_use_noise_multiplier": {
      "title": "Ad Use Noise Multiplier",
      "default": false,
      "type": "boolean"
    },
    "ad_noise_multiplier": {
      "title": "Ad Noise Multiplier",
      "default": 1.0,
      "minimum": 0.5,
      "maximum": 1.5,
      "type": "number"
    },
    "ad_use_clip_skip": {
      "title": "Ad Use Clip Skip",
      "default": false,
      "type": "boolean"
    },
    "ad_clip_skip": {
      "title": "Ad Clip Skip",
      "default": 1,
      "minimum": 1,
      "maximum": 12,
      "type": "integer"
    },
    "ad_restore_face": {
      "title": "Ad Restore Face",
      "default": false,
      "type": "boolean"
    },
    "ad_controlnet_model": {
      "title": "Ad Controlnet Model",
      "default": "None",
      "type": "string"
    },
    "ad_controlnet_module": {
      "title": "Ad Controlnet Module",
      "default": "None",
      "type": "string"
    },
    "ad_controlnet_weight": {
      "title": "Ad Controlnet Weight",
      "default": 1.0,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    },
    "ad_controlnet_guidance_start": {
      "title": "Ad Controlnet Guidance Start",
      "default": 0.0,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    },
    "ad_controlnet_guidance_end": {
      "title": "Ad Controlnet Guidance End",
      "default": 1.0,
      "minimum": 0.0,
      "maximum": 1.0,
      "type": "number"
    }
  },
  "additionalProperties": false
}
Clone this wiki locally