ComfyPilotComfyPilot
文档 / 开发 / 使用 Comfy Router 调用 Wan 2.6 I2V

使用 Comfy Router 调用 Wan 2.6 I2V

通过 Comfy Router 以 HTTP 调用 wan/wan2.6-i2v 的 Python、TypeScript 和 cURL 代码片段,以及请求字段和返回结果形状

开发 code 更新于 2026-10-11

查看官方原文

使用 Comfy Router 调用 Wan 2.6 I2V

通过 Comfy Router 以 HTTP 调用 wan/wan2.6-i2v 的 Python、TypeScript 和 cURL 代码片段,以及请求字段和返回结果形状

Wan 2.6 I2V 的 API 参考。Wan 2.6 图生视频可将静止的首帧制作成动画,支持 720P 或 1080P,时长最长 15 秒。

输入: 图像, 音频, 文本 · 输出: 视频 + 音频

快速开始

在你的 Comfy 工作区中创建一个密钥,并将其导出为 COMFY_API_KEY。Python 和 TypeScript 代码片段使用 Comfy SDK(pip install comfy-sdk 和 npm install @comfyorg/sdk);cURL 代码片段则是通过原始 HTTP 发起的同一调用。

模型 ID: wan/wan2.6-i2v

端点: POST https://api.comfy.org/v2/models/wan/wan2.6-i2v

[tab] 等待结果 ``python Python theme={null} import asyncio from comfy_sdk import AsyncComfy # 从环境变量中读取 COMFY_API_KEY。 # SDK 会自动创建幂等键,并在自动重试时复用它。 async def main(): async with AsyncComfy() as client: result = await client.models.run( "wan/wan2.6-i2v", { "input": { "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady", "img_url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png", }, "parameters": { "resolution": "720P", "duration": 5, }, }, ) print("video:", result["output"]["video_url"]) asyncio.run(main()) ` `typescript TypeScript theme={null} import { comfy } from "@comfyorg/sdk"; // 从环境变量中读取 COMFY_API_KEY。 // SDK 会自动创建幂等键,并在自动重试时复用它。 type Result = { output: { video_url: string } }; const result = await comfy.models.run<Result>("wan/wan2.6-i2v", { input: { prompt: "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady", img_url: "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png", }, parameters: { resolution: "720P", duration: 5, }, }); if (result.kind !== "json") throw new Error("expected a JSON result"); console.log("video:", result.data.output.video_url); ` `bash cURL theme={null} curl https://api.comfy.org/v2/models/wan/wan2.6-i2v \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"input\": {\"prompt\":\"the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady\",\"img_url\":\"https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png\"}, \"parameters\": {\"resolution\":\"720P\",\"duration\":5}}" ``
[tab] 排队并稍后收集 相同的请求体,发送到 POST https://api.comfy.org/v2/models/wan/wan2.6-i2v/requests。一旦运行被接纳,Router 就会返回 201 和 request_id,结果就绪后即可收集,无论来自当前进程还是另一个进程。队列投递 会详细介绍状态查询、取消和收集的完整流程。 ``python Python theme={null} import asyncio from comfy_sdk import AsyncComfy # 从环境变量中读取 COMFY_API_KEY。 # 每次 submit() 调用都会生成自己的 Idempotency-Key,并在自动重试时复用它。 async def main(): async with AsyncComfy() as client: handle = await client.models.submit( "wan/wan2.6-i2v", { "input": { "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady", "img_url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png", }, "parameters": { "resolution": "720P", "duration": 5, }, }, ) print("request_id:", handle.request_id) # 配合模型 ID,就是另一个进程所需的全部信息 # 轮询直到请求完成,按服务器给出的 Retry-After 等待。 async for update in handle.iter_events(): print(update.status, update.queue_position) # 提供商自己的响应负载,与 models.run() 返回的值相同。 # 失败或已取消的请求会在此处抛出带类型的 Router 错误。 result = await handle.get() print("video:", result["output"]["video_url"]) asyncio.run(main()) ` `typescript TypeScript theme={null} import { comfy } from "@comfyorg/sdk"; // 从环境变量中读取 COMFY_API_KEY。 // 每次 submit() 调用都会生成自己的 Idempotency-Key,并在自动重试时复用它。 type Result = { output: { video_url: string } }; const handle = await comfy.models.submit<Result>("wan/wan2.6-i2v", { input: { prompt: "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady", img_url: "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png", }, parameters: { resolution: "720P", duration: 5, }, }); console.log("requestId:", handle.requestId); // 配合模型 ID,就是另一个进程所需的全部信息 // 轮询直到请求完成,按服务器给出的 Retry-After 等待。 for await (const update of handle.events()) { console.log(update.status, update.queuePosition); } // 与 models.run() 返回的结果相同。失败或已取消的请求会在此处 reject。 const result = await handle.get(); if (result.kind !== "json") throw new Error("expected a JSON result"); console.log("video:", result.data.output.video_url); ` `bash cURL theme={null} # 1. 提交。Router 返回 201,并附带 request_id、status_url、response_url 和 cancel_url。 curl https://api.comfy.org/v2/models/wan/wan2.6-i2v/requests \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"input\": {\"prompt\":\"the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady\",\"img_url\":\"https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png\"}, \"parameters\": {\"resolution\":\"720P\",\"duration\":5}}" # 2. 轮询直到状态为 COMPLETED,按每个响应给出的 Retry-After 秒数等待。 REQUEST_ID="<request_id from the 201 body>" curl -i https://api.comfy.org/v2/models/wan/wan2.6-i2v/requests/$REQUEST_ID/status \ -H "X-API-Key: $COMFY_API_KEY" # 3. 收集。返回 200 及模型的原生输出;仍在运行时返回 202 及状态响应体。 curl https://api.comfy.org/v2/models/wan/wan2.6-i2v/requests/$REQUEST_ID \ -H "X-API-Key: $COMFY_API_KEY" ``

