当前位置:   article > 正文

【ComfyUI的API接口调用示例】_comfyui api调用例子

comfyui api调用例子

ComfyUI的API接口调用示例


本文目的

本文调用接口示例主要指导需要调用ComfyUI的开发者如何调用ComfyUI官方的API接口提交任务、查询历史、获取绘画视频结果等。

阅读本文的前提是你本地已经安装了ComfyUI,并且对工作流绘画和生成视频已经有所了解。注意如图右边栏目保存API格式的工作流。
在这里插入图片描述

ComfyUI的测试地址

本地comfyui测试地址:http://127.0.0.1:8188

POST /upload/mask

POST /upload/mask

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

Body 请求参数

image: file://C:\Users\dourungeng\Pictures\640.png
type: input
subfolder: clipspace
original_ref: "{“filename”:”640.png”,”type”:”input”,”subfolder”:”clipspace”}"

  • 1
  • 2
  • 3
  • 4
  • 5

请求参数

名称位置类型必选说明
bodybodyobjectnone
» imagebodystring(binary)图片将以二进制格式发送到服务器
» typebodystring上传图片的目标文件夹
» subfolderbodystring上传图片的目标子文件夹
» original_refbodystringnone

返回成功示例

{
  "name": "640.png",
  "subfolder": "clipspace",
  "type": "input"
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» namestringtruenonenone
» subfolderstringtruenonenone
» typestringtruenonenone

POST /upload/image

POST /upload/image

上传图片接口

Body 请求参数

image: string

  • 1
  • 2

请求参数

名称位置类型必选说明
bodybodyobjectnone
» imagebodystring(binary)图片将以二进制格式发送到服务器

返回成功示例

{
  "name": "0e9f-hiixpup5792613.jpg",
  "subfolder": "",
  "type": "input"
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» namestringtruenonenone
» subfolderstringtruenonenone
» typestringtruenonenone

POST /prompt

POST /prompt

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

Body 请求参数

{
  "client_id": "533ef3a3-39c0-4e39-9ced-37d290f371f8",
  "prompt": {
    "3": {
      "inputs": {
        "seed": 0,
        "steps": 20,
        "cfg": 2.5,
        "sampler_name": "euler",
        "scheduler": "karras",
        "denoise": 1,
        "model": [
          "14",
          0
        ],
        "positive": [
          "12",
          0
        ],
        "negative": [
          "12",
          1
        ],
        "latent_image": [
          "12",
          2
        ]
      },
      "class_type": "KSampler",
      "_meta": {
        "title": "K采样器"
      }
    },
    "8": {
      "inputs": {
        "samples": [
          "3",
          0
        ],
        "vae": [
          "15",
          2
        ]
      },
      "class_type": "VAEDecode",
      "_meta": {
        "title": "VAE解码"
      }
    },
    "12": {
      "inputs": {
        "width": 1024,
        "height": 576,
        "video_frames": 14,
        "motion_bucket_id": 32,
        "fps": 6,
        "augmentation_level": 0,
        "clip_vision": [
          "15",
          1
        ],
        "init_image": [
          "23",
          0
        ],
        "vae": [
          "15",
          2
        ]
      },
      "class_type": "SVD_img2vid_Conditioning",
      "_meta": {
        "title": "SVD_图像到视频_条件"
      }
    },
    "14": {
      "inputs": {
        "min_cfg": 1,
        "model": [
          "15",
          0
        ]
      },
      "class_type": "VideoLinearCFGGuidance",
      "_meta": {
        "title": "线性CFG引导"
      }
    },
    "15": {
      "inputs": {
        "ckpt_name": "svd_xt_1_1.safetensors"
      },
      "class_type": "ImageOnlyCheckpointLoader",
      "_meta": {
        "title": "Checkpoint加载器(仅图像)"
      }
    },
    "23": {
      "inputs": {
        "image": "C:\\Users\\dourungeng\\Pictures\\elephant1.png [input]",
        "upload": "image"
      },
      "class_type": "LoadImage",
      "_meta": {
        "title": "加载图像"
      }
    },
    "24": {
      "inputs": {
        "frame_rate": 6,
        "loop_count": 0,
        "filename_prefix": "SVD_img2vid",
        "format": "image/gif",
        "pingpong": false,
        "save_output": true,
        "images": [
          "8",
          0
        ]
      },
      "class_type": "VHS_VideoCombine",
      "_meta": {
        "title": "合并为视频"
      }
    }
  }
}
  • 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

请求参数

名称位置类型必选说明
bodybodyobjectnone
» client_idbodystringnone
» promptbodyobjectnone

返回成功示例

{
  "prompt_id": "3604be44-eb6b-4d54-b82d-62d31a6c0b36",
  "number": 8,
  "node_errors": {}
}
  • 1
  • 2
  • 3
  • 4
  • 5

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» prompt_idstringtruenonenone
» numberintegertruenonenone
» node_errorsobjecttruenonenone

GET /prompt

GET /prompt

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

返回成功示例

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

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» exec_infoobjecttruenonenone
»» queue_remainingintegertruenonenone

GET /view

GET /view

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

请求参数

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

返回示例

成功

返回结果

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

返回数据结构

GET /queue

GET /queue

获取任务队列数量

返回示例

成功

{
  "queue_running": [],
  "queue_pending": []
}
  • 1
  • 2
  • 3
  • 4

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» queue_running[string]truenonenone
» queue_pending[string]truenonenone

POST /queue

POST /queue

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

Body 请求参数

{
  "clear": true
}
  • 1
  • 2
  • 3

请求参数

名称位置类型必选说明
bodybodyobjectnone

返回示例

200 Response

返回结果

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

返回数据结构

POST /interrupt

POST /interrupt

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

返回示例

200 Response

返回结果

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

返回数据结构

GET /history/{prompt_id}

GET /history/39d61fa4-58a4-4f61-a547-caab0f4c3a53

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

返回成功示例

{
  "39d61fa4-58a4-4f61-a547-caab0f4c3a53": {
    "prompt": [
      10,
      "39d61fa4-58a4-4f61-a547-caab0f4c3a53",
      {
        "3": {
          "inputs": {
            "seed": 687973405480854,
            "steps": 30,
            "cfg": 8,
            "sampler_name": "dpmpp_2m",
            "scheduler": "karras",
            "denoise": 1,
            "model": [
              "4",
              0
            ],
            "positive": [
              "6",
              0
            ],
            "negative": [
              "7",
              0
            ],
            "latent_image": [
              "5",
              0
            ]
          },
          "class_type": "KSampler",
          "_meta": {
            "title": "K采样器"
          }
        },
        "4": {
          "inputs": {
            "ckpt_name": "sdxl-动漫二次元_2.0.safetensors"
          },
          "class_type": "CheckpointLoaderSimple",
          "_meta": {
            "title": "Checkpoint加载器(简易)"
          }
        },
        "5": {
          "inputs": {
            "width": 512,
            "height": 512,
            "batch_size": 1
          },
          "class_type": "EmptyLatentImage",
          "_meta": {
            "title": "空Latent"
          }
        },
        "6": {
          "inputs": {
            "text": "1girl,flower,outdoors,solo,dress,long hair,closed eyes,sky,holding,smile,cloud,open mouth,field,blush,day,blue sky,white flower,holding flower,flower field,short sleeves,teeth,blue dress,petals,:d,facing viewer,grey hair,floating hair,wind,happy,^_^,daisy,upper teeth only,white dress,",
            "clip": [
              "4",
              1
            ]
          },
          "class_type": "CLIPTextEncode",
          "_meta": {
            "title": "CLIP文本编码器"
          }
        },
        "7": {
          "inputs": {
            "text": "(worst quality, low quality),deformed,distorted,disfigured,doll,poorly drawn,bad anatomy,wrong anatomy,",
            "clip": [
              "4",
              1
            ]
          },
          "class_type": "CLIPTextEncode",
          "_meta": {
            "title": "CLIP文本编码器"
          }
        },
        "8": {
          "inputs": {
            "samples": [
              "3",
              0
            ],
            "vae": [
              "4",
              2
            ]
          },
          "class_type": "VAEDecode",
          "_meta": {
            "title": "VAE解码"
          }
        },
        "9": {
          "inputs": {
            "filename_prefix": "ComfyUI",
            "images": [
              "8",
              0
            ]
          },
          "class_type": "SaveImage",
          "_meta": {
            "title": "保存图像"
          }
        }
      },
      {
        "client_id": "533ef3a3-39c0-4e39-9ced-37d290f371f8"
      },
      [
        "9"
      ]
    ],
    "outputs": {
      "9": {
        "images": [
          {
            "filename": "ComfyUI_00138_.png",
            "subfolder": "",
            "type": "output"
          }
        ]
      }
    },
    "status": {
      "status_str": "success",
      "completed": true,
      "messages": [
        [
          "execution_start",
          {
            "prompt_id": "39d61fa4-58a4-4f61-a547-caab0f4c3a53"
          }
        ],
        [
          "execution_cached",
          {
            "nodes": [],
            "prompt_id": "39d61fa4-58a4-4f61-a547-caab0f4c3a53"
          }
        ]
      ]
    }
  }
}
  • 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

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» 39d61fa4-58a4-4f61-a547-caab0f4c3a53objecttruenone下发任务prompt_id
»» prompt[object]truenone下发任务的api工作流的原始提交参数
»» outputs[object]truenone输出的结果
»» status[object]truenone任务状态

GET /history

GET /history

获取历史任务列表

返回成功示例

{
    "d40751e8-3e96-472f-a818-90d36d06faf1": {
        "prompt": [
            0,
            "d40751e8-3e96-472f-a818-90d36d06faf1", {
                "3": {
                    "inputs": {
                        "seed": 0,
                        "steps": 30,
                        "cfg": 8,
                        "sampler_name": "dpmpp_2m",
                        "scheduler": "karras",
                        "denoise": 1,
                        "model": [
                            "4",
                            0
                        ],
                        "positive": [
                            "6",
                            0
                        ],
                        "negative": [
                            "7",
                            0
                        ],
                        "latent_image": [
                            "5",
                            0
                        ]
                    },
                    "class_type": "KSampler",
                    "_meta": {
                        "title": "K采样器"
                    }
                },
                "4": {
                    "inputs": {
                        "ckpt_name": "sdxl-动漫二次元_2.0.safetensors"
                    },
                    "class_type": "CheckpointLoaderSimple",
                    "_meta": {
                        "title": "Checkpoint加载器(简易)"
                    }
                },
                "5": {
                    "inputs": {
                        "width": 512,
                        "height": 512,
                        "batch_size": 1
                    },
                    "class_type": "EmptyLatentImage",
                    "_meta": {
                        "title": "空Latent"
                    }
                },
                "6": {
                    "inputs": {
                        "text": "1girl,flower,outdoors,solo,dress,long hair,closed eyes,sky,holding,smile,cloud,open mouth,field,blush,day,blue sky,white flower,holding flower,flower field,short sleeves,teeth,blue dress,petals,:d,facing viewer,grey hair,floating hair,wind,happy,^_^,daisy,upper teeth only,white dress,",
                        "clip": [
                            "4",
                            1
                        ]
                    },
                    "class_type": "CLIPTextEncode",
                    "_meta": {
                        "title": "CLIP文本编码器"
                    }
                },
                "7": {
                    "inputs": {
                        "text": "(worst quality, low quality),deformed,distorted,disfigured,doll,poorly drawn,bad anatomy,wrong anatomy,",
                        "clip": [
                            "4",
                            1
                        ]
                    },
                    "class_type": "CLIPTextEncode",
                    "_meta": {
                        "title": "CLIP文本编码器"
                    }
                },
                "8": {
                    "inputs": {
                        "samples": [
                            "3",
                            0
                        ],
                        "vae": [
                            "4",
                            2
                        ]
                    },
                    "class_type": "VAEDecode",
                    "_meta": {
                        "title": "VAE解码"
                    }
                },
                "9": {
                    "inputs": {
                        "filename_prefix": "ComfyUI",
                        "images": [
                            "8",
                            0
                        ]
                    },
                    "class_type": "SaveImage",
                    "_meta": {
                        "title": "保存图像"
                    }
                }
            }, {
                "extra_pnginfo": {
                    "workflow": {
                        "last_node_id": 9,
                        "last_link_id": 9,
                        "nodes": [{
                                "id": 5,
                                "type": "EmptyLatentImage",
                                "pos": [
                                    473,
                                    609
                                ],
                                "size": {
                                    "0": 315,
                                    "1": 106
                                },
                                "flags": {},
                                "order": 0,
                                "mode": 0,
                                "outputs": [{
                                        "name": "LATENT",
                                        "type": "LATENT",
                                        "links": "[Object]",
                                        "slot_index": 0,
                                        "label": "Latent"
                                    }
                                ],
                                "properties": {
                                    "Node name for S&R": "EmptyLatentImage"
                                },
                                "widgets_values": [
                                    512,
                                    512,
                                    1
                                ]
                            }, {
                                "id": 8,
                                "type": "VAEDecode",
                                "pos": [
                                    1209,
                                    188
                                ],
                                "size": {
                                    "0": 210,
                                    "1": 46
                                },
                                "flags": {},
                                "order": 5,
                                "mode": 0,
                                "inputs": [{
                                        "name": "samples",
                                        "type": "LATENT",
                                        "link": 7,
                                        "label": "Latent"
                                    }, {
                                        "name": "vae",
                                        "type": "VAE",
                                        "link": 8,
                                        "label": "VAE"
                                    }
                                ],
                                "outputs": [{
                                        "name": "IMAGE",
                                        "type": "IMAGE",
                                        "links": "[Object]",
                                        "slot_index": 0,
                                        "label": "图像"
                                    }
                                ],
                                "properties": {
                                    "Node name for S&R": "VAEDecode"
                                }
                            }, {
                                "id": 9,
                                "type": "SaveImage",
                                "pos": [
                                    1451,
                                    189
                                ],
                                "size": {
                                    "0": 210,
                                    "1": 58
                                },
                                "flags": {},
                                "order": 6,
                                "mode": 0,
                                "inputs": [{
                                        "name": "images",
                                        "type": "IMAGE",
                                        "link": 9,
                                        "label": "图像"
                                    }
                                ],
                                "properties": {},
                                "widgets_values": [
                                    "ComfyUI"
                                ]
                            }, {
                                "id": 4,
                                "type": "CheckpointLoaderSimple",
                                "pos": [
                                    26,
                                    474
                                ],
                                "size": {
                                    "0": 315,
                                    "1": 98
                                },
                                "flags": {},
                                "order": 1,
                                "mode": 0,
                                "outputs": [{
                                        "name": "MODEL",
                                        "type": "MODEL",
                                        "links": "[Object]",
                                        "slot_index": 0,
                                        "label": "模型"
                                    }, {
                                        "name": "CLIP",
                                        "type": "CLIP",
                                        "links": "[Object]",
                                        "slot_index": 1,
                                        "label": "CLIP"
                                    }, {
                                        "name": "VAE",
                                        "type": "VAE",
                                        "links": "[Object]",
                                        "slot_index": 2,
                                        "label": "VAE"
                                    }
                                ],
                                "properties": {
                                    "Node name for S&R": "CheckpointLoaderSimple"
                                },
                                "widgets_values": [
                                    "sdxl-动漫二次元_2.0.safetensors"
                                ]
                            }, {
                                "id": 6,
                                "type": "CLIPTextEncode",
                                "pos": [
                                    250,
                                    70
                                ],
                                "size": {
                                    "0": 422.84503173828125,
                                    "1": 164.31304931640625
                                },
                                "flags": {},
                                "order": 2,
                                "mode": 0,
                                "inputs": [{
                                        "name": "clip",
                                        "type": "CLIP",
                                        "link": 3,
                                        "label": "CLIP"
                                    }
                                ],
                                "outputs": [{
                                        "name": "CONDITIONING",
                                        "type": "CONDITIONING",
                                        "links": "[Object]",
                                        "slot_index": 0,
                                        "label": "条件"
                                    }
                                ],
                                "properties": {
                                    "Node name for S&R": "CLIPTextEncode"
                                },
                                "widgets_values": [
                                    "1girl,flower,outdoors,solo,dress,long hair,closed eyes,sky,holding,smile,cloud,open mouth,field,blush,day,blue sky,white flower,holding flower,flower field,short sleeves,teeth,blue dress,petals,:d,facing viewer,grey hair,floating hair,wind,happy,^_^,daisy,upper teeth only,white dress,"
                                ]
                            }, {
                                "id": 7,
                                "type": "CLIPTextEncode",
                                "pos": [
                                    340,
                                    290
                                ],
                                "size": {
                                    "0": 425.27801513671875,
                                    "1": 180.6060791015625
                                },
                                "flags": {},
                                "order": 3,
                                "mode": 0,
                                "inputs": [{
                                        "name": "clip",
                                        "type": "CLIP",
                                        "link": 5,
                                        "label": "CLIP"
                                    }
                                ],
                                "outputs": [{
                                        "name": "CONDITIONING",
                                        "type": "CONDITIONING",
                                        "links": "[Object]",
                                        "slot_index": 0,
                                        "label": "条件"
                                    }
                                ],
                                "properties": {
                                    "Node name for S&R": "CLIPTextEncode"
                                },
                                "widgets_values": [
                                    "(worst quality, low quality),deformed,distorted,disfigured,doll,poorly drawn,bad anatomy,wrong anatomy,"
                                ]
                            }, {
                                "id": 3,
                                "type": "KSampler",
                                "pos": [
                                    863,
                                    186
                                ],
                                "size": {
                                    "0": 315,
                                    "1": 262
                                },
                                "flags": {},
                                "order": 4,
                                "mode": 0,
                                "inputs": [{
                                        "name": "model",
                                        "type": "MODEL",
                                        "link": 1,
                                        "label": "模型"
                                    }, {
                                        "name": "positive",
                                        "type": "CONDITIONING",
                                        "link": 4,
                                        "label": "正面条件"
                                    }, {
                                        "name": "negative",
                                        "type": "CONDITIONING",
                                        "link": 6,
                                        "label": "负面条件"
                                    }, {
                                        "name": "latent_image",
                                        "type": "LATENT",
                                        "link": 2,
                                        "label": "Latent"
                                    }
                                ],
                                "outputs": [{
                                        "name": "LATENT",
                                        "type": "LATENT",
                                        "links": "[Object]",
                                        "slot_index": 0,
                                        "label": "Latent"
                                    }
                                ],
                                "properties": {
                                    "Node name for S&R": "KSampler"
                                },
                                "widgets_values": [
                                    0,
                                    "randomize",
                                    30,
                                    8,
                                    "dpmpp_2m",
                                    "karras",
                                    1
                                ]
                            }
                        ],
                        "links": [
                            [
                                1,
                                4,
                                0,
                                3,
                                0,
                                "MODEL"
                            ],
                            [
                                2,
                                5,
                                0,
                                3,
                                3,
                                "LATENT"
                            ],
                            [
                                3,
                                4,
                                1,
                                6,
                                0,
                                "CLIP"
                            ],
                            [
                                4,
                                6,
                                0,
                                3,
                                1,
                                "CONDITIONING"
                            ],
                            [
                                5,
                                4,
                                1,
                                7,
                                0,
                                "CLIP"
                            ],
                            [
                                6,
                                7,
                                0,
                                3,
                                2,
                                "CONDITIONING"
                            ],
                            [
                                7,
                                3,
                                0,
                                8,
                                0,
                                "LATENT"
                            ],
                            [
                                8,
                                4,
                                2,
                                8,
                                1,
                                "VAE"
                            ],
                            [
                                9,
                                8,
                                0,
                                9,
                                0,
                                "IMAGE"
                            ]
                        ],
                        "groups": [],
                        "config": {},
                        "extra": {
                            "ds": {
                                "scale": 1,
                                "offset": {
                                    "0": 858,
                                    "1": 196
                                }
                            }
                        },
                        "version": 0.4,
                        "widget_idx_map": {
                            "3": {
                                "seed": 0,
                                "sampler_name": 4,
                                "scheduler": 5
                            }
                        }
                    }
                },
                "client_id": "a4ff6051dabe4c7d994460b62c6c8f14"
            },
            [
                "9"
            ]
        ],
        "outputs": {
            "9": {
                "images": [{
                        "filename": "ComfyUI_00131_.png",
                        "subfolder": "",
                        "type": "output"
                    }
                ]
            }
        },
        "status": {
            "status_str": "success",
            "completed": true,
            "messages": [
                [
                    "execution_start", {
                        "prompt_id": "d40751e8-3e96-472f-a818-90d36d06faf1"
                    }
                ],
                [
                    "execution_cached", {
                        "nodes": [],
                        "prompt_id": "d40751e8-3e96-472f-a818-90d36d06faf1"
                    }
                ]
            ]
        }
    }
}

  • 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
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» d40751e8-3e96-472f-a818-90d36d06faf1objecttruenonenone
»» prompt[object]truenonenone
»» outputs[object]truenonenone
»» status[object]truenonenone

GET /system_stats

GET /system_stats

系统统计信息接口

返回成功示例

{
  "system": {
    "os": "nt",
    "python_version": "3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]",
    "embedded_python": false
  },
  "devices": [
    {
      "name": "cuda:0 NVIDIA GeForce RTX 4070 Ti SUPER : cudaMallocAsync",
      "type": "cuda",
      "index": 0,
      "vram_total": 17170956288,
      "vram_free": 15702425600,
      "torch_vram_total": 67108864,
      "torch_vram_free": 33554432
    }
  ]
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» systemobjecttruenonenone
»» osstringtruenonenone
»» python_versionstringtruenonenone
»» embedded_pythonbooleantruenonenone
» devices[object]truenonenone
»» namestringfalsenonenone
»» typestringfalsenonenone
»» indexintegerfalsenonenone
»» vram_totalintegerfalsenonenone
»» vram_freeintegerfalsenonenone
»» torch_vram_totalintegerfalsenonenone
»» torch_vram_freeintegerfalsenonenone

GET /object_info/{node_class}

GET /object_info/KSampler

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

返回示例
成功

{
  "KSampler": {
    "input": {
      "required": {
        "model": [
          "MODEL"
        ],
        "seed": [
          "INT",
          {
            "default": 0,
            "min": 0,
            "max": 18446744073709552000
          }
        ],
        "steps": [
          "INT",
          {
            "default": 20,
            "min": 1,
            "max": 10000
          }
        ],
        "cfg": [
          "FLOAT",
          {
            "default": 8,
            "min": 0,
            "max": 100,
            "step": 0.1,
            "round": 0.01
          }
        ],
        "sampler_name": [
          [
            "euler",
            "euler_ancestral",
            "heun",
            "heunpp2",
            "dpm_2",
            "dpm_2_ancestral",
            "lms",
            "dpm_fast",
            "dpm_adaptive",
            "dpmpp_2s_ancestral",
            "dpmpp_sde",
            "dpmpp_sde_gpu",
            "dpmpp_2m",
            "dpmpp_2m_sde",
            "dpmpp_2m_sde_gpu",
            "dpmpp_3m_sde",
            "dpmpp_3m_sde_gpu",
            "ddpm",
            "lcm",
            "ddim",
            "uni_pc",
            "uni_pc_bh2"
          ]
        ],
        "scheduler": [
          [
            "normal",
            "karras",
            "exponential",
            "sgm_uniform",
            "simple",
            "ddim_uniform"
          ]
        ],
        "positive": [
          "CONDITIONING"
        ],
        "negative": [
          "CONDITIONING"
        ],
        "latent_image": [
          "LATENT"
        ],
        "denoise": [
          "FLOAT",
          {
            "default": 1,
            "min": 0,
            "max": 1,
            "step": 0.01
          }
        ]
      }
    },
    "output": [
      "LATENT"
    ],
    "output_is_list": [
      false
    ],
    "output_name": [
      "LATENT"
    ],
    "name": "KSampler",
    "display_name": "KSampler",
    "description": "",
    "category": "sampling",
    "output_node": false
  }
}
  • 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

返回结果

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

返回数据结构

状态码 200

名称类型必选约束中文名说明
» KSamplerobjecttruenonenone
»» inputobjecttruenonenone
»»» requiredobjecttruenonenone
»»»» model[string]truenonenone
»»»» seed[object]truenonenone

关注我,分享更多精彩内容。###

您也可以看我用apifox发布生成的api调用示例链接

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/944790
推荐阅读
相关标签
  

闽ICP备14008679号