Img Open English
  1. AI image generation
Img Open English
  • AI image generation
    • sd text2image
      POST
    • sd Image to Image
      POST
    • sd controlnet
      POST
    • QueryModelList
      POST
    • QueryLoralList
      POST
    • QueryVaeList
      POST
    • queryEmbeddingList
      POST
  • task query
    • queryTaskInfoV1.0
      POST
    • queryTaskInfoV2.0
      POST
    • queryImageToolTaskInfo
      POST
  • train model
    • Submit training task
      POST
    • Training result query
      POST
  • image tool
    • Flux text2image
      POST
    • Single Face Swap V1.0
      POST
    • Single Face Swap V2.0
      POST
    • instantID
      POST
    • Face restoration
      POST
    • Super Resolution
      POST
    • image description
      POST
    • Multiple Face Swap
      POST
    • Face Detection
      POST
    • Prompt expansion
      POST
    • Hairstyle changer
      POST
    • Object Removal
      POST
    • Style recognition
      POST
    • Outpainting
      POST
    • CNT preview
      POST
    • background remove
      POST
    • image enlarge
      POST
    • image watermark
      POST
  1. AI image generation

sd text2image

POST
/AIGCImgOpenServ/saas/sd/v2/text2image
img
text to image.create image from text based on trained or on public models

Request