Schema

输入

input object required

输入基本信息,例如提示词等。

input.audio\_url string

音频文件下载 URL。支持的格式:mp3 和 wav。不能与 reference\_video\_urls 同时使用。

input.img\_url string

首帧图像 URL 或 Base64 编码数据。wan2.5-i2v-preview 和 wan2.6-i2v 模型必填。happyhorse-1.x i2v 这些写法不在此处传入首帧:它们把首帧作为 type 为 first\_frame 的媒体元素传入(参见下文的 media),而且在 wan2.6-i2v 上能成功的 img\_url 请求体,在 happyhorse-1.0-i2v 和 happyhorse-1.1-i2v 上会被提供商拒绝;wan2.7/wan3.0 这些写法同样在 media 中传入其参考资产。图像格式:JPEG、JPG、PNG、BMP、WEBP。分辨率:360-2000 像素。文件大小:最大 10MB。

input.media object[]

媒体资产列表。用于指定视频生成的参考素材(图像、音频、视频)。每个元素包含 type 和 url 字段。此字段由本组件提供的所有模型共用,而某个模型接受哪些 type 值,以及它究竟是在这里携带图像或视频输入、还是在 img\_url 或 reference\_video\_urls 中携带,都因模型而异。各模型支持的 type 值如下:

  • wan2.7-i2v:first\_frame、last\_frame、driving\_audio、first\_clip。first\_frame 和 last\_frame:JPEG/JPG/PNG/BMP/WEBP,每边 240-8000 像素,宽高比在 1:8 到 8:1 之间,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL。driving\_audio(WAV/MP3,2-30 秒,最大 15MB)和 first\_clip(MP4/MOV,2-10 秒,每边 240-4096 像素,最大 100MB):必须是公开的 HTTP/HTTPS URL;不接受内联 data: URL。
  • wan2.7-r2v:first\_frame(可选,最多 1 个)、reference\_image、reference\_video。至少需要提供一个 reference\_image 或 reference\_video,且参考图像加参考视频总共最多 5 个。first\_frame 和 reference\_image:JPEG/JPG/PNG/BMP/WEBP(不含透明度通道),每边 240-8000 像素,宽高比在 1:8 到 8:1 之间,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL。reference\_video:必须是公开的 HTTP/HTTPS URL;不接受内联 data: URL。
  • wan2.7-videoedit:video(恰好 1 个,即被编辑的片段:MP4/MOV,2-10 秒,每边 240-4096 像素,最大 100MB,必须是公开的 HTTP/HTTPS URL;不接受内联 data: URL),外加可选的 0 到 4 个 reference\_image(JPEG/JPG/PNG/BMP/WEBP,每边 240-8000 像素,宽高比在 1:8 到 8:1 之间,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL)。
  • wan3.0-video、wan3.0-video-prime:first\_frame(最多 1 个)、last\_frame(最多 1 个)、reference\_image(最多 10 个)、reference\_video(最多 5 个片段,总时长 \<= 15 秒)、reference\_audio(最多 5 个片段,总时长 \<= 15 秒)、file(最多 1 个,不能与 link 一起使用)、link(最多 1 个,不能与 file 一起使用)。reference\_\*/file/link 这些类型与 first\_frame/last\_frame 类型在同一请求中互斥。数组顺序决定提示词中资产的参考顺序(Image 1、Video 1、Audio 1……)。first\_frame、last\_frame 和 reference\_image:JPEG/JPG/PNG/BMP/WEBP,每边 240-8000 像素,宽高比最大 8:1,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL。reference\_video、reference\_audio、file 和 link:必须是公开的 HTTP/HTTPS URL;不接受内联 data: URL。
  • happyhorse-1.0-i2v、happyhorse-1.1-i2v:仅 first\_frame,恰好 1 个。这些写法在此处传入首帧,而不是在 img\_url 中传入。至少 300x300 像素,宽高比在 1:2.5 到 2.5:1 之间,JPEG/JPG/PNG/WEBP,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL。
  • happyhorse-1.0-r2v、happyhorse-1.1-r2v:仅 reference\_image,1 到 9 个。这是该模型唯一的参考输入。最短边至少 400 像素,JPEG/JPG/PNG/WEBP,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL。reference\_video 不是此操作的输入类型。
  • happyhorse-1.0-video-edit:video(恰好 1 个,即被编辑的片段:MP4/MOV,3-60 秒,长边最大 4096 像素,短边至少 360 像素,宽高比在 1:2.5 到 2.5:1 之间,最大 100MB,必须是公开的 HTTP/HTTPS URL;不接受内联 data: URL),外加可选的 0 到 5 个 reference\_image(JPEG/JPG/PNG/BMP/WEBP,至少 300x300 像素,宽高比在 1:2.5 到 2.5:1 之间,最大 20MB,可以是公开 URL 或 data:\{MIME\_type};base64,... URL)。
  • happyhorse-1.0-t2v、happyhorse-1.1-t2v、wan2.7-t2v、wan2.6-t2v、wan2.5-t2v-preview:文生视频操作。其对应的合作伙伴参考文档未记录任何媒体输入,因此请勿设置此字段。
  • wan2.5-i2v-preview、wan2.6-i2v、wan2.6-r2v:本组件未为这些写法列举任何 media 词表。wan2.5-i2v-preview 和 wan2.6-i2v 在 img\_url 中传入首帧;wan2.6-r2v 在 reference\_video\_urls 中传入其参考片段。 上述各模型的计数是合作伙伴的约束,而不是本 schema 的约束:media 上没有声明 minItems/maxItems,因为可接受的类型及其上限因模型而异。schema 通过并不意味着提供商接受;反过来说,上面每个资产“最大 20MB”的数值是合作伙伴对其最终收到的资产所设的上限(这也是图像输入的上限,而图像输入是唯一可以内联发送的输入),当资产是公开 URL 时,这些上限按原文生效,因为这些字节从不经过 Comfy。内联的 data:\{MIME\_type};base64,... URL 确实会经过 Comfy,因而也会遇到传输上限:Comfy Router 的 POST 请求体总上限为 100 MiB,超过即返回 413,而 base64 会使载荷膨胀约 4/3,因此单个内联资产只要超过约 75 MB,就会在触及此处的任何合作伙伴规则之前被拒绝。在这样的体积下,单个资产即使处于合作伙伴自身的 20MB 的上限可以轻松容纳内联内容,因此对于单个资产,真正起约束作用的是合作伙伴规则; 而对于多个资产,起约束作用的则是传输上限,因为 100 MiB 的 Router 上限约束的是 整个请求,而不是其中的每个元素。任何接近这些上限的内容,请以公共 URL 形式发送。

