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

# 모델별 Kling 이미지-투-비디오 작업 생성

> 모델별 경로를 사용하여 소스 이미지로 Kling 동영상을 생성한 다음 작업 ID로 동영상을 조회합니다.

소스 이미지를 `POST /image-to-video/{model}`로 전송하여 동영상 작업을 생성합니다. 움직임을 설명하는 프롬프트(Prompt)를 추가할 수 있습니다. 응답에는 결과를 조회하는 데 사용할 `id`가 포함됩니다.

## 모델 선택

URL에 모델 ID를 넣으세요. JSON 본문에 model 필드를 추가하지 마세요.

| 모델 ID | 해상도 | 길이 | 오디오 |
| - | - | - | - |
| `kling-3.0-turbo` | `720p`, `1080p` | 3\~15초의 정수 | 생략 `audio` |
| `kling-3.0` | `720p`, `1080p`, `4k` | 3\~15초의 정수 | `native` 또는 `off` |
| `kling-2.6` | `720p`, `1080p` | 5초 또는 10초 | `native` 또는 `off`; `1080p`와 함께 사용합니다. `native` |
| `kling-2.5-turbo` | `720p`, `1080p` | 5초 또는 10초 | 생략 `audio` |

`kling-3.0-turbo` `first_frame`만 허용합니다. `kling-2.5-turbo`
`kling-3.0`및 `kling-2.6`도 `last_frame`를 지원합니다. 하나의
`first_frame` 을 함께 포함하세요. `kling-2.5-turbo` 및 `kling-2.6`의 경우
첫 번째 및 마지막 프레임 조합에는 `1080p`가 필요합니다.

## 요청 매개변수

각 입력을 `contents`에 넣으세요. `prompt` 항목에는 `text`를 사용하고, 프레임 항목에는 `url`를 사용합니다. 이미지에는 공개적으로 액세스할 수 있는 URL 또는 Base64로 인코딩된 JPG나 PNG 데이터를 제공하세요.

| 필드 | 유형 | 필수 | 설명 |
| - | - | - | - |
| 경로 `model` | 문자열 | 예 | URL의 모델 ID입니다. 위 표에서 ID를 선택하고 요청 본문에 추가하지 마세요. |
| `contents` | 배열 | 예 | 입력 항목입니다. `first_frame` 이미지를 포함하세요. 필요하면 `prompt` 항목 또는 모델이 지원하는 `last_frame` 이미지를 추가하세요. |
| `contents[].type` | 문자열 | 예 | `prompt`, `first_frame`또는 `last_frame`입니다. `first_frame`을 사용할 때는 `last_frame`를 포함하세요. 선택한 모델에 따라 `last_frame` 사용 가능 여부가 결정됩니다. |
| `contents[].text` | 문자열 | `prompt` 항목의 경우 | 움직임을 설명하는 텍스트입니다. |
| `contents[].url` | 문자열 | 프레임 항목의 경우 | 공개 이미지 URL 또는 Base64로 인코딩된 JPG나 PNG 데이터입니다. |
| `settings.resolution` | 문자열 | 아니요 | 위 표에서 선택한 모델 행의 출력 해상도입니다. 기본값은 `720p`. |
| `settings.duration` | 정수 | 아니요 | 위 표에서 선택한 모델 행의 동영상 길이(초)입니다. 기본값은 `5`. |
| `settings.multi_shot` | 불리언 | 아니요 | `kling-3.0`에만 해당하며, 공식 기본값은 `true`입니다. 여러 샷에는 `true`, 단일 샷에는 `false`을 설정하고, 이 필드를 사용할 때는 값을 명시적으로 설정하세요. |
| `settings.audio` | 문자열 | 아니요 | `kling-3.0` 또는 `kling-2.6`의 경우, 생성된 오디오는 `native`, 생성된 오디오 없이는 `off`로 설정하세요. 이 필드를 사용할 때는 값을 명시적으로 설정하세요. |
| `options.callback_url` | 문자열 | 아니요 | 작업 업데이트를 수신하는 공개 URL입니다. |
| `options.external_task_id` | 문자열 | 아니요 | 작업을 애플리케이션과 연결하기 위한 식별자입니다. |
| `options.watermark_info` | 객체 | 아니요 | 출력의 워터마크 구성입니다. |

다음 요청은 하나의 소스 이미지를 5초 동영상으로 애니메이션화합니다:

