使用 RunComfy 的 API 运行 kling/kling-video-o1/video-to-video/edit。 可接受的输入与输出请参阅模型的 数据结构说明。
curl --request POST \
--url https://model-api.runcomfy.net/v1/models/kling/kling-video-o1/video-to-video/edit \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Replace the character in the video with @Element1, maintaining the same movements and camera angles. Transform the landscape into @Image1",
"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/edit \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"prompt": "Replace the character in the video with @Element1, maintaining the same movements and camera angles. Transform the landscape into @Image1",
"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": "Replace the character in the video with @Element1, maintaining the same movements and camera angles. Transform the landscape into @Image1"
},
"video_url": {
"title": "视频 URL",
"description": "用于引导动作和场景构图的源视频 URL。支持 .mp4 和 .mov;时长 3–10 秒;输入分辨率 720p–2160p;文件最大 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"
]
},
"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工具创作出令人惊叹的艺术作品。