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

# Kling 图生视频

> 使用 Kling 模型从图片生成视频。

支持通过 image 参数传入图片 URL 或 Base64 编码的图片数据。




## OpenAPI

````yaml /api.json post /kling/v1/videos/image2video
openapi: 3.0.1
info:
  title: TKHub API
  description: TKHub 平台 API 接口文档
  version: 1.0.0
servers:
  - url: https://api.tkhub.ai
    description: 生产环境
  - url: https://api-test.tkhub.ai
    description: 测试环境
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/image2video:
    post:
      tags:
        - 视频生成/Kling格式
      summary: Kling 图生视频
      description: |
        使用 Kling 模型从图片生成视频。

        支持通过 image 参数传入图片 URL 或 Base64 编码的图片数据。
      operationId: createKlingImage2Video
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoRequest'
            example:
              model: kling-v1
              prompt: 人物转身走开
              image: https://example.com/image.jpg
              duration: 5
              width: 1280
              height: 720
      responses:
        '200':
          description: 成功创建视频生成任务
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoResponse'
          headers: {}
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    VideoRequest:
      type: object
      description: 视频生成请求
      properties:
        model:
          type: string
          description: 模型/风格 ID
          example: kling-v1
        prompt:
          type: string
          description: 文本描述提示词
          example: 宇航员站起身走了
        image:
          type: string
          description: 图片输入 (URL 或 Base64)
          example: https://example.com/image.jpg
        duration:
          type: number
          description: 视频时长（秒）
          example: 5
        width:
          type: integer
          description: 视频宽度
          example: 1280
        height:
          type: integer
          description: 视频高度
          example: 720
        fps:
          type: integer
          description: 视频帧率
          example: 30
        seed:
          type: integer
          description: 随机种子
          example: 20231234
        'n':
          type: integer
          description: 生成视频数量
          example: 1
        response_format:
          type: string
          description: 响应格式
          example: url
        user:
          type: string
          description: 用户标识
          example: user-1234
        metadata:
          type: object
          description: 扩展参数 (如 negative_prompt, style, quality_level 等)
          additionalProperties: true
          properties: {}
    VideoResponse:
      type: object
      description: 视频生成任务提交响应
      properties:
        task_id:
          type: string
          description: 任务 ID
          example: abcd1234efgh
        status:
          type: string
          description: 任务状态
          example: queued
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: 错误信息
            type:
              type: string
              description: 错误类型
            param:
              type: string
              description: 相关参数
              nullable: true
            code:
              type: string
              description: 错误代码
              nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        使用 Bearer Token 认证。
        格式: `Authorization: Bearer sk-xxxxxx`

````