> ## 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 /text-to-video/{model}`에 프롬프트를 전송하여 비디오 작업을 생성하세요. 응답에는 결과를 조회하는 데 사용할 `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` |

## 요청 매개변수

| 필드 | 유형 | 필수 | 설명 |
| - | - | - | - |
| 경로 `model` | string | 예 | URL의 모델 ID입니다. 위 표에서 ID를 선택하고 요청 본문에는 추가하지 마세요. |
| `prompt` | string | 예 | 생성할 비디오에 대한 설명입니다. |
| `settings.resolution` | string | 아니요 | 위에서 선택한 모델 행의 출력 해상도입니다. 기본값은 `720p`. |
| `settings.aspect_ratio` | string | 아니요 | 출력 화면비: `16:9`, `9:16` 또는 `1:1`. 기본값은 `16:9`. |
| `settings.duration` | integer | 아니요 | 위에서 선택한 모델 행의 비디오 길이(초)입니다. 기본값은 `5`. |
| `settings.multi_shot` | boolean | 아니요 | `kling-3.0`에만 해당하며, 공식 기본값은 `true`입니다. 여러 샷에는 `true`을, 한 샷에는 `false`을 설정하고, 이 필드를 사용할 때는 값을 명시적으로 설정하세요. |
| `settings.audio` | string | 아니요 | `kling-3.0` 또는 `kling-2.6`의 경우, 생성된 오디오에는 `native`을, 생성된 오디오가 없으면 `off`을 설정하세요. 이 필드를 사용할 때는 값을 명시적으로 설정하세요. |
| `options.callback_url` | string | 아니요 | 작업 업데이트를 수신하는 공개 URL입니다. |
| `options.external_task_id` | string | 아니요 | 작업을 애플리케이션과 연결하기 위한 식별자입니다. |
| `options.watermark_info` | object | 아니요 | 출력의 워터마크 구성입니다. |

다음 요청은 `kling-3.0-turbo`을 사용하여 5초 길이의 비디오를 생성합니다:

```json theme={null}
{
  "prompt": "A paper boat drifts across a calm pond at sunrise.",
  "settings": {
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "duration": 5
  }
}
```

CometAPI API 키와 함께 이 본문을 `https://api.cometapi.com/text-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-text-to-video.openapi.json POST /text-to-video/{model}
openapi: 3.1.0
info:
  title: Kling text-to-video model route
  version: 1.0.0
  description: Create a Kling video task from a text prompt.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /text-to-video/{model}:
    post:
      summary: Create a text-to-video task
      description: >-
        Submit a prompt and receive a task ID for retrieving the generated
        video.
      operationId: createKlingModelTextToVideoTask
      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/TextToVideoRequest'
            example:
              prompt: A paper boat drifts across a calm pond at sunrise.
              settings:
                resolution: 720p
                aspect_ratio: '16:9'
                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/text-to-video/kling-3.0-turbo \
              -X POST \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              --data-raw '{
              "prompt": "A paper boat drifts across a calm pond at sunrise.",
              "settings": {
                "resolution": "720p",
                "aspect_ratio": "16:9",
                "duration": 5
              }
            }'
        - lang: Python
          label: Create task
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/text-to-video/kling-3.0-turbo",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                    "prompt": "A paper boat drifts across a calm pond at sunrise.",
                    "settings": {
                        "resolution": "720p",
                        "aspect_ratio": "16:9",
                        "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/text-to-video/kling-3.0-turbo",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify({
                  prompt: "A paper boat drifts across a calm pond at sunrise.",
                  settings: {
                    resolution: "720p",
                    aspect_ratio: "16:9",
                    duration: 5,
                  },
                }),
              },
            );
            if (!response.ok) throw new Error(`HTTP ${response.status}`);
            console.log((await response.json()).data.id);
components:
  schemas:
    TextToVideoRequest:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          minLength: 1
          description: Text description of the video to generate.
        settings:
          $ref: '#/components/schemas/VideoSettings'
        options:
          $ref: '#/components/schemas/TaskOptions'
      additionalProperties: false
      description: >-
        Text-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`.
        aspect_ratio:
          type: string
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
          default: '16:9'
          description: Output frame aspect ratio.
        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.
        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.