> ## 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로 Veo 2.0 Generate 001 사용하기

> Comfy Router를 통해 veo/veo-2.0-generate-001을 호출합니다. 엔드포인트, 요청 형태, Router가 반환하는 응답을 설명합니다.

Comfy Router가 Veo에서 제공하는 `veo/veo-2.0-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 스니펫은 동일한 호출을 raw HTTP로 수행합니다.

**모델 ID:** `veo/veo-2.0-generate-001`

**엔드포인트:** `POST https://api.comfy.org/v2/models/veo/veo-2.0-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-2.0-generate-001",
              {
                  "instances": [
                      {
                          "prompt": "a single red maple leaf falling onto still water, slow motion",
                      },
                  ],
                  "parameters": {
                      "durationSeconds": 6,
                      "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-2.0-generate-001", {
        instances: [
          {
            prompt: "a single red maple leaf falling onto still water, slow motion",
          },
        ],
        parameters: {
          durationSeconds: 6,
          sampleCount: 1,
        },
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/veo/veo-2.0-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\":6,\"sampleCount\":1}}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="실행 대기열에 넣고 나중에 수집하기">
    동일한 본문을 `POST https://api.comfy.org/v2/models/veo/veo-2.0-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-2.0-generate-001",
              {
                  "instances": [
                      {
                          "prompt": "a single red maple leaf falling onto still water, slow motion",
                      },
                  ],
                  "parameters": {
                      "durationSeconds": 6,
                      "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-2.0-generate-001", {
        instances: [
          {
            prompt: "a single red maple leaf falling onto still water, slow motion",
          },
        ],
        parameters: {
          durationSeconds: 6,
          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-2.0-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\":6,\"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-2.0-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-2.0-generate-001/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## 스키마

### 입력

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

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

<ParamField body="instances[].image.bytesBase64Encoded" type="string (byte)">
  형식: `byte`
</ParamField>

<ParamField body="instances[].image.gcsUri" type="string" />

<ParamField body="instances[].image.mimeType" type="string" />

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

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

<ParamField body="parameters.aspectRatio" type="string" />

<ParamField body="parameters.durationSeconds" type="integer" />

<ParamField body="parameters.enhancePrompt" type="boolean" />

<ParamField body="parameters.negativePrompt" type="string" />

<ParamField body="parameters.personGeneration" type="string">
  생성된 비디오에 등장하는 사람을 제어합니다. `dont_allow`, `allow_adult`, `allowAll`은 Vertex AI 자체 표기이며, VeoGenVidRequest가 동일한 필드에 대해 게시하는 값입니다. `ALLOW`와 `BLOCK`은 이 컴포넌트가 Router에서 작성되기 이전에 이를 기반으로 생성된 클라이언트와의 호환성을 위해 유지됩니다. Veo2GenVidRequest 상단의 참고 사항을 확인하세요.

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

<ParamField body="parameters.sampleCount" type="integer" />

<ParamField body="parameters.seed" type="integer">
  형식: `uint32`
</ParamField>

<ParamField body="parameters.storageUri" type="string">
  비디오를 업로드할 선택적 Cloud Storage URI
</ParamField>

Router가 `GET /v2/models/veo/veo-2.0-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": 6,
    "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>
