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

# 创建 Kling 4.0 视频

> 统一视频创建入口。当前可用 model：omni-10s、veo3.1-fast、veo3.1-lite、veo3.1-lite-hd、grok-imagine-video-1.5（及 fast/lite）、minimax-h3、minimax-h3-max、kling-4.0（720p/1080p）、seedance2.0-md、sd2-480p-ac、sd2-720p-ac、seedance2.5-30s、sd2.5-720p-ac。Veo 也可用专用入口 POST /v1/veo/frames。

异步生成 **Kling 4.0** 视频。使用统一入口 `POST /v1/videos`，设置 `model` 为 `kling-4.0`（或直接传计费键）。成功返回 `task_id`，用 [查询视频任务](/zh/api-reference/common/query) 轮询，完成后从 `result.video_url` 取片。

## 模型

| `model` | 说明 | 时长 | 分辨率 |
| - | - | - | - |
| `kling-4.0` | 开放模型名；配合 `resolution` 计费 | **5～30** 秒 | `720p`（默认）/ `1080p` |
| `kling-4.0-720p` | 计费键：720p | **5～30** 秒 | `720p` |
| `kling-4.0-1080p` | 计费键：1080p | **5～30** 秒 | `1080p` |

计费方式为 `per_second`（按秒）。**计费秒数 = 输出时长 + 所有参考视频时长之和**（参考视频时长向上取整到秒，由请求体 `reference_video_durations` 提供；参考音频不计费时长）。实际单价以 [模型目录](/zh/api-reference/common/model-catalog) 与创建响应中的 `cost` 为准。

## 模式判定

| 模式 | 传参 |
| - | - |
| 文生视频 | 不传 `images` / `videos` / `audios`，或全部传空数组 |
| 参考内容生成 | 传入参考图、参考视频和/或参考音频 |

本接口**不支持**首尾帧字段。

## 参考素材限制

| 类型 | 数量上限 | 单条时长 | 单文件大小 |
| - | - | - | - |
| 图片 | **10** | — | **10MB** |
| 视频 | **5** | **≤ 30** 秒 | **50MB** |
| 音频 | **3** | **5～30** 秒 | **20MB** |

参考素材须为公网 `https://` 直链。体积限制由上传端校验；时长由 `reference_*_durations` 校验。

## 请求参数

| 字段 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | 是 | `kling-4.0` / `kling-4.0-720p` / `kling-4.0-1080p` |
| `prompt` | string | 是 | 生成描述，1～5000 字 |
| `duration` / `seconds` | int \| string | 是 | **5～30**；字符串亦可（如 `"10"`） |
| `aspect_ratio` / `ratio` | string | 否 | `16:9`、`9:16`、`1:1`；默认 `16:9` |
| `resolution` | string | 否 | `720p`（默认）或 `1080p`；传入计费键时也可从 model 推断 |
| `images` / `reference_images` | string\[] | 否 | 参考图 URL，最多 **10** 张 |
| `videos` / `reference_videos` | string\[] | 否 | 参考视频直链，最多 **5** 个 |
| `reference_video_durations` | int\[] | 条件 | 与 `videos` **等长**，单位秒（1～30）；有参考视频时必填，用于计费累加 |
| `audios` / `reference_audios` | string\[] | 否 | 参考音频直链，最多 **3** 个 |
| `reference_audio_durations` | int\[] | 条件 | 与 `audios` **等长**，单位秒（5～30）；有参考音频时必填 |

## 示例

### 文生视频

```bash theme={null}
curl -X POST 'https://sigrunai.com/v1/videos' \
  -H 'Authorization: Bearer sk_xxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "kling-4.0",
    "prompt": "未来城市的夜晚，无人驾驶跑车穿过雨后的霓虹街道，电影质感",
    "aspect_ratio": "16:9",
    "resolution": "720p",
    "duration": 8
  }'
```

### 图片 + 视频 + 音频参考

```bash theme={null}
curl -X POST 'https://sigrunai.com/v1/videos' \
  -H 'Authorization: Bearer sk_xxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "kling-4.0",
    "prompt": "图片 1 提供产品外观，视频 1 提供镜头运动，音频 1 控制节奏",
    "aspect_ratio": "16:9",
    "resolution": "720p",
    "duration": 10,
    "images": ["https://example.com/ref.png"],
    "videos": ["https://example.com/ref.mp4"],
    "reference_video_durations": [5],
    "audios": ["https://example.com/ref.mp3"],
    "reference_audio_durations": [8]
  }'
```

上例计费秒数 = `10 + 5 = 15`（输出 10 秒 + 参考视频 5 秒；音频不累加）。

## 响应

创建成功后返回统一任务结构（含 `task_id`、`status`、`cost` 等）。`data.model` 为计费键（如 `kling-4.0-720p`）。任务完成后通过查询接口读取 `result.video_url`。


## OpenAPI

````yaml POST /v1/videos
openapi: 3.1.0
info:
  title: AI Platform OpenAPI
  description: 异步图片与视频生成。创建后轮询 task_id；结果 URL 约保留 3 天。
  version: 1.0.0
servers:
  - url: https://sigrunai.com
    description: AI Platform 生产环境