input.media\[].type string required

媒体资产类型

可选值:first_frame、last_frame、driving_audio、first_clip、reference_image、reference_video、reference_audio、video、file、link

input.media\[].url string required

媒体文件的 URL:公共 HTTP/HTTPS URL;或者,仅针对上文 media 描述中为各模型列出的 IMAGE 输入(wan2.7-i2v 上的 first\_frame 和 last\_frame;wan2.7-r2v 上的 first\_frame 和 reference\_image;wan2.7-videoedit 上的 reference\_image;wan3.0-video 和 wan3.0-video-prime 上的 first\_frame、last\_frame 和 reference\_image;happyhorse-1.0-i2v 和 happyhorse-1.1-i2v 上的 first\_frame;happyhorse-1.0-r2v 和 happyhorse-1.1-r2v 上的 reference\_image;以及 happyhorse-1.0-video-edit 上的 reference\_image),也可以使用内联的 data:{MIME_type};base64,... URL。这些模型上的任何 video、audio、file 或 link 输入都不接受内联 data: URL。来自合作伙伴自有上传服务的 oss\://dashscope-instant 临时 URL,或(在 wan2.7-videoedit 上)Asset Center 的 asset\_id,仅在创建它的阿里云账户下才能解析;Comfy 使用自己的密钥发起模型调用,且不对外提供上传途径,因此调用方自己的 oss\:// URL 或 asset\_id 不是受支持的输入。此字段不校验 URL scheme,因此这类值会按原样转发给合作伙伴,而不会在这里被拒绝。有关各模型的大小与像素限制,以及约束内联负载总量的 100 MiB Router 请求体上限,请参见 media 描述。