```json theme={null}
{
  "contents": [
    {
      "type": "prompt",
      "text": "The camera slowly moves closer to the scene."
    },
    {
      "type": "first_frame",
      "url": "https://raw.githubusercontent.com/ultralytics/yolov5/402e17ddf820996f51a191cbb798376e1144f069/data/images/zidane.jpg"
    }
  ],
  "settings": {
    "resolution": "720p",
    "duration": 5
  }
}
```

다른 이미지를 사용할 경우 소스 이미지 URL을 공개 URL 또는 Base64로 인코딩된 JPG/PNG로 바꾸세요. CometAPI API 키와 함께 이 본문을 `https://api.cometapi.com/image-to-video/kling-3.0-turbo`로 전송하세요. OpenAPI 코드 패널은 동일한 본문을 사용하는 Shell, Python 및 JavaScript 요청을 제공합니다.

## 비디오 검색

생성 응답의 형태는 다음과 같습니다:

```json theme={null}
{
  "code": 0,
  "message": "SUCCEED",
  "data": {
    "id": "example-task-id",
    "status": "submitted"
  }
}
```

`data.id`를 저장합니다. 다음을 사용하세요 [Kling 작업 가져오기](https://apidoc.cometapi.com/ko/api/video/kling/model-routes/tasks.md) 해당 ID로 작업이 최종 상태에 도달할 때까지 진행합니다. 작업의 `outputs` 배열에서 비디오 URL을 읽습니다.


## OpenAPI

````yaml api/openapi/video/kling/model-routes/post-image-to-video.openapi.json POST /image-to-video/{model}
openapi: 3.1.0
info:
  title: Kling image-to-video model route
  version: 1.0.0
  description: Create a Kling video task from a source image, with an optional prompt.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /image-to-video/{model}:
    post:
      summary: Create an image-to-video task
      description: >-
        Submit a source image with optional motion text, then receive a task ID
        for retrieving the generated video.
      operationId: createKlingModelImageToVideoTask
      parameters:
        - name: model
          in: path
          required: true
          description: >-
            Kling model ID. `kling-3.0` supports 4k resolution. The 2.x models
            accept 5- or 10-second duration.
          schema:
            type: string
            enum:
              - kling-3.0-turbo
              - kling-3.0
              - kling-2.6
              - kling-2.5-turbo
            default: kling-3.0-turbo
          example: kling-3.0-turbo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageToVideoRequest'
            example:
              contents:
                - type: prompt
                  text: The camera slowly moves closer to the scene.
                - type: first_frame
                  url: >-
                    https://raw.githubusercontent.com/ultralytics/yolov5/402e17ddf820996f51a191cbb798376e1144f069/data/images/zidane.jpg
              settings:
                resolution: 720p
                duration: 5
      responses:
        '200':
          description: >-
            The task was created. Use `data.id` to retrieve its status and video
            output.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTaskResponse'
              example:
                code: 0
                message: SUCCEED
                data:
                  id: example-task-id
                  status: submitted
      x-codeSamples:
        - lang: Shell
          label: Create task
          source: |
            curl https://api.cometapi.com/image-to-video/kling-3.0-turbo \
              -X POST \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              --data-raw '{
              "contents": [
                {
                  "type": "prompt",
                  "text": "The camera slowly moves closer to the scene."
                },
                {
                  "type": "first_frame",
                  "url": "https://raw.githubusercontent.com/ultralytics/yolov5/402e17ddf820996f51a191cbb798376e1144f069/data/images/zidane.jpg"
                }
              ],
              "settings": {
                "resolution": "720p",
                "duration": 5
              }
            }'
        - lang: Python
          label: Create task
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/image-to-video/kling-3.0-turbo",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                    "contents": [
                        {
                            "type": "prompt",
                            "text": "The camera slowly moves closer to the scene.",
                        },
                        {
                            "type": "first_frame",
                            "url": "https://raw.githubusercontent.com/ultralytics/yolov5/402e17ddf820996f51a191cbb798376e1144f069/data/images/zidane.jpg",
                        },
                    ],
                    "settings": {
                        "resolution": "720p",
                        "duration": 5
                    },
                },
            )
            response.raise_for_status()
            print(response.json()["data"]["id"])
        - lang: JavaScript
          label: Create task
          source: |
            const response = await fetch(
              "https://api.cometapi.com/image-to-video/kling-3.0-turbo",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify({
                  contents: [
                    { type: "prompt", text: "The camera slowly moves closer to the scene." },
                    {
                      type: "first_frame",
                      url: "https://raw.githubusercontent.com/ultralytics/yolov5/402e17ddf820996f51a191cbb798376e1144f069/data/images/zidane.jpg",
                    },
                  ],
                  settings: {
                    resolution: "720p",
                    duration: 5,
                  },
                }),
              },
            );
            if (!response.ok) throw new Error(`HTTP ${response.status}`);
            console.log((await response.json()).data.id);
