> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# 通过 Comfy Router 使用 Sync 3

> 通过 Comfy Router 调用 synclabs/sync-3：端点、请求结构以及 Router 返回的响应。

`synclabs/sync-3` 的 API 参考，由 Comfy Router 从 Synclabs 提供。

## 快速开始

在[你的 Comfy 工作区](https://platform.comfy.org/profile/api-keys?onboarding=router)中创建密钥，并将其导出为 `COMFY_API_KEY`。Python 和 TypeScript 代码片段使用 Comfy SDK（`pip install comfy-sdk` 和 `npm install @comfyorg/sdk`）；cURL 代码片段是通过原生 HTTP 发起的同一调用。

**模型 ID：** `synclabs/sync-3`

**端点：** `POST https://api.comfy.org/v2/models/synclabs/sync-3`

<Tabs defaultTabIndex={1}>
  <Tab title="等待结果">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # 从环境变量中读取 COMFY_API_KEY。
      # SDK 会自动创建幂等键，并在自动重试时复用它。
      with Comfy() as client:
          result = client.models.run(
              "synclabs/sync-3",
              {
                  "input": [
                      {
                          "type": "video",
                          "url": "https://example.invalid/synclabs/sync-3/speaker.mp4",
                      },
                      {
                          "type": "audio",
                          "url": "https://example.invalid/synclabs/sync-3/voiceover.wav",
                      },
                  ],
                  "options": {
                      "sync_mode": "bounce",
                  },
              },
          )

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // 从环境变量中读取 COMFY_API_KEY。
      // SDK 会自动创建幂等键，并在自动重试时复用它。
      const { data } = await comfy.models.run("synclabs/sync-3", {
        input: [
          {
            type: "video",
            url: "https://example.invalid/synclabs/sync-3/speaker.mp4",
          },
          {
            type: "audio",
            url: "https://example.invalid/synclabs/sync-3/voiceover.wav",
          },
        ],
        options: {
          sync_mode: "bounce",
        },
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/synclabs/sync-3 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input\": [{\"type\":\"video\",\"url\":\"https://example.invalid/synclabs/sync-3/speaker.mp4\"},{\"type\":\"audio\",\"url\":\"https://example.invalid/synclabs/sync-3/voiceover.wav\"}], \"options\": {\"sync_mode\":\"bounce\"}}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="排队并稍后收集">
    相同的请求体，发送到 `POST https://api.comfy.org/v2/models/synclabs/sync-3/requests`。一旦运行被接纳，Router 就会返回 `201` 和 `request_id`，结果就绪后即可从当前进程或另一个进程收集。[队列交付](/zh/development/comfy-router/queue) 介绍了状态、取消和收集。

    <CodeGroup>
      ```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(
                  "synclabs/sync-3",
                  {
                      "input": [
                          {
                              "type": "video",
                              "url": "https://example.invalid/synclabs/sync-3/speaker.mp4",
                          },
                          {
                              "type": "audio",
                              "url": "https://example.invalid/synclabs/sync-3/voiceover.wav",
                          },
                      ],
                      "options": {
                          "sync_mode": "bounce",
                      },
                  },
              )
              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(result)

      asyncio.run(main())
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // 从环境变量中读取 COMFY_API_KEY。
      // 每次 submit() 调用都会生成自己的 Idempotency-Key，并在自动重试时复用它。
      const handle = await comfy.models.submit("synclabs/sync-3", {
        input: [
          {
            type: "video",
            url: "https://example.invalid/synclabs/sync-3/speaker.mp4",
          },
          {
            type: "audio",
            url: "https://example.invalid/synclabs/sync-3/voiceover.wav",
          },
        ],
        options: {
          sync_mode: "bounce",
        },
      });
      console.log("requestId:", handle.requestId); // 加上模型 ID，就是另一个进程所需的全部信息

      // 轮询直到请求完成，每次等待服务器指定的 Retry-After。
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // 与 models.run() 返回的结果相同。失败或已取消的请求会在此处被拒绝。
      const result = await handle.get();

      console.log(result.data);
      ```

      ```bash cURL theme={null}
      # 1. 提交。Router 返回 201，并带有 request_id、status_url、response_url 和 cancel_url。
      curl https://api.comfy.org/v2/models/synclabs/sync-3/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input\": [{\"type\":\"video\",\"url\":\"https://example.invalid/synclabs/sync-3/speaker.mp4\"},{\"type\":\"audio\",\"url\":\"https://example.invalid/synclabs/sync-3/voiceover.wav\"}], \"options\": {\"sync_mode\":\"bounce\"}}"

      # 2. 轮询直到状态为 COMPLETED，每次响应都等待其指定的 Retry-After 秒数。
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/synclabs/sync-3/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. 收集。返回 200 及模型的原生输出，仍在运行时则返回 202 及状态正文。
      curl https://api.comfy.org/v2/models/synclabs/sync-3/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Schema

### Input

<ParamField body="dubParams" type="object">
  附加到 Sync Labs 生成请求的配音参数
</ParamField>

<ParamField body="dubParams.numSpeakers" type="integer">
  来源视频中的说话人数；0 表示启用自动检测
</ParamField>

<ParamField body="dubParams.providerName" type="string" required>
  用于配音的提供商（例如 elevenlabs）
</ParamField>

<ParamField body="dubParams.sourceLang" type="string">
  来源语言代码；默认为 auto
</ParamField>

<ParamField body="dubParams.targetLang" type="string" required>
  配音的目标语言代码
</ParamField>

<ParamField body="input" type="object[]" required>
  输入项；恰好一个视觉输入（视频或图像）和一个音频或文本输入
</ParamField>

<ParamField body="input[].assetId" type="string">
  Sync Labs 媒体库中资产的 ID
</ParamField>

<ParamField body="input[].provider" type="object">
  用于 Sync Labs 文本输入的文本转语音提供商配置
</ParamField>

<ParamField body="input[].provider.name" type="string" required>
  TTS 提供商名称（例如 elevenlabs）
</ParamField>

<ParamField body="input[].provider.script" type="string" required>
  用于生成的脚本
</ParamField>

<ParamField body="input[].provider.similarityBoost" type="number">
  AI 应多大程度贴近原始声音

  格式：`double`
</ParamField>

<ParamField body="input[].provider.stability" type="number">
  声音稳定性；较低的值会带来更宽的情感范围

  格式：`double`
</ParamField>

<ParamField body="input[].provider.voiceId" type="string" required>
  Sync 语音 id（从 Studio 克隆的声音）或 ElevenLabs 语音 ID
</ParamField>

<ParamField body="input[].refId" type="string">
  用于将此输入关联到片段定义的引用标识符
</ParamField>

<ParamField body="input[].segments_frames" type="integer[][]">
  弃用 - 请改用顶层的 segments 数组
</ParamField>

<ParamField body="input[].segments_secs" type="number[][]">
  弃用 - 请改用顶层的 segments 数组
</ParamField>

<ParamField body="input[].type" type="string" required>
  输入类型（video、image、audio 或 text）
</ParamField>

<ParamField body="input[].url" type="string">
  用于生成的媒体的 URL
</ParamField>

<ParamField body="model" type="string">
  用于生成的模型名称；仅支持 sync-3。在 Comfy Router 路由 `POST /v2/models/synclabs/{model}` 上，该字段由路径提供，可以省略。
</ParamField>

<ParamField body="options" type="object">
  可用于 Sync Labs 生成的附加选项
</ParamField>

<ParamField body="options.active_speaker_detection" type="object">
  活跃说话人检测配置
</ParamField>

<ParamField body="options.active_speaker_detection.auto_detect" type="boolean">
  是否自动检测并将生成应用于活跃说话人
</ParamField>

<ParamField body="options.active_speaker_detection.bounding_boxes" type="integer[][]">
  检测到的人脸逐帧边界框数组 \[x1, y1, x2, y2]
</ParamField>

<ParamField body="options.active_speaker_detection.bounding_boxes_url" type="string">
  包含边界框的 JSON 文件的 URL
</ParamField>

<ParamField body="options.active_speaker_detection.coordinates" type="integer[]">
  由 frame\_number 标识的来源视频帧中的像素坐标 \[x, y]
</ParamField>

<ParamField body="options.active_speaker_detection.frame_number" type="integer">
  与所提供的坐标对应的帧索引，用于手动选择说话人
</ParamField>

<ParamField body="options.active_speaker_detection.v3" type="boolean">
  是否使用 ASD v3
</ParamField>

<ParamField body="options.model_mode" type="string">
  模型的编辑区域（lips、face、head）；仅适用于 react-1
</ParamField>

<ParamField body="options.occlusion_detection_enabled" type="boolean">
  是否在生成期间检测遮挡
</ParamField>

<ParamField body="options.prompt" type="string">
  情感提示词；仅适用于 react-1
</ParamField>

<ParamField body="options.sync_mode" type="string">
  如何处理视频与音频之间的时长不匹配（bounce、loop、cut\_off、silence、remap）
</ParamField>

<ParamField body="options.temperature" type="number">
  口型同步的表现力程度，0 到 1

  格式：`double`
</ParamField>

<ParamField body="outputFileName" type="string">
  已生成输出的基础文件名，不含扩展名
</ParamField>

<ParamField body="projectId" type="string">
  可选：将此生成附加到 Sync Labs 项目
</ParamField>

<ParamField body="segments" type="object[]">
  将不同音频输入应用到不同视频片段的片段定义
</ParamField>

<ParamField body="segments[].audioInput" type="object" required>
  特定片段的音频输入配置
</ParamField>

<ParamField body="segments[].audioInput.endTime" type="number">
  可选，用于裁剪所引用音频的结束时间（秒）

  格式：`double`
</ParamField>

<ParamField body="segments[].audioInput.refId" type="string" required>
  用于此片段的音频/文本转语音输入的引用 ID
</ParamField>

<ParamField body="segments[].audioInput.startTime" type="number">
  可选，用于裁剪所引用音频的开始时间（秒）

  格式：`double`
</ParamField>

<ParamField body="segments[].endTime" type="number" required>
  片段结束时间（秒）

  格式：`double`
</ParamField>

<ParamField body="segments[].optionsOverride" type="object">
  覆盖特定片段的生成选项
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection" type="object">
  活跃说话人检测配置
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection.auto_detect" type="boolean">
  是否自动检测并将生成应用于活跃说话人
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection.bounding_boxes" type="integer[][]">
  检测到的人脸逐帧边界框数组 \[x1, y1, x2, y2]
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection.bounding_boxes_url" type="string">
  指向包含边界框的 JSON 文件的 URL
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection.coordinates" type="integer[]">
  由 frame\_number 标识的来源视频帧中的像素坐标 \[x, y]
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection.frame_number" type="integer">
  与手动选择说话人时提供的坐标相对应的帧索引
</ParamField>

<ParamField body="segments[].optionsOverride.active_speaker_detection.v3" type="boolean">
  是否使用 ASD v3
</ParamField>

<ParamField body="segments[].optionsOverride.occlusion_detection_enabled" type="boolean">
  为此片段覆盖遮挡检测设置
</ParamField>

<ParamField body="segments[].optionsOverride.sync_mode" type="string">
  为此片段覆盖同步模式
</ParamField>

<ParamField body="segments[].optionsOverride.temperature" type="number">
  为此片段覆盖 temperature（0-1）

  格式：`double`
</ParamField>

<ParamField body="segments[].startTime" type="number" required>
  片段开始时间，单位为秒

  格式：`double`
</ParamField>

<ParamField body="webhookUrl" type="string">
  用于接收生成状态更新的 Webhook URL
</ParamField>

根据 Router 在 `GET /v2/models/synclabs/sync-3/openapi.json` 提供的 schema 生成，该文档也是请求到达提供商之前用于校验调用的同一份文档。

### 输出

<ResponseField name="createdAt" type="string">
  生成内容的创建日期和时间
</ResponseField>

<ResponseField name="error" type="string">
  生成失败时的报错信息
</ResponseField>

<ResponseField name="errorCode" type="string">
  生成失败时的稳定、机器可读的错误代码
</ResponseField>

<ResponseField name="id" type="string">
  生成的唯一标识符
</ResponseField>

<ResponseField name="input" type="object[]">
  用于生成的输入项
</ResponseField>

<ResponseField name="input[].assetId" type="string">
  Sync Labs 媒体库中资源的 ID
</ResponseField>

<ResponseField name="input[].provider" type="object">
  Sync Labs 文本输入的文本转语音提供商配置
</ResponseField>

<ResponseField name="input[].provider.name" type="string" required>
  TTS 提供商名称（例如 elevenlabs）
</ResponseField>

<ResponseField name="input[].provider.script" type="string" required>
  用于生成的脚本
</ResponseField>

<ResponseField name="input[].provider.similarityBoost" type="number">
  AI 应多接近原始声音

  格式：`double`
</ResponseField>

<ResponseField name="input[].provider.stability" type="number">
  声音稳定性；较低的值会带来更丰富的情感范围

  格式：`double`
</ResponseField>

<ResponseField name="input[].provider.voiceId" type="string" required>
  Sync 声音 ID（从 Studio 克隆的声音）或 ElevenLabs 声音 ID
</ResponseField>

<ResponseField name="input[].refId" type="string">
  用于将此输入关联到分段定义的引用标识符
</ResponseField>

<ResponseField name="input[].segments_frames" type="integer[][]">
  已弃用：请改用顶层的 segments 数组
</ResponseField>

<ResponseField name="input[].segments_secs" type="number[][]">
  已弃用：请改用顶层的 segments 数组
</ResponseField>

<ResponseField name="input[].type" type="string" required>
  输入类型（video、image、audio 或 text）
</ResponseField>

<ResponseField name="input[].url" type="string">
  用于生成的媒体的 URL
</ResponseField>

<ResponseField name="model" type="string">
  用于生成的模型名称
</ResponseField>

<ResponseField name="options" type="object">
  Sync Labs 生成可用的附加选项
</ResponseField>

<ResponseField name="options.active_speaker_detection" type="object">
  活跃说话人检测配置
</ResponseField>

<ResponseField name="options.active_speaker_detection.auto_detect" type="boolean">
  是否自动检测并将生成应用到活跃说话人
</ResponseField>

<ResponseField name="options.active_speaker_detection.bounding_boxes" type="integer[][]">
  检测到的人脸逐帧边界框数组 \[x1, y1, x2, y2]
</ResponseField>

<ResponseField name="options.active_speaker_detection.bounding_boxes_url" type="string">
  包含边界框的 JSON 文件的 URL
</ResponseField>

<ResponseField name="options.active_speaker_detection.coordinates" type="integer[]">
  由 frame\_number 标识的源视频帧中的像素坐标 \[x, y]
</ResponseField>

<ResponseField name="options.active_speaker_detection.frame_number" type="integer">
  与所提供的坐标对应的帧索引，用于手动选择说话人
</ResponseField>

<ResponseField name="options.active_speaker_detection.v3" type="boolean">
  是否使用 ASD v3
</ResponseField>

<ResponseField name="options.model_mode" type="string">
  模型的编辑区域（嘴唇、面部、头部）；仅适用于 react-1
</ResponseField>

<ResponseField name="options.occlusion_detection_enabled" type="boolean">
  是否在生成过程中检测遮挡
</ResponseField>

<ResponseField name="options.prompt" type="string">
  情感提示词；仅适用于 react-1
</ResponseField>

<ResponseField name="options.sync_mode" type="string">
  如何处理视频与音频之间的时长不匹配（bounce、loop、cut\_off、silence、remap）
</ResponseField>

<ResponseField name="options.temperature" type="number">
  口型同步的表现力程度，0 到 1

  格式：`double`
</ResponseField>

<ResponseField name="outputDuration" type="number">
  输出媒体的时长，单位为秒

  格式：`double`
</ResponseField>

<ResponseField name="outputFileName" type="string">
  应用于输出媒体的已清理文件名
</ResponseField>

<ResponseField name="outputUrl" type="string">
  输出媒体的 URL
</ResponseField>

<ResponseField name="projectId" type="string">
  此生成所关联的项目 ID
</ResponseField>

<ResponseField name="segmentOutputUrl" type="string">
  分段输出媒体的 URL
</ResponseField>

<ResponseField name="segments" type="object[]">
  生成的分段
</ResponseField>

<ResponseField name="segments[].audioInput" type="object" required>
  特定分段的音频输入配置
</ResponseField>

<ResponseField name="segments[].audioInput.endTime" type="number">
  用于裁剪所引用音频的可选结束时间，单位为秒

  格式：`double`
</ResponseField>

<ResponseField name="segments[].audioInput.refId" type="string" required>
  用于此分段的音频/文本转语音输入的引用 ID
</ResponseField>

<ResponseField name="segments[].audioInput.startTime" type="number">
  用于裁剪所引用音频的可选开始时间，单位为秒

  格式：`double`
</ResponseField>

<ResponseField name="segments[].endTime" type="number" required>
  分段结束时间，单位为秒

  格式：`double`
</ResponseField>

<ResponseField name="segments[].optionsOverride" type="object">
  覆盖特定分段的生成选项
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection" type="object">
  活跃说话人检测配置
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection.auto_detect" type="boolean">
  是否自动检测并将生成应用于当前说话人
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection.bounding_boxes" type="integer[][]">
  检测到的人脸在每一帧的边界框数组 \[x1, y1, x2, y2]
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection.bounding_boxes_url" type="string">
  指向包含边界框的 JSON 文件的 URL
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection.coordinates" type="integer[]">
  由 frame\_number 标识的源视频帧中的像素坐标 \[x, y]
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection.frame_number" type="integer">
  用于手动选择说话人的、与所提供坐标对应的帧索引
</ResponseField>

<ResponseField name="segments[].optionsOverride.active_speaker_detection.v3" type="boolean">
  是否使用 ASD v3
</ResponseField>

<ResponseField name="segments[].optionsOverride.occlusion_detection_enabled" type="boolean">
  覆盖此片段的遮挡检测设置
</ResponseField>

<ResponseField name="segments[].optionsOverride.sync_mode" type="string">
  覆盖此片段的同步模式
</ResponseField>

<ResponseField name="segments[].optionsOverride.temperature" type="number">
  覆盖此片段的 temperature (0-1)

  格式：`double`
</ResponseField>

<ResponseField name="segments[].startTime" type="number" required>
  片段开始时间，单位为秒

  格式：`double`
</ResponseField>

<ResponseField name="status" type="string">
  生成的状态 (PENDING、PROCESSING、COMPLETED、FAILED、REJECTED)
</ResponseField>

<ResponseField name="synthesizedAudioUrl" type="string">
  由文本 (TTS) 输入合成的音频 URL
</ResponseField>

<ResponseField name="webhookUrl" type="string">
  webhook 端点的 URL
</ResponseField>

## 示例

### 输入

```json theme={null}
{
  "input": [
    {
      "type": "video",
      "url": "https://example.invalid/synclabs/sync-3/speaker.mp4"
    },
    {
      "type": "audio",
      "url": "https://example.invalid/synclabs/sync-3/voiceover.wav"
    }
  ],
  "options": {
    "sync_mode": "bounce"
  }
}
```

### 输出

```json theme={null}
{
  "createdAt": "2026-01-01T00:00:00.000Z",
  "id": "9a3d0c1e-0000-4000-8000-000000000000",
  "model": "sync-3",
  "outputDuration": 4.25,
  "outputFileName": "lipsync",
  "outputUrl": "https://example.invalid/synclabs/sync-3/output.mp4",
  "status": "COMPLETED"
}
```

## 发布前须知

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

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

上文任何字段描述中提到的尺寸限制，都是提供商对该字段自身的限定，引自提供商的规范。Router 会对整个请求体另行设置上限，base64 编码的媒体内容也计入其中：参见[请求体大小](/zh/development/comfy-router/limitations)。

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

<CardGroup cols={3}>
  <Card title="请求头" icon="list" href="/zh/development/comfy-router/headers">
    身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
  </Card>

  <Card title="使用 Router API" icon="code" href="/zh/development/comfy-router/api">
    模型发现、验证错误、重试与计费。
  </Card>

  <Card title="限制" icon="triangle-exclamation" href="/zh/development/comfy-router/limitations">
    Router 目前不支持的功能，以及替代方案。
  </Card>
</CardGroup>
