> ## 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로 Wan 2.7 I2V 사용하기

> Comfy Router를 통해 HTTP로 wan/wan2.7-i2v를 호출하는 Python, TypeScript, cURL 스니펫과 요청 필드 및 결과 형태

Wan 2.7 I2V API 레퍼런스입니다. Wan 2.7 이미지 기반 비디오 생성은 media 목록을 통해 제공되는 첫 프레임에 애니메이션을 적용하며, 이 목록은 마지막 프레임, 구동 오디오 트랙, 오프닝 클립도 받을 수 있습니다.

## 빠른 시작

[Comfy 워크스페이스](https://platform.comfy.org/profile/api-keys)에서 키를 생성하고 `COMFY_API_KEY`로 내보내세요. Python 및 TypeScript 스니펫은 Comfy SDK(`pip install comfy-sdk`, `npm install @comfyorg/sdk`)를 사용하며, cURL 스니펫은 동일한 호출을 raw HTTP로 수행합니다.

**모델 ID:** `wan/wan2.7-i2v`

**엔드포인트:** `POST https://api.comfy.org/v2/models/wan/wan2.7-i2v`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "wan/wan2.7-i2v",
              {
                  "input": {
                      "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
                      "media": [
                          {
                              "type": "first_frame",
                              "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"])
      ```

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

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      type Result = { output: { video_url: string } };
      const { data } = await comfy.models.run<Result>("wan/wan2.7-i2v", {
        input: {
          prompt: "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
          media: [
            {
              type: "first_frame",
              url: "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png",
            },
          ],
        },
        parameters: {
          resolution: "720P",
          duration: 5,
        },
      });

      console.log("video:", data.output.video_url);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/wan/wan2.7-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\",\"media\":[{\"type\":\"first_frame\",\"url\":\"https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png\"}]}, \"parameters\": {\"resolution\":\"720P\",\"duration\":5}}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "wan/wan2.7-i2v",
              {
                  "input": {
                      "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
                      "media": [
                          {
                              "type": "first_frame",
                              "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)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print("video:", result["output"]["video_url"])
      ```

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

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      type Result = { output: { video_url: string } };
      const handle = await comfy.models.submit<Result>("wan/wan2.7-i2v", {
        input: {
          prompt: "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
          media: [
            {
              type: "first_frame",
              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); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      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. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/wan/wan2.7-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\",\"media\":[{\"type\":\"first_frame\",\"url\":\"https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png\"}]}, \"parameters\": {\"resolution\":\"720P\",\"duration\":5}}"

      # 2. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/wan/wan2.7-i2v/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/wan/wan2.7-i2v/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## 스키마

### 입력

<ParamField body="input" type="object" required>
  프롬프트 단어 등 기본 정보를 입력합니다.
</ParamField>

<ParamField body="input.audio_url" type="string">
  오디오 파일 다운로드 URL입니다. 지원 형식: mp3 및 wav. reference\_video\_urls와 함께 사용할 수 없습니다.
</ParamField>

<ParamField body="input.img_url" type="string">
  첫 프레임 이미지 URL 또는 Base64로 인코딩된 데이터입니다. I2V 모델에 필수입니다. 이미지 형식: JPEG, JPG, PNG, BMP, WEBP. 해상도: 360-2000 픽셀. 파일 크기: 최대 10MB.
</ParamField>

<ParamField body="input.media" type="object[]">
  wan2.7 및 wan3.0 모델용 미디어 에셋 목록입니다. 비디오 생성을 위한 참조 자료(이미지, 오디오, 비디오)를
  지정합니다. 각 요소는 type과 url 필드를 포함합니다.
  지원되는 type 값은 모델에 따라 다릅니다:

  * wan2.7-i2v: first\_frame, last\_frame, driving\_audio, first\_clip
  * wan2.7-r2v: reference\_image, reference\_video
  * wan2.7-videoedit: video, reference\_image
  * wan3.0-video: 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 유형은 동일한
    요청 내에서 상호 배타적입니다. 배열 순서는 프롬프트에서 에셋의 참조 순서(이미지 1, 비디오 1,
    오디오 1, ...)를 정의합니다.
</ParamField>

<ParamField body="input.media[].type" type="string" required>
  미디어 에셋 유형

  가능한 값: `first_frame`, `last_frame`, `driving_audio`, `first_clip`, `reference_image`, `reference_video`, `reference_audio`, `video`, `file`, `link`
</ParamField>

<ParamField body="input.media[].url" type="string" required>
  미디어 파일의 URL(공개 HTTP/HTTPS URL 또는 OSS 임시 URL)
</ParamField>

<ParamField body="input.negative_prompt" type="string">
  네거티브 프롬프트는 비디오 화면에 나타나지 않았으면 하는 내용을 설명하는 데 사용됩니다
</ParamField>

<ParamField body="input.prompt" type="string">
  텍스트 프롬프트. 중국어와 영어를 지원하며 길이는 800자를 초과할 수 없습니다
  (wan3.0-video의 경우 최대 20,000자이며, 한도를 초과한 내용은 잘립니다).
  참조 비디오가 여러 개인 wan2.6-r2v의 경우 'character1', 'character2' 등을 사용하여
  참조 비디오 순서대로 피사체를 지칭합니다. 예: "Character1이 길가에서 노래하고, Character2가 옆에서 춤춘다"
  wan3.0-video 참조 모드의 경우 'Image 1', 'Video 1', 'Audio 1' 등을 사용하여 media 배열 내
  해당 순서에 있는 미디어 에셋을 지칭합니다.
</ParamField>

<ParamField body="input.reference_video_urls" type="string[]">
  wan2.6-r2v 모델 전용 참조 비디오 URL입니다. 1-3개의 비디오 URL 배열입니다.
  입력 제한:

  * 형식: mp4, mov
  * 개수: 비디오 1-3개
  * 단일 비디오 길이: 2-30초
  * 단일 파일 크기: 최대 30MB
  * audio\_url과 함께 사용할 수 없음
    참조 재생 시간: 단일 비디오 최대 5초, 비디오 두 개는 각각 최대 2.5초, 세 개는 그에 비례하여 더 짧습니다.
    과금: 실제 사용된 참조 재생 시간을 기준으로 합니다.
</ParamField>

<ParamField body="input.template" type="string">
  비디오 효과 템플릿 이름입니다. 선택 사항입니다. 현재 지원: squish, flying, carousel. 사용 시 prompt 파라미터는 무시됩니다.
</ParamField>

<ParamField body="model" type="string">
  호출할 모델의 ID입니다. 이 컴포넌트에서는 제약되지 않습니다. Comfy Router가 `POST /v2/models/wan/{model}`의 `{model}` 경로 세그먼트에서 이를 채우므로 Router 호출자는 생략합니다. `POST /proxy/wan/api/v1/services/aigc/video-generation/video-synthesis`에 대한 직접 v1 호출은 반드시 이를 제공해야 하며, 허용되는 표기법의 enum은 해당 오퍼레이션 자체의 컴포넌트인 `WanVideoGenerationRequest`에 있습니다.
</ParamField>

<ParamField body="parameters" type="object">
  비디오 처리 파라미터
</ParamField>

<ParamField body="parameters.audio" type="boolean" default="true">
  비디오에 오디오를 추가할지 여부
</ParamField>

<ParamField body="parameters.audio_setting" type="string" default="&#x22;auto&#x22;">
  wan2.7-videoedit 모델의 비디오 오디오 설정입니다.

  * auto (기본값): 모델이 프롬프트 콘텐츠를 기반으로 지능적으로 판단합니다
  * origin: 입력 비디오의 원본 오디오를 강제로 유지합니다

    가능한 값: `auto`, `origin`
</ParamField>

<ParamField body="parameters.duration" type="integer" default="5">
  생성된 비디오의 재생 시간(초)입니다:

  * wan2.5 모델: 5초 또는 10초
  * wan2.6-t2v, wan2.6-i2v: 5초, 10초 또는 15초
  * wan2.6-r2v: 5초 또는 10초만 가능(15초 미지원)
  * 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`
</ParamField>

<ParamField body="parameters.prompt_extend" type="boolean" default="true">
  프롬프트 지능형 재작성 활성화 여부입니다. 기본값은 참입니다
</ParamField>

<ParamField body="parameters.ratio" type="string">
  생성된 비디오의 화면 비율입니다. wan2.7 및 wan3.0 모델 전용입니다.
  wan2.7 모델의 경우 제공되지 않으면 해상도 등급에 따라 기본값이 정해집니다.
  wan3.0-video의 경우 adaptive(기본값)가 입력 미디어의 비율과 의도에 따라 적절한
  화면 비율을 자동으로 추천합니다.

  가능한 값: `adaptive`, `16:9`, `9:16`, `1:1`, `4:3`, `3:4`
</ParamField>

<ParamField body="parameters.resolution" type="string">
  해상도 등급입니다. 지원되는 값은 모델에 따라 다릅니다:

  * wan2.5-i2v-preview: 480P, 720P, 1080P
  * wan2.6-i2v: 720P, 1080P만 가능(480P 미지원)
  * wan2.7 모델(i2v, t2v, r2v, videoedit): 720P, 1080P(기본값 1080P)
  * wan3.0-video, wan3.0-video-prime: 480P, 720P, 1080P(업스트림 기본값 1080P)
    이 프록시는 resolution과 size를 모두 제공하지 않는 비디오 생성 요청을 거부합니다.
    해상도 등급이 과금 요율을 결정하기 때문입니다.

    가능한 값: `480P`, `720P`, `1080P`
</ParamField>

<ParamField body="parameters.seed" type="integer">
  모델이 생성하는 콘텐츠의 무작위성을 제어하는 데 사용되는 난수 시드입니다

  범위: `0`부터 `2147483647`까지
</ParamField>

<ParamField body="parameters.shot_type" type="string" default="&#x22;single&#x22;">
  지능형 멀티 렌즈 제어입니다. prompt\_extend가 활성화된 경우에만 동작합니다.
  wan2.6 및 wan2.7-r2v 모델용입니다.

  * single: 단일 샷 비디오 (기본값)
  * multi: 멀티 샷 비디오

    가능한 값: `multi`, `single`
</ParamField>

<ParamField body="parameters.size" type="string">
  너비*높이 형식의 비디오 해상도입니다. 지원되는 해상도는 모델에 따라 다릅니다:
  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
</ParamField>

<ParamField body="parameters.watermark" type="boolean" default="false">
  워터마크 로고를 추가할지 여부이며, 워터마크는 오른쪽 아래 모서리에 위치합니다
</ParamField>

`GET /v2/models/wan/wan2.7-i2v/openapi.json`에서 Router가 제공하는 스키마에서 생성되었으며, 이는 요청이 공급자에 도달하기 전에 호출을 검증하는 데 사용하는 동일한 문서입니다.

### 출력

<ResponseField name="output" type="object" required />

<ResponseField name="output.actual_prompt" type="string">
  지능형 재작성 이후의 실제 프롬프트 (비디오 작업용)
</ResponseField>

<ResponseField name="output.check_audio" type="string">
  오디오 생성이 포함된 I2V 작업의 오디오 URL
</ResponseField>

<ResponseField name="output.code" type="string">
  실패한 요청의 오류 코드 (요청이 성공하면 반환되지 않음)
</ResponseField>

<ResponseField name="output.end_time" type="string">
  작업 완료 시간
</ResponseField>

<ResponseField name="output.message" type="string">
  실패한 요청에 대한 상세 정보 (요청이 성공하면 반환되지 않음)
</ResponseField>

<ResponseField name="output.orig_prompt" type="string">
  원본 입력 프롬프트 (비디오 작업용)
</ResponseField>

<ResponseField name="output.results" type="object[]">
  이미지 생성 작업의 작업 결과 목록
</ResponseField>

<ResponseField name="output.results[].actual_prompt" type="string">
  지능형 재작성 이후의 실제 프롬프트 (활성화된 경우)
</ResponseField>

<ResponseField name="output.results[].code" type="string">
  이미지 오류 코드 (일부 작업이 실패할 때 반환됨)
</ResponseField>

<ResponseField name="output.results[].message" type="string">
  이미지 오류 정보 (일부 작업이 실패할 때 반환됨)
</ResponseField>

<ResponseField name="output.results[].orig_prompt" type="string">
  원본 입력 프롬프트
</ResponseField>

<ResponseField name="output.results[].url" type="string">
  생성된 이미지 URL 주소
</ResponseField>

<ResponseField name="output.scheduled_time" type="string">
  작업 실행 시간
</ResponseField>

<ResponseField name="output.submit_time" type="string">
  작업 제출 시간
</ResponseField>

<ResponseField name="output.task_id" type="string" required>
  작업 ID
</ResponseField>

<ResponseField name="output.task_metrics" type="object">
  이미지 생성 작업의 작업 결과 통계
</ResponseField>

<ResponseField name="output.task_metrics.FAILED" type="integer">
  실패한 작업 수
</ResponseField>

<ResponseField name="output.task_metrics.SUCCEEDED" type="integer">
  성공한 작업 수
</ResponseField>

<ResponseField name="output.task_metrics.TOTAL" type="integer">
  전체 작업 수
</ResponseField>

<ResponseField name="output.task_status" type="string" required>
  작업 상태

  가능한 값: `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, `UNKNOWN`
</ResponseField>

<ResponseField name="output.video_url" type="string">
  완료된 비디오 생성 작업의 비디오 URL. 링크 유효 기간은 24시간
</ResponseField>

<ResponseField name="request_id" type="string" required>
  고유 요청 식별자
</ResponseField>

<ResponseField name="usage" type="object">
  출력 정보 통계. 성공한 결과만 집계됩니다
</ResponseField>

<ResponseField name="usage.SR" type="integer">
  비디오 해상도 등급 (I2V 및 wan3.0-video 작업)
</ResponseField>

<ResponseField name="usage.duration" type="number">
  생성된 비디오의 재생 시간(초) (I2V 및 wan3.0-video 작업)
</ResponseField>

<ResponseField name="usage.fps" type="integer">
  생성된 비디오의 프레임 레이트 (wan3.0-video 작업)
</ResponseField>

<ResponseField name="usage.image_count" type="integer">
  생성된 이미지 수 (T2I 및 I2I 작업)
</ResponseField>

<ResponseField name="usage.input_video_duration" type="number">
  입력 비디오의 재생 시간(초), 비디오 입력이 없으면 0.0 (wan3.0-video 작업)
</ResponseField>

<ResponseField name="usage.output_video_duration" type="number">
  출력 비디오의 재생 시간(초) (wan3.0-video 작업)
</ResponseField>

<ResponseField name="usage.ratio" type="string">
  생성된 비디오의 화면 비율, 예: 16:9 (wan3.0-video 작업)
</ResponseField>

<ResponseField name="usage.size" type="string">
  이미지 해상도 (T2I 및 I2I 작업)
</ResponseField>

<ResponseField name="usage.video_count" type="integer">
  생성된 비디오 수 (T2V 작업)
</ResponseField>

<ResponseField name="usage.video_duration" type="number">
  생성된 비디오의 재생 시간(초) (T2V 작업)
</ResponseField>

<ResponseField name="usage.video_ratio" type="string">
  비디오 해상도 비율 (T2V 작업)
</ResponseField>

<ResponseField name="code" type="string">
  실패한 요청의 오류 코드로, `output` 아래가 아니라 envelope의 ROOT에 보고됩니다 (요청이 성공하면 반환되지 않음).
</ResponseField>

<ResponseField name="message" type="string">
  실패한 요청에 대한 상세 정보로, `output` 아래가 아니라 envelope의 ROOT에 보고됩니다 (요청이 성공하면 반환되지 않음). `output.message`로 대체하기 전에 이 값을 먼저 확인하세요.
</ResponseField>

## 예시

### 입력

```json theme={null}
{
  "input": {
    "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
    "media": [
      {
        "type": "first_frame",
        "url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "duration": 5
  }
}
```

### 출력

```json theme={null}
{
  "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`를 생성하고 자동 재시도에서 재사용합니다. 수동 재시도 시에는 원래 키를 재사용하세요. Router는 연결을 최대 10분간 유지할 수 있습니다.

요청이 실패하면 Router는 이유를 설명하는 `X-Comfy-Error-Type` 응답 헤더를 보냅니다. `422`는 Router가 프로바이더를 호출하기 전에 입력을 거부했음을 의미합니다. 생성된 에셋은 [결과 URL이 만료](/ko/development/comfy-router/reference#결과-에셋)될 수 있으므로 즉시 다운로드하세요.

<CardGroup cols={3}>
  <Card title="헤더" icon="list" href="/ko/development/comfy-router/quickstart">
    인증, 멱등성, 요청 ID, 오류 분류, 재시도 간격, 지출 한도.
  </Card>

  <Card title="Router API 사용" icon="code" href="/ko/development/comfy-router/quickstart">
    모델 검색, 유효성 검사 오류, 재시도, 과금.
  </Card>

  <Card title="제한 사항" icon="triangle-exclamation" href="/ko/development/comfy-router/limitations">
    Router가 현재 지원하지 않는 기능과 대체 방법.
  </Card>
</CardGroup>