components:
  schemas:
    ImageToVideoRequest:
      type: object
      required:
        - contents
      properties:
        contents:
          type: array
          minItems: 1
          description: >-
            Image and text inputs exposed by the CometAPI route. Include a
            `first_frame` image. Add a `prompt` entry or a model-supported
            `last_frame` image when needed.
          contains:
            type: object
            required:
              - type
            properties:
              type:
                const: first_frame
                description: >-
                  Identifies the source image required for image-to-video
                  generation.
          minContains: 1
          items:
            type: object
            required:
              - type
            properties:
              type:
                type: string
                enum:
                  - prompt
                  - first_frame
                  - last_frame
                description: >-
                  Input role. Use `prompt` for motion text, `first_frame` for
                  the source image, or `last_frame` for the target ending image.
                  `kling-3.0-turbo` accepts `first_frame` only;
                  `kling-2.5-turbo`, `kling-3.0`, and `kling-2.6` also support
                  `last_frame`. For `kling-2.5-turbo` and `kling-2.6`, a
                  first-and-last-frame request requires `1080p`.
              text:
                type: string
                description: Motion description for a `prompt` entry.
              url:
                type: string
                description: >-
                  Public image URL or Base64-encoded JPG or PNG data for a frame
                  entry.
            allOf:
              - if:
                  properties:
                    type:
                      const: prompt
                      description: Identifies an optional motion prompt.
                then:
                  required:
                    - text
                else:
                  required:
                    - url
            additionalProperties: false
            description: Frame and prompt content fields exposed by the CometAPI route.
        settings:
          $ref: '#/components/schemas/VideoSettings'
        options:
          $ref: '#/components/schemas/TaskOptions'
      additionalProperties: false
      description: >-
        Image-to-video request fields exposed by the CometAPI route. The model
        ID is a path parameter, not a body field.
    CreateTaskResponse:
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          oneOf:
            - type: integer
            - type: string
          description: Request result code. `0` or `success` indicates acceptance.
        message:
          type: string
          description: Result message.
        msg:
          type: string
          description: Additional result message when included in the response.
        data:
          type: object
          description: Task identifier and submission status.
          required:
            - id
            - status
          properties:
            id:
              type: string
              description: Task ID to use in `GET /tasks?task_ids={id}`.
            status:
              type: string
              description: Task status at submission.
    VideoSettings:
      type: object
      description: >-
        Video generation settings exposed by the CometAPI route. The model ID in
        the URL determines which values are accepted.
      properties:
        resolution:
          type: string
          enum:
            - 720p
            - 1080p
            - 4k
          default: 720p
          description: >-
            Output resolution. `4k` is available with `kling-3.0`; the other
            listed models accept `720p` or `1080p`.
        duration:
          type: integer
          minimum: 3
          maximum: 15
          default: 5
          description: >-
            Video length in seconds. Use an integer from 3 to 15 for the 3.0
            models, or 5 or 10 for the 2.x models. A `kling-2.5-turbo` or
            `kling-2.6` request with both `first_frame` and `last_frame`
            requires `1080p`.
        multi_shot:
          type: boolean
          description: >-
            For `kling-3.0` only, the official default is `true`. Set `true` for
            multiple shots or `false` for one shot, and set the value explicitly
            when you use this field.
        audio:
          type: string
          enum:
            - native
            - 'off'
          description: >-
            For `kling-3.0` or `kling-2.6`, use `native` for generated audio or
            `off` to disable it. Set the value explicitly when you use this
            field. With `kling-2.6`, `native` requires `1080p`. Omit this field
            for the Turbo models.
      additionalProperties: false
    TaskOptions:
      type: object
      description: Optional task fields exposed by the CometAPI route.
      properties:
        callback_url:
          type: string
          format: uri
          description: Public URL that receives task updates.
        external_task_id:
          type: string
          description: >-
            Your identifier for matching this task to a record in your
            application.
        watermark_info:
          type: object
          description: Watermark configuration for the generated video.
          additionalProperties: true
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Authenticate with your CometAPI API key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.