Header Params
X-Request-req-accessKeyId
string 
required
Example:
accessKeyId
X-Request-req-accessKeySecret
string 
required
Example:
accessKeySecret
Body Params application/json
n_iter
integer 
generated batch
optional
batch_size
integer 
Generate quantity per batch
required
Number of images=n_iter*batch_size
steps
integer 
Number of iteration steps
optional
Number of diffusion steps to run
hr_scale
integer 
HD repair times
optional
High-definition restoration multiples
negative_prompt
string 
optional
Suggested words:nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, artifacts, signature, watermark, username, blurry, missing arms, long neck, humpbacked, bad feet
denoising_strength
number 
Noise reduction strength
optional
Noise reduction strength, the value range is 0-1, and the default setting is 0.75. The larger the value, the greater the change in the image. 0 means that the image is almost unchanged, and 1 means that it may deviate seriously from the original image. Generally, this parameter is set in the range of 0.6~0.8;
width
integer 
optional
[128,1024] Width of the image to generate, in pixels, in an increment divisible by 8
height
integer 
optional
[128,1024] Height of the image to generate, in pixels, in an increment divisible by 8
hr_upscaler
string 
optional
Amplifier to use in HD restoration mode
alwayson_scripts
object 
External incoming parameters
required
override_settings
object 
External incoming parameters
optional
sd_model_checkpoint
string 
model code
required
Model code in the reference model list
sd_vae
string 
optional
Use custom vae in generating images
id_task
string 
required
Task id, unique representation, used for query
output_image_format
string 
Output picture format
optional
Output image format, no parameters are required by default, output image format is jpg, and can support input png
ADetailer
object 
adetailer
optional
prompt
string 
required
Text description of the painting. Use lora to query the lora list. Refer to sdLoraFileSimplifyName
enable_hr
boolean 
HD restoration
optional
default:false
seed
string 
random seed
optional
default:-1,random
restore_faces
boolean 
optional
Restore facial defects Applies an additional model that can restore facial defects. Default is false
cfg_scale
number 
optional
How strongly the video sticks to the original image. Use lower values to allow the model more freedom to make changes and higher values to correct motion distortions.Default is false
sampler_index
string 
optional
list["Euler a","Euler","LMS","Heun","DPM2","DPM2 a","DPM++ 2S a","DPM++ 2M","DPM++ SDE","DPM fast","DPM adaptive","LMS Karras","DPM2 Karras","DPM2 a Karras","DPM++ 2S a Karras","DPM++ SDE Karras","DPM++ 2M Karras",]
hr_second_pass_steps
integer 
optional
hr_resize_x
integer 
optional
[128,2048] Width of the image toEnlarged size, in an increment divisible by 8
hr_resize_y
integer 
optional
[128,2048] Height of the image toEnlarged size, in an increment divisible by 8
callbackUrl
string 
optional
The server returns the drawing result. The received response JSON string code = 200 will mark the request as successful, such as {"code":"200"}. Step interval retry 3, 5, 15, 30, 60, 600, 3600 seconds. Retry up to 10 times
Example
{
    "prompt": "{best quality}, {{masterpiece}}, {highres}, original, extremely detailed,incredibly_absurdres,intricate detail,(detailed face),(face:1.2),1girl , kneeling down, from below , crying, sitting, ghost",
    "n_iter": 1,
    "steps": 25,
    "seed":"1221212",
    "restore_faces": false,
    "enable_hr": false,
    "hr_scale": 2,
    "width": 768,
    "height": 768,
    "negative_prompt": "(nsfw:1.5),(nude:1.3), (child Pornography:1.2),molestation,incest,rape,about to be raped,(sex:1.3),uncensored,EasyNegative,(worst quality, low quality:1.4), (((distorted hands))),((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((b&w)), (((duplicate))), ((morbid)), ((mutilated)),poorly drawn face, out of frame, mutation, mutated, (text), signature, monster,watermark,extra fingers,fewer fingers, Wrong hands,wrong fingers,fingers crossed,styled fingers,fingers missed,missed fingers,cheese fingers, chocolate fingers,fingers on fingers,closed fist, fighting fist,fist ,hands with fist,many fists,only hands with wrong fists,fingers crossed,\r\n,",
    "cfg_scale": 27,
    "sampler_index":"DPM++ 2M Karras",
    "hr_second_pass_steps":20,
    "hr_resize_x":1024,
    "hr_resize_y":1024,
    "denoising_strength": 0.55,
    "callbackUrl":"http://127.0.0.1:8087/image/api/callback/sdweb",
    "alwayson_scripts": {
        "sd_model_checkpoint": "revAnimated_v122_7371.safetensors",
        "id_task": "pro1686666",
        "sd_vae": "vae-ft-mse-840000-ema-pruned.ckpt",
        "override_settings": {
            "CLIP_stop_at_last_layers": 2
        },
        "ADetailer": {
            "args": [
                {
                    "ad_model": "None",
                    "ad_prompt": "",
                    "ad_negative_prompt": "",
                    "ad_confidence": 0.3,
                    "ad_mask_min_ratio": 0.0,
                    "ad_mask_max_ratio": 1.0,
                    "ad_dilate_erode": 32,
                    "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": 0,
                    "ad_use_inpaint_width_height": false,
                    "ad_inpaint_width": 512,
                    "ad_inpaint_height": 512,
                    "ad_use_steps": true,
                    "ad_steps": 28,
                    "ad_use_cfg_scale": false,
                    "ad_cfg_scale": 7.0,
                    "ad_use_sampler": false,
                    "ad_sampler": "DPM++ 2M Karras",
                    "ad_use_noise_multiplier": false,
                    "ad_noise_multiplier": 1.0,
                    "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
                }
            ]
        }
    }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.zhiqite.com/AIGCImgOpenServ/saas/sd/v2/text2image' \
--header 'X-Request-req-accessKeyId: accessKeyId' \
--header 'X-Request-req-accessKeySecret: accessKeySecret' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "{best quality}, {{masterpiece}}, {highres}, original, extremely detailed,incredibly_absurdres,intricate detail,(detailed face),(face:1.2),1girl , kneeling down, from below , crying, sitting, ghost",
    "n_iter": 1,
    "steps": 25,
    "seed":"1221212",
    "restore_faces": false,
    "enable_hr": false,
    "hr_scale": 2,
    "width": 768,
    "height": 768,
    "negative_prompt": "(nsfw:1.5),(nude:1.3), (child Pornography:1.2),molestation,incest,rape,about to be raped,(sex:1.3),uncensored,EasyNegative,(worst quality, low quality:1.4), (((distorted hands))),((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((b&w)), (((duplicate))), ((morbid)), ((mutilated)),poorly drawn face, out of frame, mutation, mutated, (text), signature, monster,watermark,extra fingers,fewer fingers, Wrong hands,wrong fingers,fingers crossed,styled fingers,fingers missed,missed fingers,cheese fingers, chocolate fingers,fingers on fingers,closed fist, fighting fist,fist ,hands with fist,many fists,only hands with wrong fists,fingers crossed,\r\n,",
    "cfg_scale": 27,
    "sampler_index":"DPM++ 2M Karras",
    "hr_second_pass_steps":20,
    "hr_resize_x":1024,
    "hr_resize_y":1024,
    "denoising_strength": 0.55,
    "callbackUrl":"http://127.0.0.1:8087/image/api/callback/sdweb",
    "alwayson_scripts": {
        "sd_model_checkpoint": "revAnimated_v122_7371.safetensors",
        "id_task": "pro1686666",
        "sd_vae": "vae-ft-mse-840000-ema-pruned.ckpt",
        "override_settings": {
            "CLIP_stop_at_last_layers": 2
        },
        "ADetailer": {
            "args": [
                {
                    "ad_model": "None",
                    "ad_prompt": "",
                    "ad_negative_prompt": "",
                    "ad_confidence": 0.3,
                    "ad_mask_min_ratio": 0.0,
                    "ad_mask_max_ratio": 1.0,
                    "ad_dilate_erode": 32,
                    "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": 0,
                    "ad_use_inpaint_width_height": false,
                    "ad_inpaint_width": 512,
                    "ad_inpaint_height": 512,
                    "ad_use_steps": true,
                    "ad_steps": 28,
                    "ad_use_cfg_scale": false,
                    "ad_cfg_scale": 7.0,
                    "ad_use_sampler": false,
                    "ad_sampler": "DPM++ 2M Karras",
                    "ad_use_noise_multiplier": false,
                    "ad_noise_multiplier": 1.0,
                    "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
                }
            ]
        }
    }
}'

Responses

🟢200OK
application/json
Body
code
string 
status code
required
Success=200 Fail=400
msg
string 
Return status information
required
data
object 
required
task_id
string 
required
task_id=id_task
Example
{
    "code": "200",
    "msg": "success",
    "data": {
        "task_id": "pro1686666"
    }
}
Modified at 2024-08-08 10:19:42
Next
sd Image to Image
Built with