当前位置:   article > 正文

comfyui api接口文档

comfyui api

comfyui-api文档

需要apifox原件的联系我v:ai_009966
码云地址:
https://ext.dcloud.net.cn/plugin?id=12603

1、GET /history

获取所有历史任务数据

请求参数

名称位置类型必选说明
prompt_idquerystring8b918008-751f-414c-9575-7174e841ceac

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

2、GET /embeddings

获取一个列表

状态码状态码含义说明数据模型
200OK成功Inline

3、GET /history/{prompt_id}

获取历史任务数据(根据任务id获取历史数据)

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

4、GET /extensions

获取扩展节点文件列表

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

5、POST /upload/image

上传图片接口

Body 请求参数

image: string

  • 1
  • 2

请求参数

名称位置类型必选说明
bodybodyobjectnone
» imagebodystring(binary)图片将以二进制格式发送到服务器
{
  "name": "aaa (7).webp",
  "subfolder": "",
  "type": "input"
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

6、POST /upload/mask

上传蒙版图片接口,一般用于局部重绘

Body 请求参数

image: string
type: input
subfolder: clipspace
original_ref: "{“filename”:”下载.png”,”type”:”input”,”subfolder”:”clipspace”}"

  • 1
  • 2
  • 3
  • 4
  • 5

请求参数

名称位置类型必选说明
bodybodyobjectnone
» imagebodystring(binary)图片将以二进制格式发送到服务器
» typebodystring上传图片的目标文件夹
» subfolderbodystring上传图片的目标子文件夹
» original_refbodystring
{
  "name": "下载.png",
  "subfolder": "clipspace",
  "type": "input"
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

7、GET /view

图片的在线预览接口(上传图像,生图图像,蒙蔽图像,均通过该接口预览)

请求参数

名称位置类型必选说明
filenamequerystring图片名称
typequerystring图片存放位置的文件夹(input为长传图片,output为生成的图片)
subfolderquerystring子文件夹(没有可不填)
previewquerystring预览
channelquerystring

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

8、POST /view_metadata/{folder_name}

请求参数

名称位置类型必选说明
folder_namepathstringnone

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

9、GET /system_stats

系统统计信息接口

{
    "system": {
        "os": "nt",
        "python_version": "3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]",
        "embedded_python": true
    },
    "devices": [
        {
            "name": "cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync",
            "type": "cuda",
            "index": 0,
            "vram_total": 25769279488,
            "vram_free": 22114014558,
            "torch_vram_total": 2348810240,
            "torch_vram_free": 104404318
        }
    ]
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

10、GET /prompt

获取服务器当前剩余任务列队的数量

{
  "exec_info": {
    "queue_remaining": 1
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

11、POST /prompt

绘图任务的下发接口,此接口只做任务下发,返回任务ID信息。
此接口只做任务下发,返回任务ID信息。

Body 请求参数

{
  "client_id": "533ef3a3-39c0-4e39-9ced-37d290f371f8",
  "prompt": {
    "3": {
      "inputs": {
        "seed": 764714814161513,
        "steps": 26,
        "cfg": 5,
        "sampler_name": "dpmpp_3m_sde_gpu",
        "scheduler": "karras",
        "denoise": 1,
        "model": [
          "40",
          0
        ],
        "positive": [
          "49",
          0
        ],
        "negative": [
          "6",
          0
        ],
        "latent_image": [
          "5",
          0
        ]
      },
      "class_type": "KSampler"
    },
    "5": {
      "inputs": {
        "width": 1024,
        "height": 768,
        "batch_size": 1
      },
      "class_type": "EmptyLatentImage"
    },
    "6": {
      "inputs": {
        "text": "",
        "clip": [
          "40",
          1
        ]
      },
      "class_type": "CLIPTextEncode"
    },
    "8": {
      "inputs": {
        "samples": [
          "3",
          0
        ],
        "vae": [
          "40",
          2
        ]
      },
      "class_type": "VAEDecode"
    },
    "9": {
      "inputs": {
        "filename_prefix": "ComfyUI",
        "images": [
          "8",
          0
        ]
      },
      "class_type": "SaveImage"
    },
    "13": {
      "inputs": {
        "clip_vision": [
          "39",
          0
        ],
        "image": [
          "34",
          0
        ]
      },
      "class_type": "CLIPVisionEncode"
    },
    "19": {
      "inputs": {
        "strength": 1,
        "noise_augmentation": 0,
        "conditioning": [
          "42",
          0
        ],
        "clip_vision_output": [
          "13",
          0
        ]
      },
      "class_type": "unCLIPConditioning"
    },
    "34": {
      "inputs": {
        "image": "clipspace/clipspace-mask-1645940.7000000002.png [input]",
        "choose file to upload": "image"
      },
      "class_type": "LoadImage"
    },
    "36": {
      "inputs": {
        "clip_vision": [
          "39",
          0
        ],
        "image": [
          "38",
          0
        ]
      },
      "class_type": "CLIPVisionEncode"
    },
    "37": {
      "inputs": {
        "strength": 0.75,
        "noise_augmentation": 0,
        "conditioning": [
          "19",
          0
        ],
        "clip_vision_output": [
          "36",
          0
        ]
      },
      "class_type": "unCLIPConditioning"
    },
    "38": {
      "inputs": {
        "image": "beijing1 (2).webp",
        "choose file to upload": "image"
      },
      "class_type": "LoadImage"
    },
    "39": {
      "inputs": {
        "clip_name": "clip_vision_g.safetensors"
      },
      "class_type": "CLIPVisionLoader"
    },
    "40": {
      "inputs": {
        "ckpt_name": "sd_xl_base_1.0.safetensors"
      },
      "class_type": "CheckpointLoaderSimple"
    },
    "42": {
      "inputs": {
        "conditioning": [
          "6",
          0
        ]
      },
      "class_type": "ConditioningZeroOut"
    },
    "43": {
      "inputs": {
        "safe": "enable"
      },
      "class_type": "HEDPreprocessor"
    },
    "44": {
      "inputs": {
        "safe": "enable",
        "image": [
          "34",
          0
        ]
      },
      "class_type": "HEDPreprocessor"
    },
    "45": {
      "inputs": {
        "images": [
          "44",
          0
        ]
      },
      "class_type": "PreviewImage"
    },
    "46": {
      "inputs": {
        "control_net_name": "control-lora-depth-rank256.safetensors"
      },
      "class_type": "ControlNetLoader"
    },
    "47": {
      "inputs": {
        "image": [
          "34",
          0
        ]
      },
      "class_type": "ScribblePreprocessor"
    },
    "48": {
      "inputs": {
        "images": [
          "47",
          0
        ]
      },
      "class_type": "PreviewImage"
    },
    "49": {
      "inputs": {
        "strength": 0.5,
        "conditioning": [
          "37",
          0
        ],
        "control_net": [
          "46",
          0
        ],
        "image": [
          "47",
          0
        ]
      },
      "class_type": "ControlNetApply"
    }
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231

请求参数

名称位置类型必选说明
bodybodyobjectnone
{
  "prompt_id": "352c1fc4-7382-4c4a-965f-583c4b126a1b",
  "number": 38,
  "node_errors": {}
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

12、GET /object_info

获取系统中所有组件以及可用参数

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

13、GET /object_info/{node_class}

根据组件名称获取系统中组件参数

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

15、POST /queue

删除列队/无返回信息则为成功

Body 请求参数

{
  "delete": "string"
}
  • 1
  • 2
  • 3

请求参数

名称位置类型必选说明
bodybodyobjectnone
» deletebodystring包含任务id的列表

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

16、GET /interrupt

取消当前任务/不需任何参数

返回结果

状态码状态码含义说明数据模型
200OK成功Inline
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号