input.negative\_prompt string

反向提示词用于描述你不希望在视频画面中看到的内容

input.prompt string

文本提示词。支持中文和英文,长度不超过 800 个字符 (wan3.0-video 最多 20,000 个字符;超出限制的内容会被截断)。 对于带有多个参考视频的 wan2.6-r2v,请按参考视频的顺序使用 'character1'、'character2' 等来指代主体。 示例:"Character1 sings on the roadside, Character2 dances beside it" 对于 wan3.0-video 参考模式,请按 media 数组中对应的顺序使用 'Image 1'、'Video 1'、'Audio 1' 等来指代媒体资产。

input.reference\_video\_urls string[]

仅适用于 wan2.6-r2v 模型的参考视频 URL。由 1-3 个视频 URL 组成的数组。 输入限制:

  • 格式:mp4、mov
  • 数量:1-3 个视频
  • 单个视频时长:2-30 秒
  • 单个文件大小:最大 30MB
  • 不能与 audio\_url 一起使用 参考时长:单个视频最长 5s,两个视频各最长 2.5s,三个视频按比例更短。 计费:按实际使用的参考时长计费。

input.template string

视频效果模板名称。可选。目前支持:squish、flying、carousel。使用时,prompt 参数会被忽略。

model string

要调用的模型 ID。此组件上不作约束:Comfy Router 会从 POST /v2/models/wan/{model} 的 {model} 路径段填充它,因此 Router 调用方会省略该字段。直接向 POST /proxy/wan/api/v1/services/aigc/video-generation/video-synthesis 发出的 v1 调用必须提供它,而可接受拼写的枚举定义在该操作自身的组件 WanVideoGenerationRequest 上。

parameters object

视频处理参数

parameters.audio boolean (default: true)

是否为视频添加音频。仅 wan3.0-video 和 wan3.0-video-prime 支持;提供商没有为其他 wan 模型记录此类切换。

parameters.audio\_setting string (default: "auto")

wan2.7-videoedit 模型的视频音频设置。

  • auto(默认):模型根据提示词内容智能判断
  • origin:强制保留输入视频中的原始音频

可选值:auto、origin

parameters.duration integer (default: 5)

