图像到图像
开发环境
开发环境
POST
/v2/img2img
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v2/img2img' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"extra": {
"enable_nsfw_detection": false
},
"prompt": "Photographic of a woman sitting at a cafe. 35mm photograph, film, bokeh, professional, 4k, highly detailed",
"negative_prompt": "ng_deepnegative_v1_75t, badhandv4, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), watermark",
"sampler_name": "Euler a",
"batch_size": 1,
"n_iter": 1,
"steps": 20,
"cfg_scale": 7,
"seed": -1,
"height": 1024,
"width": 1024,
"model_name": "sd_xl_base_1.0.safetensors",
"init_images": [
"{{base64 encoded image}}"
],
"denoising_strength": 0.5,
"restore_faces": false,
"sd_vae": "sdxl_vae.safetensors",
"clip_skip": 1,
"mask": "",
"mask_blur": null,
"resize_mode": null,
"image_cfg_scale": null,
"inpainting_fill": null,
"inpaint_full_res": null,
"inpaint_full_res_padding": null,
"inpainting_mask_invert": null,
"initial_noise_multiplier": null,
"img_expire_ttl": null,
"sd_refiner": {
"checkpoint": "sd_xl_refiner_1.0.safetensors",
"switch_at": 1
},
"controlnet_units": [
{
"model": "t2i-adapter_xl_sketch",
"weight": 0.5,
"input_image": "{{base64 encoded image}}",
"module": "none",
"control_mode": 0,
"mask": "",
"resize_mode": null,
"processor_res": null,
"threshold_a": null,
"threshold_b": null,
"guidance_start": null,
"guidance_end": null,
"pixel_perfect": false,
"lowvram": true
}
],
"controlnet_no_detectmap": true
}'
响应示例响应示例
{
"code": null,
"msg": "",
"data": {
"task_id": "",
"warn": ""
}
}
请求参数
Header 参数
Authorization
string
必需
Content-Type
string
必需
示例值:
application/json
Body 参数application/json