使用 RunComfy 的 API 執行 kling/kling-video-o1/video-to-video/reference。 可接受的輸入與輸出請參閱模型的 資料結構說明。
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/kling/kling-video-o1/video-to-video/reference \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Based on @Video1, generate the next shot. keep the style of the video",
"video_url": "https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-1.mp4",
"elements": [
{
"frontal_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-2.png",
"reference_image_urls": [
"https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-3.jpeg"
]
}
],
"image_urls": [
"https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-4.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/kling/kling-video-o1/video-to-video/reference \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Based on @Video1, generate the next shot. keep the style of the video",
"video_url": "https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-1.mp4",
"elements": [
{
"frontal_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-2.png",
"reference_image_urls": [
"https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-3.jpeg"
]
}
],
"image_urls": [
"https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-4.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",
"video_url",
"elements",
"image_urls"
],
"properties": {
"prompt": {
"title": "提示詞",
"description": "使用 @Element1、@Element2 等標記按順序引用元素;使用 @Image1、@Image2 等標記按順序引用圖片。",
"type": "string",
"default": "Based on @Video1, generate the next shot. keep the style of the video"
},
"video_url": {
"title": "影片 URL",
"description": "原始影片 URL。僅支援 .mp4 和 .mov,時長 3–10 秒,輸入解析度範圍 720–2160 px,檔案最大 200 MB。",
"type": "string",
"default": "https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-1.mp4"
},
"elements": {
"title": "元素",
"description": "要加入的人物或物體。在提示詞中按順序使用 @Element1、@Element2 等標記引用。陣列最多接受 7 個元素;影片請求還需遵守參考內容合計數量限制。",
"type": "array",
"default": [
{
"frontal_image_url": "https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-2.png",
"reference_image_urls": [
"https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-3.jpeg"
]
}
],
"items": {
"frontal_image_url": {
"title": "正面圖片 URL",
"description": "元素的主要正面圖片。檔案最大 10.0 MB;寬和高至少 300 × 300 px;長寬比範圍 0.40–2.50;超時時間 20.0 秒。",
"type": "string",
"format": "image_uri",
"default": ""
},
"reference_image_urls": {
"title": "參考圖 URL",
"description": "元素的其他角度參考圖。需提供 1–4 個參考圖 URL,至少 1 個。",
"type": "array",
"format": "image_uris",
"items": {
"type": "string",
"format": "image_uri"
},
"default": [],
"maxItems": 4,
"minItems": 1
}
},
"maxItems": 7,
"minItems": 0
},
"image_urls": {
"title": "圖片",
"description": "用於引導風格或外觀的參考圖。在提示詞中按順序使用 @Image1、@Image2 等標記引用。陣列最多接受 4 張圖片;使用影片時,欄位說明要求元素與參考圖合計不超過 4 個。",
"type": "array",
"items": {
"type": "string",
"format": "image_uri"
},
"maxItems": 4,
"minItems": 0,
"default": [
"https://playgrounds-storage-public.runcomfy.net/tools/7246/media-files/input-1-4.png"
]
},
"aspect_ratio": {
"title": "長寬比(寬:高)",
"description": "產生影片畫面的長寬比。`auto` 會採用最接近輸入影片比例的選項;其他選項為 `16:9`、`9:16` 和 `1:1`。",
"type": "string",
"enum": [
"auto",
"16:9",
"9:16",
"1:1"
],
"default": "auto"
},
"duration": {
"title": "時長",
"description": "產生影片的時長。可用的字串值為 `5` 和 `10`。",
"type": "string",
"enum": [
"5",
"10"
],
"default": "5"
},
"keep_audio": {
"title": "保留原始音訊",
"description": "選擇輸出中是否保留輸入影片的原始音軌。",
"type": "boolean",
"default": false
}
}
}{
"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工具創作出令人驚艷的藝術作品。