生成视频的时长,单位为秒:

  • wan2.5 模型:5 或 10 秒
  • wan2.6-t2v、wan2.6-i2v:5、10 或 15 秒
  • wan2.6-r2v:仅 5 或 10 秒(不支持 15s)
  • wan2.7-i2v、wan2.7-t2v:\[2, 15] 范围内的整数
  • wan2.7-r2v、wan2.7-videoedit:\[2, 10] 范围内的整数
  • wan3.0-video:无视频输入时为 \[2, 30] 范围内的整数;有视频输入时,输入视频总时长 + 输出视频时长不得超过 30 秒;-1 启用智能时长模式,由模型自行挑选合适的时长 此代理对超出 \[-1, 30] 范围的时长返回 400。

范围:-1 到 30

parameters.prompt\_extend boolean (default: true)

是否启用提示词智能改写。默认为 true

parameters.ratio string

生成视频的宽高比。仅适用于 wan2.7 和 wan3.0 模型。 对于 wan2.7 模型,如果未提供,则根据分辨率档位取默认值。 对于 wan3.0-video,adaptive(默认值)会根据输入媒体的比例和意图 自动推荐合适的宽高比。

可选值:adaptive、16:9、9:16、1:1、4:3、3:4

parameters.resolution string

分辨率档位。支持的值因模型而异:

  • wan2.5-i2v-preview:480P、720P、1080P
  • wan2.6 模型(t2v、i2v、r2v):仅 720P、1080P(不支持 480P)
  • wan2.7 模型(i2v、t2v、r2v、videoedit):720P、1080P(默认 1080P)
  • wan3.0-video、wan3.0-video-prime:480P、720P、1080P(上游默认为 1080P)
  • happyhorse-1.0-\*(t2v、i2v、r2v、video-edit):720P、1080P
  • happyhorse-1.1-\*(t2v、i2v、r2v):480P、720P、1080P

该代理会拒绝既未提供分辨率也未提供尺寸的视频生成请求,因为分辨率档位决定计费费率。它会在检查之前将分辨率转为大写并转发大写后的值,对于超出该枚举范围的值返回 400,并且对于上方列为不支持 480P 的 wan2.6、wan2.7 和 happyhorse-1.0 模型,在收到 480P 时返回 400(无论是以分辨率还是以 480P 尺寸发送)。

可选值:480P, 720P, 1080P

parameters.seed integer

随机数种子,用于控制模型生成内容的随机性

范围:0 到 2147483647

parameters.shot\_type string (default: "single")

智能多镜头控制。仅在启用 prompt\_extend 时生效。 适用于 wan2.6 和 wan2.7-r2v 模型。

  • single:单镜头视频(默认)
  • multi:多镜头视频

可选值:multi, single

parameters.size string

视频分辨率,格式为 width*height。支持的分辨率因模型而异: 对于 wan2.5 T2V:480P(480*832、832*480、624*624)、720P、1080P 尺寸 对于 wan2.6 T2V/R2V(无 480P): 720P:1280*720、720*1280、960*960、1088*832、832*1088 1080P:1920*1080、1080*1920、1440*1440、1632*1248、1248*1632 当同时发送尺寸和分辨率时,尺寸决定计费档位, 分辨率仍必须是该代理为此模型接受的值。对于分辨率描述中列为不支持 480P 的每个模型, 480P 的尺寸都会返回 400。

parameters.watermark boolean (default: false)

是否添加水印标识,水印位于右下角

由 Router 在 GET /v2/models/wan/wan2.6-i2v/openapi.json 提供的 schema 生成,该文档也正是它在请求到达提供商之前用于校验调用的同一份文档。

输出

output object required

output.actual\_prompt string

智能改写后的实际提示词(视频任务)

output.check\_audio string

带音频生成的 I2V 任务的音频 URL

output.code string

失败请求的错误码(请求成功时不返回)

output.end\_time string

任务完成时间

output.message string

失败请求的详细信息(请求成功时不返回)

output.orig\_prompt string

原始输入提示词(视频任务)

output.results object[]

图像生成任务的结果列表

output.results\[].actual\_prompt string

智能改写后的实际提示词(如果启用)

output.results\[].code string

图像错误码(部分任务失败时返回)

output.results\[].message string

