Generate image from text

POST /sdapi/txt2img
application/json

Body Required

  • model_id string Required

    The ID of the model to be used.

  • prompt string Required

    Text prompt with description of the things you want in the image to be generated

  • Items you don't want in the image

  • width number Required

    Max Width: 1024x1024

    Minimum value is 1, maximum value is 1024. Default value is 512.

  • height number Required

    Max Height: 1024x1024

    Minimum value is 1, maximum value is 1024. Default value is 512.

  • samples number

    Number of images to generate

    Minimum value is 1, maximum value is 1. Default value is 1.

  • num_inference_steps number Required

    Number of denoising steps, The value accepts 21,31,41.

    Minimum value is 5, maximum value is 25. Default value is 21.

  • A checker for NSFW images. If such an image is detected, it will be replaced by a blank image.

    Values are yes or no. Default value is yes.

  • Type of safety checker

    Values are blur, sensitive_content_text, pixelate, or black. Default value is sensitive_content_text.

  • Enhance prompts for better results.

    Values are yes or no. Default value is yes.

  • seed string

    Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number.

  • guidance_scale number Required

    Scale for classifier-free guidance (minimum: 1; maximum: 20)

    Minimum value is 0, maximum value is 20. Default value is 7.5.

  • Set this parameter to "yes" to generate a panorama image.

    Values are yes or no. Default value is yes.

  • If you want a high quality image, set this parameter to "yes". In this case the image generation will take more time.

    Values are yes or no. Default value is yes.

  • Set this parameter to "yes" if you want to upscale the given image resolution two times (2x). If the requested resolution is 512 x 512 px, the generated image will be 1024 x 1024 px.

    Values are yes or no. Default value is yes.

  • Use it to pass an embeddings model.

  • Enable tomesd to generate images: gives really fast results

    Values are yes or no. Default value is yes.

  • Use keras sigmas to generate images. Gives nice results.

    Values are yes or no. Default value is yes.

  • Used in DPMSolverMultistepScheduler scheduler.

    Value is dpmsolver+++. Default value is dpmsolver+++.

  • vae string

    Use custom vae in generating images.

  • Specify the strength of the LoRa model you're using. If using multiple LoRa, provide each value as a comma-separated range from minimum 0.1 to maximum 1.

    Default value is 1.

  • Multi lora is supported, pass comma saparated values. Example lora1,lora2

  • scheduler string Required

    Scheduler to be used for image generation.

  • Number of frames to skip in clip.

    Minimum value is 1, maximum value is 10. Default value is 2.

  • Fix high resolution images.

    Values are yes or no. Default value is yes.

Responses

  • 200 application/json

    Default Response

    Hide response attributes Show response attributes object
    • status boolean

      Default value is true.

    • message string

      Default value is success.

    • result object

      Additional properties are allowed.

      Hide result attributes Show result attributes object
      • generation_time string Required
      • images array[string] Required
      • meta object

        Additional properties are allowed.

        Hide meta attributes Show meta attributes object
        • model_id string

          The ID of the model to be used.

        • prompt string

          Text prompt with description of the things you want in the image to be generated

        • Items you don't want in the image

        • width number

          Max Width: 1024x1024

          Minimum value is 1, maximum value is 1024. Default value is 512.

        • height number

          Max Height: 1024x1024

          Minimum value is 1, maximum value is 1024. Default value is 512.

        • samples number

          Number of images to generate

          Minimum value is 1, maximum value is 1. Default value is 1.

        • Number of denoising steps, The value accepts 21,31,41.

          Minimum value is 5, maximum value is 25. Default value is 21.

        • A checker for NSFW images. If such an image is detected, it will be replaced by a blank image.

          Values are yes or no. Default value is yes.

        • Type of safety checker

          Values are blur, sensitive_content_text, pixelate, or black. Default value is sensitive_content_text.

        • Enhance prompts for better results.

          Values are yes or no. Default value is yes.

        • seed string

          Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number.

        • Scale for classifier-free guidance (minimum: 1; maximum: 20)

          Minimum value is 0, maximum value is 20. Default value is 7.5.

        • Set this parameter to "yes" to generate a panorama image.

          Values are yes or no. Default value is yes.

        • If you want a high quality image, set this parameter to "yes". In this case the image generation will take more time.

          Values are yes or no. Default value is yes.

        • Set this parameter to "yes" if you want to upscale the given image resolution two times (2x). If the requested resolution is 512 x 512 px, the generated image will be 1024 x 1024 px.

          Values are yes or no. Default value is yes.

        • Use it to pass an embeddings model.

        • Enable tomesd to generate images: gives really fast results

          Values are yes or no. Default value is yes.

        • Use keras sigmas to generate images. Gives nice results.

          Values are yes or no. Default value is yes.

        • Used in DPMSolverMultistepScheduler scheduler.

          Value is dpmsolver+++. Default value is dpmsolver+++.

        • vae string

          Use custom vae in generating images.

        • Specify the strength of the LoRa model you're using. If using multiple LoRa, provide each value as a comma-separated range from minimum 0.1 to maximum 1.

          Default value is 1.

        • Multi lora is supported, pass comma saparated values. Example lora1,lora2

        • Scheduler to be used for image generation.

        • Number of frames to skip in clip.

          Minimum value is 1, maximum value is 10. Default value is 2.

        • Fix high resolution images.

          Values are yes or no. Default value is yes.

  • 400 application/json

    Invalid request error

    Hide response attributes Show response attributes object
  • 401 application/json

    Authorization error

    Hide response attributes Show response attributes object
  • 500 application/json

    Internal server error

    Hide response attributes Show response attributes object