security:
  - bearerAuth: []
paths:
  /v1/videos:
    post:
      tags:
        - Videos
      summary: Create video task
      description: >-
        Unified video create entry. Available models: omni-10s, veo3.1-fast,
        veo3.1-lite, veo3.1-lite-hd, grok-imagine-video-1.5 (and fast/lite),
        minimax-h3, minimax-h3-max, kling-4.0 (720p/1080p), seedance2.0-md,
        sd2-480p-ac, sd2-720p-ac, seedance2.5-30s, sd2.5-720p-ac. Veo also has
        POST /v1/veo/frames.
      operationId: createVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoCreateRequest'
            examples:
              omni10s:
                summary: omni-10s
                value:
                  model: omni-10s
                  prompt: >-
                    A golden retriever running across a sunny meadow, cinematic
                    tracking shot
                  aspect_ratio: '16:9'
              veo31Fast:
                summary: veo3.1-fast
                value:
                  model: veo3.1-fast
                  prompt: >-
                    A golden retriever running across a sunny meadow, cinematic
                    tracking shot
                  resolution: 720p
                  orientation: landscape
              seedanceMd:
                summary: seedance2.0-md
                value:
                  model: seedance2.0-md
                  prompt: 城市夜景延时，车流光轨
                  duration: 10
                  aspect_ratio: '16:9'
              seedance30s:
                summary: seedance2.5-30s
                value:
                  model: seedance2.5-30s
                  prompt: 一只猫在草地上奔跑，跟拍镜头
                  aspect_ratio: '9:16'
              seedance20Ac:
                summary: sd2-720p-ac
                value:
                  model: sd2-720p-ac
                  prompt: A cat running on grass, tracking shot
                  duration: 8
                  aspect_ratio: '9:16'
              seedance720pAc:
                summary: sd2.5-720p-ac
                value:
                  model: sd2.5-720p-ac
                  prompt: A cat running on grass, tracking shot
                  duration: 8
                  aspect_ratio: '9:16'
              kling40:
                summary: kling-4.0
                value:
                  model: kling-4.0
                  prompt: >-
                    A golden retriever running across a sunny meadow, cinematic
                    tracking shot
                  duration: 8
                  aspect_ratio: '16:9'
                  resolution: 720p
      responses:
        '200':
          description: Submitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskQueryResponse'
components:
  schemas:
    VideoCreateRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          description: >-
            omni-10s, veo3.1-fast, veo3.1-lite, veo3.1-lite-hd,
            grok-imagine-video-1.5 (and fast/lite), minimax-h3, minimax-h3-max,
            kling-4.0 / kling-4.0-720p / kling-4.0-1080p, seedance2.0-md,
            sd2-480p-ac, sd2-720p-ac, seedance2.5-30s, or sd2.5-720p-ac
          example: omni-10s
        prompt:
          type: string
        duration:
          oneOf:
            - type: integer
            - type: string
          description: >-
            omni-10s: fixed 10; seedance2.0-md: 5/10/15; sd2-*-ac: 4–15;
            seedance2.5-30s: fixed 30; sd2.5-720p-ac: 4–30
        seconds:
          oneOf:
            - type: integer
            - type: string
          description: Alias of duration
        aspect_ratio:
          type: string
        ratio:
          type: string
          description: Alias of aspect_ratio
        orientation:
          type: string
          description: portrait/landscape may imply aspect ratio
        size:
          type: string
        resolution:
          type: string
          description: omni-10s is fixed at 720p
        first_image:
          type: string
          format: uri
          description: First-frame URL for omni-10s frame mode
        last_image:
          type: string
          format: uri
          description: Last-frame URL for omni-10s; use with first_image
        images:
          type: array
          items:
            type: string
            format: uri
        reference_images:
          type: array
          items:
            type: string
            format: uri
        videos:
          type: array
          items:
            type: string
            format: uri
        reference_videos:
          type: array
          items:
            type: string
            format: uri
        reference_video_durations:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 30
          description: >-
            Required with reference videos for kling-4.0; same length as videos;
            seconds 1–30. Billable seconds = output duration + sum of these
            values.
        reference_audio_durations:
          type: array
          items:
            type: integer
            minimum: 5
            maximum: 30
          description: >-
            Required with reference audios for kling-4.0; same length as audios;
            seconds 5–30 (validation only, not billed).
        audios:
          type: array
          items:
            type: string
            format: uri
        reference_audios:
          type: array
          items:
            type: string
            format: uri
    TaskQueryResponse:
      type: object
      properties:
        code:
          type: integer
          example: 20000
        msg:
          type: string
        data:
          $ref: '#/components/schemas/TaskQueryData'
    TaskQueryData:
      type: object
      properties:
        task_id:
          type: string
        status:
          type: string
          description: queued / processing / completed / failed 等
        progress:
          type: integer
        model:
          type: string
        created_at:
          type: integer
        completed_at:
          type: integer
        cost:
          type: number
        error_message:
          type: string
        result:
          $ref: '#/components/schemas/TaskResult'
    TaskResult:
      type: object
      properties:
        image_url:
          type: string
        video_url:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 控制台创建的 API Key，格式：Bearer sk_xxx

````

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