ai-gateway
  1. Stable Diffusion
ai-gateway
  • Suno
    • Suno Generate
      POST
    • Suno Feed
      GET
    • Suno Concat
      POST
    • Suno Generate (Extend)
      POST
  • Stable Diffusion
    • Stable Diffusion 文生图
      POST
    • Stable Diffusion 图生图
      POST
    • ReActor image
      POST
  • Create chat completion
    POST
  • Create chat completion with stream
    POST
  • Create image
    POST
  • Create speech
    POST
  • Create transcription
    POST
  • asr
    POST
  • asr Copy
    POST
  • Create transcription Copy
    POST
  1. Stable Diffusion

Stable Diffusion 图生图

POST
/v1/sdapi/v1/img2img

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Body 参数application/json
model
string 
必需
sampler_name
string 
必需
steps
integer 
必需
cfg_scale
integer 
必需
width
integer 
必需
height
integer 
必需
restore_faces
boolean 
必需
denoising_strength
number 
必需
init_images
array[string]
必需
alwayson_scripts
object 
必需
reactor
object 
必需
示例
{
    "model": "juggernautXL_version2",
    "sampler_name": "DPM++ SDE Karras",
    "steps": 20,
    "cfg_scale": 7,
    "width": 512,
    "height": 768,
    "restore_faces": false,
    "denoising_strength": 0.01,
    "init_images": [
        "source_img_base64"
    ],
    "alwayson_scripts": {
        "reactor": {
            "args": [
                "target_img_base64",
                true,
                "0",
                "0",
                "inswapper_128.onnx",
                "CodeFormer",
                1,
                true,
                "4x_NMKD-Superscale-SP_178000_G",
                1.5,
                1,
                false,
                true,
                1,
                0,
                0,
                false,
                0.5,
                false,
                false,
                "CUDA",
                true,
                0,
                "elena.safetensors",
                "C:\\PATH_TO_FACES_IMAGES",
                null,
                true,
                true,
                0.6,
                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.aigateway.work/v1/sdapi/v1/img2img' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "juggernautXL_version2",
    "sampler_name": "DPM++ SDE Karras",
    "steps": 20,
    "cfg_scale": 7,
    "width": 512,
    "height": 768,
    "restore_faces": false,
    "denoising_strength": 0.01,
    "init_images": [
        "source_img_base64"
    ],
    "alwayson_scripts": {
        "reactor": {
            "args": [
                "target_img_base64",
                true,
                "0",
                "0",
                "inswapper_128.onnx",
                "CodeFormer",
                1,
                true,
                "4x_NMKD-Superscale-SP_178000_G",
                1.5,
                1,
                false,
                true,
                1,
                0,
                0,
                false,
                0.5,
                false,
                false,
                "CUDA",
                true,
                0,
                "elena.safetensors",
                "C:\\PATH_TO_FACES_IMAGES",
                null,
                true,
                true,
                0.6,
                2
            ]
        }
    }
}'

返回响应

🟢200成功
application/json
Body
object {0}
示例
{
    "images": [
        "img_base64",
        "CodeFormer",
        1,
        true,
        "4x_NMKD-Superscale-SP_178000_G",
        1.5,
        1,
        false,
        true,
        1,
        0,
        0,
        false,
        0.5,
        false,
        false,
        "CUDA",
        true,
        0,
        "elena.safetensors",
        "C:\\PATH_TO_FACES_IMAGES",
        null,
        true,
        true,
        0.6,
        2
    ]
}
}
},
"info": "{\"prompt\": \"\", \"all_prompts\": [\"\"], \"negative_prompt\": \"\", \"all_negative_prompts\": [\"\"], \"seed\": 3299167597, \"all_seeds\": [3299167597], \"subseed\": 3983809766, \"all_subseeds\": [3983809766], \"subseed_strength\": 0, \"width\": 512, \"height\": 768, \"sampler_name\": \"DPM++ SDE Karras\", \"cfg_scale\": 7.0, \"steps\": 20, \"batch_size\": 1, \"restore_faces\": false, \"face_restoration_model\": null, \"sd_model_name\": \"juggernautXL_version2\", \"sd_model_hash\": \"700528894b\", \"sd_vae_name\": null, \"sd_vae_hash\": null, \"seed_resize_from_w\": -1, \"seed_resize_from_h\": -1, \"denoising_strength\": 0.01, \"extra_generation_params\": {}, \"index_of_first_image\": 0, \"infotexts\": [\"Steps: 20, Sampler: DPM++ SDE Karras, CFG scale: 7.0, Seed: 3299167597, Size: 512x768, Model hash: 700528894b, Model: juggernautXL_version2, Denoising strength: 0.01, Clip skip: 2, Version: v1.7.0\"], \"styles\": [], \"job_timestamp\": \"20240314163141\", \"clip_skip\": 2, \"is_using_inpainting_conditioning\": false, \"version\": \"v1.7.0\"}"
}
修改于 2024-04-23 10:58:30
上一页
Stable Diffusion 文生图
下一页
ReActor image
Built with