图像错误信息(部分任务失败时返回)

output.results\[].orig\_prompt string

原始输入提示词

output.results\[].url string

已生成图像的网址

output.scheduled\_time string

任务执行时间

output.submit\_time string

任务提交时间

output.task\_id string required

任务 ID

output.task\_metrics object

图像生成任务的结果统计

output.task\_metrics.FAILED integer

失败任务数

output.task\_metrics.SUCCEEDED integer

成功任务数

output.task\_metrics.TOTAL integer

任务总数

output.task\_status string required

任务状态

可能的值:PENDING、RUNNING、SUCCEEDED、FAILED、CANCELED、UNKNOWN

output.video\_url string

视频生成任务完成后的视频 URL。链接有效期为 24 小时

request\_id string required

唯一请求标识符

usage object

输出信息统计。仅统计成功的结果

usage.SR integer

视频分辨率等级(I2V 和 wan3.0-video 任务)

usage.duration number

已生成视频的时长,单位为秒(I2V 和 wan3.0-video 任务)

usage.fps integer

已生成视频的帧率(wan3.0-video 任务)

usage.image\_count integer

已生成图像的数量(T2I 和 I2I 任务)

usage.input\_video\_duration number

输入视频的时长,单位为秒;没有视频输入时为 0.0(wan3.0-video 任务)

usage.output\_video\_duration number

输出视频的时长,单位为秒(wan3.0-video 任务)

usage.ratio string

已生成视频的宽高比,例如 16:9(wan3.0-video 任务)

usage.size string

图像分辨率(T2I 和 I2I 任务)

usage.video\_count integer

已生成视频的数量(T2V 任务)

usage.video\_duration number

已生成视频的时长,单位为秒(T2V 任务)

usage.video\_ratio string

视频分辨率比例(T2V 任务)

code string

失败请求的错误码,在响应信封的 ROOT 层级返回,而不是在 output 下(请求成功时不返回)。

message string

失败请求的详细信息,在响应信封的 ROOT 层级返回,而不是在 output 下(请求成功时不返回)。在回退到 output.message 之前,请先阅读此项。

示例

输入

{
  "input": {
    "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
    "img_url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png"
  },
  "parameters": {
    "resolution": "720P",
    "duration": 5
  }
}

输出

{
  "output": {
    "task_id": "0385dc79-5ff8-4d82-bcb6-7c1a9f2e4d60",
    "task_status": "SUCCEEDED",
    "submit_time": "2027-01-01T00:00:00.000Z",
    "scheduled_time": "2027-01-01T00:00:01.000Z",
    "end_time": "2027-01-01T00:01:04.000Z",
    "orig_prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
    "actual_prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady, smooth studio lighting, subtle camera push in",
    "video_url": "https://.../generated.mp4"
  },
  "request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51",
  "usage": {
    "SR": 720,
    "duration": 5
  }
}

视频 URL 的有效期为 24 小时。如果需要保留视频,请及时下载。

发布前须知

SDK 会生成 Idempotency-Key 并在自动重试中复用它。手动重试时,请复用原始 key。Router 最长可保持连接 10 分钟。

请求失败时,Router 会发送 X-Comfy-Error-Type 响应头说明原因。422 表示 Router 在调用提供商之前就拒绝了输入,413 表示请求体超出了 Router 可接受的大小。已生成的资源请及时下载,因为结果 URL 会过期。

上文任何字段描述中提到的尺寸限制,都是提供商对该字段自身的限定,引自提供商的规范。Router 会对整个请求体另行设置上限,base64 编码的媒体内容也计入其中:参见请求体大小。

本页记录的是通过 Comfy Router 调用的某一个合作伙伴模型。同一个 comfy-sdk / @comfyorg/sdk 包还提供第二个客户端,用于在 Comfy Cloud 上运行完整的 ComfyUI 工作流图:Comfy(api_key=...) / new Comfy({ apiKey }),并带有 client.workflows、client.assets 和 client.jobs。请参阅 Comfy SDKs。

[card] 请求头 身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
[card] 使用 Router API 模型发现、验证错误、重试与计费。
[card] 限制 Router 目前不支持的功能,以及替代方案。