POST /sdapi/txt2img
curl \
 -X POST https://api.itsrose.rest/sdapi/txt2img \
 -H "Content-Type: application/json" \
 -d '{"model_id":"string","prompt":"string","negative_prompt":"string","width":512,"height":512,"samples":1,"num_inference_steps":21,"safety_checker":"yes","safety_checker_type":"sensitive_content_text","enhance_prompt":"yes","seed":"string","guidance_scale":7.5,"panorama":"yes","self_attention":"yes","upscale":"yes","embeddings_model":"string","tomesd":"yes","use_karras_sigmas":"yes","algorithm_type":"dpmsolver+++","vae":"string","lora_strength":"1","lora_model":"string","scheduler":"string","clip_skip":2,"highres_fix":"yes"}'
Request examples
{
  "model_id": "string",
  "prompt": "string",
  "negative_prompt": "string",
  "width": 512,
  "height": 512,
  "samples": 1,
  "num_inference_steps": 21,
  "safety_checker": "yes",
  "safety_checker_type": "sensitive_content_text",
  "enhance_prompt": "yes",
  "seed": "string",
  "guidance_scale": 7.5,
  "panorama": "yes",
  "self_attention": "yes",
  "upscale": "yes",
  "embeddings_model": "string",
  "tomesd": "yes",
  "use_karras_sigmas": "yes",
  "algorithm_type": "dpmsolver+++",
  "vae": "string",
  "lora_strength": "1",
  "lora_model": "string",
  "scheduler": "string",
  "clip_skip": 2,
  "highres_fix": "yes"
}
Response examples (200)
{
  "status": true,
  "message": "success",
  "result": {
    "generation_time": "string",
    "images": [
      "string"
    ],
    "nsfw_content_detected": true,
    "meta": {
      "model_id": "string",
      "prompt": "string",
      "negative_prompt": "string",
      "width": 512,
      "height": 512,
      "samples": 1,
      "num_inference_steps": 21,
      "safety_checker": "yes",
      "safety_checker_type": "sensitive_content_text",
      "enhance_prompt": "yes",
      "seed": "string",
      "guidance_scale": 7.5,
      "panorama": "yes",
      "self_attention": "yes",
      "upscale": "yes",
      "embeddings_model": "string",
      "tomesd": "yes",
      "use_karras_sigmas": "yes",
      "algorithm_type": "dpmsolver+++",
      "vae": "string",
      "lora_strength": "1",
      "lora_model": "string",
      "scheduler": "string",
      "clip_skip": 2,
      "highres_fix": "yes"
    }
  }
}
Response examples (400)
{
  "status": false,
  "message": "string",
  "result": {}
}
Response examples (401)
{
  "status": false,
  "message": "string",
  "result": {}
}
Response examples (500)
{
  "status": false,
  "message": "string",
  "result": {}
}