使用 RunComfy 的 API 執行 tongyi-mai/z-image/turbo/inpainting/lora。 可接受的輸入與輸出請參閱模型的 資料結構說明。
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/tongyi-mai/z-image/turbo/inpainting/lora \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Replace the girl’s current top with a short red polka-dot swimsuit top. Keep the girl’s face, hairstyle, body proportions, and pose unchanged. The lighting should be natural and consistent with a beach environment, with realistic colors and details.",
"image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/input-1-1.png",
"mask_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/mask.png"
}'將 YOUR_API_TOKEN 環境變數設為您的 API 金鑰(在 個人資料中管理金鑰),並在每個請求的 Authorization 標頭中以 Bearer 權杖形式攜帶: Authorization: Bearer $YOUR_API_TOKEN。
提交非同步生成工作後,將立即取得 request_id 以及用於查詢狀態、取得結果與取消的 URL。
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/tongyi-mai/z-image/turbo/inpainting/lora \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Replace the girl’s current top with a short red polka-dot swimsuit top. Keep the girl’s face, hairstyle, body proportions, and pose unchanged. The lighting should be natural and consistent with a beach environment, with realistic colors and details.",
"image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/input-1-1.png",
"mask_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/mask.png"
}'依 request_id 取得目前狀態(「in_queue」、「in_progress」、「completed」或「cancelled」)。
curl --request GET \
--url https://model-api.runcomfy.net/v1/requests/{request_id}/status \
--header "Authorization: Bearer <token>"取得指定 request_id 的最終輸出與中繼資料;若工作尚未完成,回應會回傳目前狀態,方便繼續輪詢。
curl --request GET \
--url https://model-api.runcomfy.net/v1/requests/{request_id}/result \
--header "Authorization: Bearer <token>"透過 request_id 取消排隊中的工作;進行中的工作無法取消。
curl --request POST \
--url https://model-api.runcomfy.net/v1/requests/{request_id}/cancel \
--header "Authorization: Bearer <token>"請提供可公開存取的 HTTPS 位址。確保目標主機允許伺服器端抓取(無需登入或 Cookie)、未被限流或阻擋機器人。建議:圖片 ≤ 50 MB(約 4K),影片 ≤ 100 MB(約 720p 下 2–5 分鐘)。私人資產請使用穩定或預先簽署 URL。
{
"type": "object",
"title": "輸入結構",
"required": [
"prompt",
"image_url",
"mask_image_url"
],
"properties": {
"prompt": {
"title": "提示詞",
"description": "",
"type": "string",
"default": "Replace the girl’s current top with a short red polka-dot swimsuit top. Keep the girl’s face, hairstyle, body proportions, and pose unchanged. The lighting should be natural and consistent with a beach environment, with realistic colors and details."
},
"image_url": {
"title": "圖片",
"description": "用於局部重繪的有效原圖 URL。",
"type": "string",
"default": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/input-1-1.png"
},
"mask_image_url": {
"title": "遮罩圖片",
"description": "用於指定編輯區域的有效遮罩圖片 URL。",
"type": "string",
"default": "https://playgrounds-storage-public.runcomfy.net/tools/7294/media-files/mask.png"
},
"control_start": {
"title": "控制起點",
"description": "ControlNet 條件開始生效的位置,取值範圍為 0 到 1。",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 0
},
"strength": {
"title": "重繪強度",
"description": "控制局部重繪條件的作用強度。",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 1
},
"loras": {
"title": "LoRA",
"description": "要套用的 LoRA 清單,最多可加入 3 個。",
"type": "array",
"items": {
"path": {
"title": "LoRA 路徑",
"description": "LoRA 權重的 URL 或 HuggingFace 儲存庫 ID(owner/repo)。",
"type": "string",
"format": "str",
"default": ""
},
"scale": {
"title": "LoRA 強度",
"description": "控制 LoRA 模型的套用強度。",
"type": "float",
"format": "float_slider_with_range",
"minimum": 0,
"maximum": 4,
"default": 1
}
},
"maxItems": 3,
"minItems": 0
},
"image_size": {
"title": "長寬比(寬:高)",
"description": "",
"type": "string",
"enum": [
"square_hd",
"square",
"portrait_4_3",
"portrait_16_9",
"landscape_4_3",
"landscape_16_9",
"auto"
],
"default": "auto"
},
"num_inference_steps": {
"title": "推理步數",
"description": "控制擴散推理的步數。",
"type": "integer",
"minimum": 1,
"maximum": 30,
"default": 20
},
"seed": {
"title": "隨機種子",
"description": "",
"type": "integer",
"default": 0
},
"output_format": {
"title": "輸出格式",
"description": "指定產生圖片的檔案格式。",
"type": "string",
"enum": [
"jpeg",
"png",
"webp"
],
"default": "png"
},
"control_scale": {
"title": "控制強度",
"description": "設定局部重繪 ControlNet 條件的作用強度。",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 0.75
},
"control_end": {
"title": "控制終點",
"description": "ControlNet 條件停止生效的位置,取值範圍為 0 到 1。",
"type": "float",
"minimum": 0,
"maximum": 1,
"default": 0.6
}
}
}{
"output": {
"type": "object",
"properties": {
"image": {
"type": "string",
"format": "uri",
"description": "單張圖片 URL"
},
"video": {
"type": "string",
"format": "uri",
"description": "單一影片 URL"
},
"images": {
"type": "array",
"description": "多張圖片 URL",
"items": {
"type": "string",
"format": "uri"
}
},
"videos": {
"type": "array",
"description": "多個影片 URL",
"items": {
"type": "string",
"format": "uri"
}
}
}
}
}RunComfy 是首選的 ComfyUI 平台,提供 ComfyUI 在線 環境和服務,以及 ComfyUI 工作流程 具有驚豔的視覺效果。 RunComfy還提供 AI Models, 幫助藝術家利用最新的AI工具創作出令人驚艷的藝術作品。