Img Open
  1. 绘图信息
Img Open
  • CV任务状态码信息附录
  • 绘图信息
    • sd 文生图-v2
      POST
    • sd 文生图-v3
      POST
    • sd 图生图-v2
      POST
    • sd 图生图-v3
      POST
    • sd 局部重绘-v1
      POST
    • sd controlnet 生图
      POST
    • 查询模型列表
      POST
    • 查询lora列表
      POST
    • 查询vae列表
      POST
    • 查询Embedding列表
      POST
  • 绘图任务
    • 查询归档任务详情
      POST
    • 查询任务实时状态 (百分比/进度条/中间图)
      POST
    • 绘图工具任务查询
      POST
  • 模型训练
    • 提交训练任务
      POST
    • 训练结果回调
      POST
  • 绘图工具
    • Flux文生图
      POST
    • 个性化写真
      POST
    • 高级换脸
      POST
    • 超级换脸 faceFusion
      POST
    • 面部检测(脸部提取) faceDetection
      POST
    • 换发型
      POST
    • 提示词扩写
      POST
    • sd prompts优化
      POST
    • 提示词扩写优化
      POST
    • 图转文
      POST
    • 超分辨
      POST
    • 换脸 roop
      POST
    • 面部修复
      POST
    • 智能擦除
      POST
    • 风格识别
      POST
    • 图片外扩
      POST
    • CNT预览
      POST
    • 背景去除
      POST
    • 图片扩大
      POST
    • 给图片加水印
      POST
    • 图片去水印
      POST
    • 图生视频
      POST
  • 图片检测
    • 异步图片检测
  • 视频工具
    • 视频加水印
    • 移除视频背景
    • 视频比例调整
    • 扩大视频图像
    • 视频补帧
    • 视频格式转换
  • 音频工具
    • 人声分离
    • 文生音乐
    • 文字配音
    • 生成歌词
  • 翻译
    • 翻译
  1. 绘图信息

sd 图生图-v2

POST
/AIGCImgOpenServ/saas/sd/v2/image2image
img
根据输入的图片和prompt等参数生成图片

请求参数

Header 参数
X-Request-req-accessKeyId
string 
必需
示例值:
accessKeyId
X-Request-req-accessKeySecret
string 
必需
示例值:
accessKeySecret
Body 参数application/json
n_iter
integer 
生成的批次
可选
batch_size
integer 
每批次生成数量
必需
最终生图数量=n_iter*batch_size
steps
integer 
迭代步数
可选
hr_scale
integer 
高清修复倍数
可选
negative_prompt
string 
负向描述词
可选
建议词: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 
重绘幅度
可选
[0,1] 建议 0.75
width
integer 
图片宽度
可选
[128,1024] 且为8的倍数
height
integer 
图片高度
可选
[128,1024] 且为8的倍数
hr_upscaler
string 
要使用的放大器
可选
高清修复模式下要使用的放大器
alwayson_scripts
object 
外部传入参数
必需
override_settings
object 
外部传入参数
可选
sd_model_checkpoint
string 
模型编码,需要带着
必需
参考模型列表中的模型编码
sd_vae
string 
变分自动编码器
可选
提升出图效果
output_image_format
string 
输出图片格式
可选
输出图片格式,默认无需传参,输出图片格式jpg,可支持输入png
id_task
string 
任务id
必需
ADetailer
object 
adetailer插件
可选
image_link
string 
用户上传的图片的 url 链接
必需
mask_link
string 
用户上传涂抹后的 url 链接
可选
仅支持神器涂抹功能传入
prompt
string 
正向描述词
必需
绘画的文本描述(支持中文和英文描述),使用lora,可以查询lora列表,参考sdLoraFileSimplifyName
enable_hr
boolean 
高清修复
可选
默认false
seed
string 
随机种子
可选
默认-1就是随机
restore_faces
boolean 
脸部修复
可选
cfg_scale
integer 
可选
sampler_index
string 
采样方式
可选
可选["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 
高清修复的后面步骤
可选
hr_resize_x
integer 
高清修复后的高度
可选
[128,2048] 且为8的倍数
hr_resize_y
integer 
高清修复后的宽度
可选
[128,2048] 且为8的倍数
resize_mode
integer 
resize模式
可选
可选[0, 1, 2, 3],分别对应webui中["Just Resize", "Crop and Resize", "Resize and Fill", "Just resize (latent upscale)"]
mask_blur
integer 
蒙版模糊系数
可选
数值区间[0, 64],精度为1;与webui中Mask blur对应,当mask_blur存在时,传入的mask_blur_x和mask_blur_y失效,mask_blur_x=mask_blur_y=mask_blur
mask_blur_x
integer 
横向蒙版模糊系数
可选
数值区间[0, 64],精度为1;大于0时,构造kernel_size,在横向上进行高斯模糊操作
mask_blur_y
integer 
纵向蒙版模糊系数
可选
数值区间[0, 64],精度为1;大于0时,构造kernel_size,在纵向上进行高斯模糊操作
inpainting_fill
integer 
蒙版覆盖内容
可选
可选[0, 1, 2, 3],对应webui中Masked content可选的设置['fill', 'original', 'latent noise', 'latent nothing']
inpaint_full_res
boolean 
重绘区域
可选
与webui中Inpaint area对应,true对应Only masked,false对应Whole picture
inpaint_full_res_padding
integer 
边缘预留像素
可选
数值区间[0, 256],精度为4;重绘内容边缘有多少像素和原图重叠,可以起到缓冲带作用使得过渡更自然,只有inpaint_full_res为true时有效
inpainting_mask_invert
integer 
蒙版模式
可选
与webui中Mask mode对应,0表示Inpaint masked,1表示Inpaint not masked;当该值不为0时,会将蒙版mask图片进行像素值反转
initial_noise_multiplier
number 
噪声乘法器
可选
数值区间[0.5, 1.5],精度为0.01;该值为1.0时等价于不设置,图生图每步采样的向量值会乘以该值,该值极大影响生成图片质量,建议不传入
image_cfg_scale
number 
可选
数字区间[0, 3.0],精度为0.05
示例
{
    "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,
    "alwayson_scripts": {
        "sd_model_checkpoint": "revAnimated_v122_7371.safetensors",
        "image_link": "https://paintcdn.glutinoust.com/uploads/20230610/62491f852782a40aebd13f8838f79c69.png",
        "id_task": "pro1686666",
        "sd_vae": "vae-ft-mse-840000-ema-pruned.ckpt",
        "override_settings": {
            "CLIP_stop_at_last_layers": 2
        }
    
    }
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.zhiqite.com/AIGCImgOpenServ/saas/sd/v2/image2image' \
--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,
    "alwayson_scripts": {
        "sd_model_checkpoint": "revAnimated_v122_7371.safetensors",
        "image_link": "https://paintcdn.glutinoust.com/uploads/20230610/62491f852782a40aebd13f8838f79c69.png",
        "id_task": "pro1686666",
        "sd_vae": "vae-ft-mse-840000-ema-pruned.ckpt",
        "override_settings": {
            "CLIP_stop_at_last_layers": 2
        }
    
    }
}'

返回响应

🟢200成功
application/json
Body
code
string 
返回状态码
必需
成功=200 失败=400
msg
string 
返回状态信息
必需
data
object 
必需
task_id
string 
业务id
必需
此task_id和请求里的id_task是一个值
示例
{
    "code": "200",
    "msg": "success",
    "data": {
        "task_id": "pro1686666"
    }
}
修改于 2024-10-18 01:41:22
上一页
sd 文生图-v3
下一页
sd 图生图-v3
Built with