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

# Kling 文生视频 kling-4.0

> 通过 `/kling/text-to-video` 提交 Kling 4.0 文生视频任务，模型由 `model_name` 指定。任务状态查询请使用 `GET /kling/tasks`。注意：平台暂时不对接主体（`element`）和音色（`voice`）相关能力，相关参数暂不支持传入。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelVideo/kling/kling-4.0-text2video.json POST /kling/text-to-video
openapi: 3.0.1
info:
  title: Kling 4.0 文生视频任务 - 提交任务
  version: 1.0.0
  description: >-
    通过 `/kling/text-to-video` 提交 Kling 4.0 文生视频任务。任务状态查询请使用 `GET
    /kling/tasks`。注意：平台暂时不对接主体（`element`）和音色（`voice`）相关能力，相关参数暂不支持传入。
servers:
  - url: https://api.powertokens.ai
    description: ''
security: []
tags:
  - name: Kling
    description: Kling 原生异步任务端点
paths:
  /kling/text-to-video:
    post:
      tags:
        - Kling
      summary: Kling 4.0 文生视频任务
      description: >-
        通过 `/kling/text-to-video` 提交 Kling 4.0 文生视频任务，模型由 `model_name`
        指定。任务状态查询请使用 `GET
        /kling/tasks`。注意：平台暂时不对接主体（`element`）和音色（`voice`）相关能力，相关参数暂不支持传入。
      operationId: createKlingText2Video4
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json
          description: 数据交换格式
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Kling4VideoRequest'
            examples:
              request:
                summary: 请求示例
                value:
                  model_name: kling-4.0
                  prompt: 傍晚的海边，一名穿白色衬衫的男子沿沙滩行走，镜头缓慢跟随，写实电影风格。
                  settings:
                    duration: 10
                    resolution: 1080p
                    aspect_ratio: '16:9'
                  options:
                    callback_url: ''
                    external_task_id: ''
                    watermark_info:
                      enabled: false
      responses:
        '200':
          description: 任务已受理。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              examples:
                response:
                  summary: 响应示例
                  value:
                    code: 0
                    message: string
                    request_id: string
                    data:
                      id: string
                      status: submitted
                      create_time: 1781080778802
                      update_time: 1781080794151
                      external_id: string
      security:
        - bearerAuth: []
components:
  schemas:
    Kling4VideoRequest:
      type: object
      required:
        - model_name
        - prompt
      properties:
        model_name:
          type: string
          enum:
            - kling-4.0
          description: 模型名称
          example: kling-4.0
        prompt:
          type: string
          description: |-
            文本提示词，可包含正向描述和负向描述。
            - 纯英文不超过 26,000 个字符，纯非英文不超过 11,000 个字符
            - 混合输入需满足：英文字符数/26000 + 非英文字符数/11000 ≤ 1
            - 建议描述画面内容、动作与镜头变化，以及事件的先后顺序
            - 如需输入图片、视频或主体作为参考，请使用全能参考生视频接口
        settings:
          $ref: '#/components/schemas/Kling4VideoSettings'
        options:
          $ref: '#/components/schemas/Kling4VideoOptions'
    SubmitResponse:
      type: object
      properties:
        code:
          type: integer
          description: 错误码；具体定义见错误码。
        message:
          type: string
          description: 错误信息。
        request_id:
          type: string
          description: 请求ID，系统生成，用于跟踪请求、排查问题。
        data:
          type: object
          properties:
            id:
              type: string
              description: 系统生成的任务ID。
            status:
              type: string
              enum:
                - submitted
                - processing
                - succeeded
                - failed
              description: 任务状态：submitted（已提交）、processing（处理中）、succeeded（成功）、failed（失败）。
            create_time:
              type: integer
              format: int64
              description: 任务创建时间，Unix 时间戳，单位 ms。
            update_time:
              type: integer
              format: int64
              description: 任务更新时间，Unix 时间戳，单位 ms。
            external_id:
              type: string
              description: 该任务的自定义任务ID（如有）。
    Kling4VideoSettings:
      type: object
      properties:
        resolution:
          type: string
          enum:
            - 720p
            - 1080p
            - 4k
          default: 1080p
          description: |-
            生成视频的清晰度。
            - `720p`：输出 720P 视频
            - `1080p`：输出 1080P 视频
            - `4k`：输出 4K 视频
        aspect_ratio:
          type: string
          enum:
            - '21:9'
            - '16:9'
            - '9:16'
            - '1:1'
            - '4:3'
            - '3:4'
          default: '16:9'
          description: 生成视频的画面纵横比（宽:高）。
        duration:
          type: integer
          minimum: 3
          maximum: 30
          description: |-
            生成视频的目标时长，单位秒，支持 3–30 的整数值。
            - 指定本参数时以参数值为准，优先于 Prompt 中的时长要求
            - 未指定时采用模型从 Prompt 中识别到的明确时长要求
            - 未指定且 Prompt 中未识别到明确时长时，默认 10 秒

            最终采用的目标时长用于计费，可通过任务查询响应的 `usage.output_duration` 获取。
    Kling4VideoOptions:
      type: object
      properties:
        callback_url:
          type: string
          description: 本次任务结果回调通知地址。如果配置，服务端会在任务状态发生变更时主动通知。
        external_task_id:
          type: string
          description: |-
            自定义任务ID。
            - 传入不会覆盖系统生成的任务ID，但支持通过该ID进行任务查询
            - 请注意，单用户下需要保证唯一性
        watermark_info:
          type: object
          description: 是否同时生成含水印的结果。通过 `enabled` 参数定义，暂不支持自定义水印。
          properties:
            enabled:
              type: boolean
              default: false
              description: true 表示生成含水印结果，false 表示不生成。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````

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