> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-sync-comfy-api-v2-spec.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy Router로 Veo 3.1 Lite Generate 001 사용하기

> Comfy Router를 통해 veo/veo-3.1-lite-generate-001을 호출합니다: 엔드포인트, 요청 형태, 그리고 Router가 반환하는 응답.

Veo에서 Comfy Router를 통해 제공되는 `veo/veo-3.1-lite-generate-001`의 API 레퍼런스입니다.

## 빠른 시작

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

**모델 ID:** `veo/veo-3.1-lite-generate-001`

**엔드포인트:** `POST https://api.comfy.org/v2/models/veo/veo-3.1-lite-generate-001`

<Tabs>
  <Tab title="결과 기다리기">
    <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(
              "veo/veo-3.1-lite-generate-001",
              {
                  "instances": [
                      {
                          "prompt": "a single red maple leaf falling onto still water, slow motion",
                      },
                  ],
                  "parameters": {
                      "durationSeconds": 4,
                      "generateAudio": False,
                      "sampleCount": 1,
                  },
              },
          )

      print(result)
      ```

      ```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.
      const { data } = await comfy.models.run("veo/veo-3.1-lite-generate-001", {
        instances: [
          {
            prompt: "a single red maple leaf falling onto still water, slow motion",
          },
        ],
        parameters: {
          durationSeconds: 4,
          generateAudio: false,
          sampleCount: 1,
        },
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/veo/veo-3.1-lite-generate-001 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"instances\": [{\"prompt\":\"a single red maple leaf falling onto still water, slow motion\"}], \"parameters\": {\"durationSeconds\":4,\"generateAudio\":false,\"sampleCount\":1}}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="대기열에 넣고 나중에 수집">
    동일한 본문을 `POST https://api.comfy.org/v2/models/veo/veo-3.1-lite-generate-001/requests`로 전송합니다. Router는 실행이 승인되는 즉시 `request_id`와 함께 `201`로 응답하며, 결과는 준비가 완료되면 이 프로세스에서든 다른 프로세스에서든 수집됩니다. [대기열 전달](/ko/development/comfy-router/queue)에서 상태, 취소, 수집 과정을 자세히 설명합니다.

    <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(
              "veo/veo-3.1-lite-generate-001",
              {
                  "instances": [
                      {
                          "prompt": "a single red maple leaf falling onto still water, slow motion",
                      },
                  ],
                  "parameters": {
                      "durationSeconds": 4,
                      "generateAudio": False,
                      "sampleCount": 1,
                  },
              },
          )
          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(result)
      ```

      ```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.
      const handle = await comfy.models.submit("veo/veo-3.1-lite-generate-001", {
        instances: [
          {
            prompt: "a single red maple leaf falling onto still water, slow motion",
          },
        ],
        parameters: {
          durationSeconds: 4,
          generateAudio: false,
          sampleCount: 1,
        },
      });
      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();

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

      ```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/veo/veo-3.1-lite-generate-001/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"instances\": [{\"prompt\":\"a single red maple leaf falling onto still water, slow motion\"}], \"parameters\": {\"durationSeconds\":4,\"generateAudio\":false,\"sampleCount\":1}}"

      # 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/veo/veo-3.1-lite-generate-001/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/veo/veo-3.1-lite-generate-001/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## 스키마

### 입력

<ParamField body="instances" type="object[]" />

<ParamField body="instances[].cameraControl" type="string">
  카메라 모션 유형. 이미지가 제공되어야 합니다.

  가능한 값: `fixed`, `pan_left`, `pan_right`, `tilt_up`, `tilt_down`, `truck_left`, `truck_right`, `pedestal_up`, `pedestal_down`, `push_in`, `pull_out`
</ParamField>

<ParamField body="instances[].image" type="object">
  비디오 생성을 안내할 선택적 첫 프레임 이미지
</ParamField>

<ParamField body="instances[].image.bytesBase64Encoded" type="string (byte)">
  Base64로 인코딩된 이미지 데이터

  형식: `byte`
</ParamField>

<ParamField body="instances[].image.gcsUri" type="string">
  이미지의 Cloud Storage URI
</ParamField>

<ParamField body="instances[].image.mimeType" type="string">
  이미지의 MIME 유형 (image/jpeg 또는 image/png)

  가능한 값: `image/jpeg`, `image/png`
</ParamField>

<ParamField body="instances[].lastFrame" type="object">
  선택적 마지막 프레임 이미지. image와 함께 사용하여 첫 프레임과 마지막 프레임 사이의 비디오를 생성합니다. Veo 3.0+ 모델에서 지원됩니다.
</ParamField>

<ParamField body="instances[].lastFrame.bytesBase64Encoded" type="string (byte)">
  Base64로 인코딩된 이미지 데이터

  형식: `byte`
</ParamField>

<ParamField body="instances[].lastFrame.gcsUri" type="string">
  이미지의 Cloud Storage URI
</ParamField>

<ParamField body="instances[].lastFrame.mimeType" type="string">
  이미지의 MIME 유형 (image/jpeg 또는 image/png)

  가능한 값: `image/jpeg`, `image/png`
</ParamField>

<ParamField body="instances[].mask" type="object">
  비디오 편집용 선택적 마스크. 입력 비디오에 적용됩니다.
</ParamField>

<ParamField body="instances[].mask.bytesBase64Encoded" type="string (byte)">
  Base64로 인코딩된 마스크 바이트

  형식: `byte`
</ParamField>

<ParamField body="instances[].mask.gcsUri" type="string">
  마스크 파일의 Cloud Storage URI
</ParamField>

<ParamField body="instances[].mask.maskMode" type="string">
  마스크가 적용되는 방식

  가능한 값: `insert`, `remove`, `remove_static`, `outpaint`
</ParamField>

<ParamField body="instances[].mask.mimeType" type="string">
  마스크의 MIME 유형 (image/png, image/jpeg, image/webp 또는 비디오 형식)
</ParamField>

<ParamField body="instances[].prompt" type="string" required>
  생성할 비디오에 대한 텍스트 설명
</ParamField>

<ParamField body="instances[].referenceImages" type="object[]">
  비디오 생성을 안내할 선택적 참조 이미지. 최대 3개의 asset 이미지 또는 1개의 style 이미지를 지원합니다. Veo 3.1 모델(미리보기)에서 지원됩니다.
</ParamField>

<ParamField body="instances[].referenceImages[].image" type="object" required />

<ParamField body="instances[].referenceImages[].image.bytesBase64Encoded" type="string (byte)">
  Base64로 인코딩된 이미지 데이터

  형식: `byte`
</ParamField>

<ParamField body="instances[].referenceImages[].image.gcsUri" type="string">
  이미지의 Cloud Storage URI
</ParamField>

<ParamField body="instances[].referenceImages[].image.mimeType" type="string">
  이미지의 MIME 유형 (image/jpeg 또는 image/png)

  가능한 값: `image/jpeg`, `image/png`
</ParamField>

<ParamField body="instances[].referenceImages[].referenceId" type="string">
  참조 이미지의 선택적 식별자
</ParamField>

<ParamField body="instances[].referenceImages[].referenceType" type="string" required>
  참조 이미지의 유형

  가능한 값: `asset`, `style`
</ParamField>

<ParamField body="instances[].video" type="object">
  비디오 확장 또는 편집을 위한 선택적 입력 비디오. image 및 referenceImages와 함께 사용할 수 없습니다.
</ParamField>

<ParamField body="instances[].video.bytesBase64Encoded" type="string (byte)">
  Base64로 인코딩된 비디오 바이트

  형식: `byte`
</ParamField>

<ParamField body="instances[].video.gcsUri" type="string">
  입력 비디오의 Cloud Storage URI
</ParamField>

<ParamField body="instances[].video.mimeType" type="string">
  비디오의 MIME 유형

  가능한 값: `video/mov`, `video/mpeg`, `video/mp4`, `video/mpg`, `video/avi`, `video/wmv`, `video/mpegps`, `video/x-flv`
</ParamField>

<ParamField body="parameters" type="object" />

<ParamField body="parameters.aspectRatio" type="string">
  생성된 비디오의 화면 비율. 기본값: 16:9

  가능한 값: `16:9`, `9:16`
</ParamField>

<ParamField body="parameters.compressionQuality" type="string">
  비디오 압축 품질. 기본값: optimized

  가능한 값: `optimized`, `lossless`
</ParamField>

<ParamField body="parameters.durationSeconds" type="number">
  생성된 비디오의 목표 재생 시간(초). Veo 2: 5-8. Veo 3/3.1: 4, 6 또는 8. 기본값: 8
</ParamField>

<ParamField body="parameters.enhancePrompt" type="boolean">
  더 높은 품질을 위해 프롬프트를 자동으로 개선합니다. 기본값은 참입니다.
</ParamField>

<ParamField body="parameters.fps" type="integer">
  생성된 비디오의 초당 프레임 수
</ParamField>

<ParamField body="parameters.generateAudio" type="boolean">
  비디오와 함께 오디오를 생성할지 여부. 기본값은 참입니다. Veo 3.0+ 모델에서 지원됩니다.
</ParamField>

<ParamField body="parameters.negativePrompt" type="string">
  생성된 비디오에서 피해야 할 내용을 설명하는 텍스트
</ParamField>

<ParamField body="parameters.personGeneration" type="string">
  생성된 비디오의 사람을 제어합니다. 기본값: allow\_adult

  가능한 값: `dont_allow`, `allow_adult`, `allowAll`
</ParamField>

<ParamField body="parameters.pubsubTopic" type="string">
  진행 상황 업데이트를 위한 Cloud Pub/Sub 주제 (projects/\{project}/topics/\{topic})
</ParamField>

<ParamField body="parameters.resizeMode" type="string">
  입력 이미지의 크기 조정 방식. 기본값: pad

  가능한 값: `pad`, `crop`
</ParamField>

<ParamField body="parameters.resolution" type="string">
  출력 비디오 해상도. Veo 3.0+ 모델에서 지원됩니다. 기본값: 720p

  가능한 값: `720p`, `1080p`, `4k`
</ParamField>

<ParamField body="parameters.sampleCount" type="integer">
  생성할 비디오 수입니다. 지정하지 않으면 비디오 1개가 생성됩니다.

  범위: `1` \~ `4`
</ParamField>

<ParamField body="parameters.seed" type="integer">
  결정적 출력을 위한 랜덤 시드입니다. sampleCount > 1이면 비디오마다 서로 다른 시드가 사용됩니다.

  형식: `uint32`
</ParamField>

<ParamField body="parameters.storageUri" type="string">
  생성된 비디오를 저장하기 위한 Cloud Storage URI (gs\://)
</ParamField>

<ParamField body="parameters.task" type="string">
  비디오 생성 요청의 작업 유형

  가능한 값: `textToVideo`, `imageToVideo`, `referenceToVideo`, `edit`, `extend`, `upscale`
</ParamField>

Router가 `GET /v2/models/veo/veo-3.1-lite-generate-001/openapi.json`에서 제공하는 스키마를 기반으로 생성되었으며, 이는 요청이 공급자에 도달하기 전에 호출을 검증하는 데 사용하는 것과 동일한 문서입니다.

### 출력

<ResponseField name="done" type="boolean">
  작업이 완료되었는지 여부
</ResponseField>

<ResponseField name="error" type="object">
  오류 세부 정보이며, 작업이 실패한 경우 표시됩니다
</ResponseField>

<ResponseField name="error.code" type="integer">
  gRPC 오류 코드
</ResponseField>

<ResponseField name="error.message" type="string">
  오류 메시지
</ResponseField>

<ResponseField name="name" type="string">
  작업 리소스 이름
</ResponseField>

<ResponseField name="response" type="object">
  예측 응답이며, done이 참일 때 표시됩니다
</ResponseField>

<ResponseField name="response.@type" type="string" />

<ResponseField name="response.raiMediaFilteredCount" type="integer">
  책임 있는 AI 정책에 의해 필터링된 비디오 수
</ResponseField>

<ResponseField name="response.raiMediaFilteredReasons" type="string[]">
  책임 있는 AI 정책에 의해 비디오가 필터링된 이유
</ResponseField>

<ResponseField name="response.videos" type="object[]" />

<ResponseField name="response.videos[].bytesBase64Encoded" type="string">
  Base64로 인코딩된 비디오 콘텐츠
</ResponseField>

<ResponseField name="response.videos[].gcsUri" type="string">
  생성된 비디오의 Cloud Storage URI
</ResponseField>

<ResponseField name="response.videos[].mimeType" type="string">
  비디오 MIME 유형(video/mp4)
</ResponseField>

## 예시

### 입력

```json theme={null}
{
  "instances": [
    {
      "prompt": "a single red maple leaf falling onto still water, slow motion"
    }
  ],
  "parameters": {
    "durationSeconds": 4,
    "generateAudio": false,
    "sampleCount": 1
  }
}
```

### 출력

```json theme={null}
{
  "done": true,
  "name": "projects/example-project/locations/us-central1/publishers/google/models/veo-3.1-fast-generate-001/operations/1a2b3c4d",
  "response": {
    "@type": "type.googleapis.com/cloud.ai.large_models.vision.GenerateVideoResponse",
    "raiMediaFilteredCount": 0,
    "videos": [
      {
        "gcsUri": "https://storage.googleapis.com/EXAMPLE_BUCKET/veo/USER_ID/REQUEST_ID/sample_0.mp4",
        "mimeType": "video/mp4"
      }
    ]
  }
}
```

## 배포 전 확인

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>
