> ## 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로 Kling 3.0 Turbo 사용하기

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

`kling/kling-3.0-turbo`에 대한 API 레퍼런스이며, Kling에서 Comfy Router를 통해 제공됩니다.

## 빠른 시작

[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로 수행한 것입니다.

**Model ID:** `kling/kling-3.0-turbo`

**Endpoint:** `POST https://api.comfy.org/v2/models/kling/kling-3.0-turbo`

<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(
              "kling/kling-3.0-turbo",
              {
                  "prompt": "A neon-lit alley in the rain, slow dolly forward.",
                  "settings": {
                      "aspect_ratio": "16:9",
                      "duration": 5,
                      "resolution": "1080p",
                  },
              },
          )

      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("kling/kling-3.0-turbo", {
        prompt: "A neon-lit alley in the rain, slow dolly forward.",
        settings: {
          aspect_ratio: "16:9",
          duration: 5,
          resolution: "1080p",
        },
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/kling/kling-3.0-turbo \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A neon-lit alley in the rain, slow dolly forward.\", \"settings\": {\"aspect_ratio\":\"16:9\",\"duration\":5,\"resolution\":\"1080p\"}}"
      ```
    </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(
              "kling/kling-3.0-turbo",
              {
                  "prompt": "A neon-lit alley in the rain, slow dolly forward.",
                  "settings": {
                      "aspect_ratio": "16:9",
                      "duration": 5,
                      "resolution": "1080p",
                  },
              },
          )
          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("kling/kling-3.0-turbo", {
        prompt: "A neon-lit alley in the rain, slow dolly forward.",
        settings: {
          aspect_ratio: "16:9",
          duration: 5,
          resolution: "1080p",
        },
      });
      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/kling/kling-3.0-turbo/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A neon-lit alley in the rain, slow dolly forward.\", \"settings\": {\"aspect_ratio\":\"16:9\",\"duration\":5,\"resolution\":\"1080p\"}}"

      # 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/kling/kling-3.0-turbo/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/kling/kling-3.0-turbo/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## 스키마

### 입력

<ParamField body="options" type="object">
  콜백 주소와 워터마크 옵션 등 일반 구성입니다.
</ParamField>

<ParamField body="options.callback_url" type="string">
  작업 결과에 대한 콜백 알림 URL입니다. 작업 상태가 변경되면 서버가 알림을 보냅니다.
</ParamField>

<ParamField body="options.external_task_id" type="string">
  사용자 지정 작업 ID입니다. 시스템이 생성한 작업 ID를 덮어쓰지는 않지만 조회에 사용할 수 있습니다. 단일 사용자 계정 내에서 고유해야 합니다.
</ParamField>

<ParamField body="options.watermark_info" type="object">
  워터마크가 적용된 결과를 동시에 생성할지 여부입니다. 사용자 지정 워터마크는 지원되지 않습니다.
</ParamField>

<ParamField body="options.watermark_info.enabled" type="boolean">
  true이면 워터마크가 적용된 결과를 생성하고, false이면 생성하지 않습니다. 기본값은 false입니다.
</ParamField>

<ParamField body="prompt" type="string" required>
  긍정 및 부정 설명을 모두 포함할 수 있는 프롬프트입니다. 길이는 2500자 미만을 권장합니다. 멀티 샷 비디오는 "shot n, m, words; shot n, m, words;" 형식을 사용합니다.
</ParamField>

<ParamField body="settings" type="object">
  해상도, 화면 비율, 재생 시간 등 출력 구성입니다.
</ParamField>

<ParamField body="settings.aspect_ratio" type="string">
  생성된 프레임의 화면 비율(너비:높이)입니다. "16:9", "9:16", "1:1" 중 하나입니다. 기본값은 "16:9"입니다.

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

<ParamField body="settings.duration" type="integer">
  비디오 길이(초)입니다. 지원 값은 3부터 15까지입니다. 기본값은 5입니다.

  범위: `3` \~ `15`
</ParamField>

<ParamField body="settings.resolution" type="string">
  생성된 비디오의 선명도입니다. "720p" 또는 "1080p" 중 하나입니다. 기본값은 "720p"입니다.

  사용 가능한 값: `720p`, `1080p`
</ParamField>

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

### 출력

<ResponseField name="code" type="integer">
  오류 코드입니다. 0은 성공을 나타냅니다.
</ResponseField>

<ResponseField name="data" type="object[]">
  쿼리와 일치하는 작업입니다.
</ResponseField>

<ResponseField name="data[].billing" type="object[]">
  작업의 청구 세부 정보입니다.
</ResponseField>

<ResponseField name="data[].billing[].amount" type="string">
  소비 금액이며 소수점 둘째 자리까지 정확합니다.
</ResponseField>

<ResponseField name="data[].billing[].charge_type" type="string">
  소비 계정 유형입니다. "cash"는 잔액, "unit"은 리소스 패키지를 의미합니다.
</ResponseField>

<ResponseField name="data[].billing[].package_type" type="string">
  사용 가능한 리소스 번들 유형입니다(charge\_type이 "unit"인 경우에만 존재). "video", "image", "audio" 중 하나입니다.
</ResponseField>

<ResponseField name="data[].create_time" type="integer">
  작업 생성 시간입니다. Unix 타임스탬프(밀리초)입니다.

  형식: `int64`
</ResponseField>

<ResponseField name="data[].external_id" type="string">
  이 작업의 사용자 지정 작업 ID입니다(있는 경우).
</ResponseField>

<ResponseField name="data[].id" type="string">
  작업 ID입니다.
</ResponseField>

<ResponseField name="data[].message" type="string">
  작업 상태 정보이며, 작업이 실패하면 실패 이유를 표시합니다.
</ResponseField>

<ResponseField name="data[].outputs" type="object[]">
  작업의 생성된 출력입니다.
</ResponseField>

<ResponseField name="data[].outputs[].duration" type="string">
  생성된 비디오의 재생 시간(초)입니다.
</ResponseField>

<ResponseField name="data[].outputs[].group_id" type="string">
  그룹화 표시로, 그룹화된 이미지에만 존재합니다.
</ResponseField>

<ResponseField name="data[].outputs[].id" type="string">
  시스템이 생성한 출력 ID입니다.
</ResponseField>

<ResponseField name="data[].outputs[].mp3_duration" type="string">
  생성된 MP3 오디오의 재생 시간(초)입니다.
</ResponseField>

<ResponseField name="data[].outputs[].mp3_url" type="string">
  생성된 오디오의 MP3 URL입니다(핫링크 방지 적용).
</ResponseField>

<ResponseField name="data[].outputs[].name" type="string">
  생성된 소재의 이름입니다.
</ResponseField>

<ResponseField name="data[].outputs[].owned_by" type="string">
  소재의 소스입니다. "kling"은 공식 라이브러리를 나타내며, 숫자는 제작자 ID입니다.
</ResponseField>

<ResponseField name="data[].outputs[].status" type="string">
  소재의 상태입니다. "succeeded" 또는 "deleted" 중 하나입니다.
</ResponseField>

<ResponseField name="data[].outputs[].type" type="string">
  출력 콘텐츠 유형입니다. "video", "image", "audio", "voice", "element" 중 하나입니다.
</ResponseField>

<ResponseField name="data[].outputs[].url" type="string">
  생성된 결과의 URL입니다(핫링크 방지 적용). 30일 후에 삭제됩니다.
</ResponseField>

<ResponseField name="data[].outputs[].watermark_url" type="string">
  워터마크가 적용된 결과의 URL입니다(핫링크 방지 적용).
</ResponseField>

<ResponseField name="data[].outputs[].wav_duration" type="string">
  생성된 WAV 오디오의 재생 시간(초)입니다.
</ResponseField>

<ResponseField name="data[].outputs[].wav_url" type="string">
  생성된 오디오의 WAV URL입니다(핫링크 방지 적용).
</ResponseField>

<ResponseField name="data[].status" type="string">
  작업 상태입니다. "submitted", "processing", "succeeded", "failed" 중 하나입니다.
</ResponseField>

<ResponseField name="data[].update_time" type="integer">
  작업 업데이트 시간입니다. Unix 타임스탬프(밀리초)입니다.

  형식: `int64`
</ResponseField>

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

<ResponseField name="request_id" type="string">
  시스템이 생성한 요청 ID입니다.
</ResponseField>

## 예시

### 입력

```json theme={null}
{
  "prompt": "A neon-lit alley in the rain, slow dolly forward.",
  "settings": {
    "aspect_ratio": "16:9",
    "duration": 5,
    "resolution": "1080p"
  }
}
```

### 출력

```json theme={null}
{
  "code": 0,
  "data": [
    {
      "create_time": 1798761600000,
      "id": "kling-v2-task-7c8d9e0f1a2b",
      "message": "",
      "outputs": [
        {
          "duration": "5",
          "id": "kling-v2-output-2b1a0f9e8d7c",
          "type": "video",
          "url": "https://example.invalid/kling/kling-3.0-turbo/generated.mp4"
        }
      ],
      "status": "succeeded",
      "update_time": 1798761820000
    }
  ],
  "message": "SUCCEED",
  "request_id": "3d7e5c91-0b42-4f68-9a13-8e2c6d4b0a75"
}
```

## 배포 전 확인

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>
