# 查询 Kling v4 Flash 任务状态

> 视频生成

使用提交返回的 output.task_id 查询；成功时 output.urls 返回视频地址。

## 请求地址

`GET https://api.modelverse.cn/v1/tasks/status`

## 请求参数

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| task_id | query | string | Yes | 提交响应中的 output.task_id。 |

## 响应

- **200** — 任务状态响应。
- **400** — 
- **default** — 

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "Kling v4 Flash 视频生成接口文档",
    "version": "1.0.0",
    "description": "ModelVerse 统一以公共模型 `kling-v4-flash` 提供文生视频、图生视频和 Omni 视频生成。\n使用 `POST /v1/tasks/submit` 提交任务，使用 `GET /v1/tasks/status` 查询结果。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "中国大陆"
    },
    {
      "url": "https://api.umodelverse.ai",
      "description": "海外"
    },
    {
      "url": "https://api-us-ca.umodelverse.ai",
      "description": "美国洛杉矶"
    },
    {
      "url": "https://api-sg.umodelverse.ai",
      "description": "新加坡"
    },
    {
      "url": "https://api-ge-fra.umodelverse.ai",
      "description": "法兰克福"
    }
  ],
  "tags": [
    {
      "name": "Kling/v4-flash",
      "description": "Kling v4 Flash 异步视频任务接口。"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/tasks/submit": {
      "post": {
        "tags": [
          "Kling/v4-flash"
        ],
        "operationId": "submitKlingV4FlashTask",
        "summary": "提交 Kling v4 Flash 视频生成任务",
        "description": "kling_type 可取 t2v、i2v、omni_video；省略时优先按视频或 Omni 专属素材推断为 Omni，否则图片推断为 i2v，其余为 t2v。\nt2v 使用 input.prompt，不接受 contents 或图片、视频素材。i2v 仅支持一个 first_frame，不支持 aspect_ratio。\nOmni 可通过素材唯一 id 在提示词中以 @id 引用；请说明每份素材的参考用途、场景和声音要求。\ninput 素材字段与 contents 建议只选择一种；同时使用时素材必须逐项一致，否则报错。\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KlingV4FlashSubmitRequest"
              },
              "examples": {
                "textToVideo": {
                  "summary": "文生视频",
                  "value": {
                    "model": "kling-v4-flash",
                    "input": {
                      "prompt": "一只橘猫走过雨后的街道，电影质感"
                    },
                    "parameters": {
                      "kling_type": "t2v",
                      "duration": 5,
                      "resolution": "720p",
                      "aspect_ratio": "16:9"
                    }
                  }
                },
                "imageToVideo": {
                  "summary": "单首帧图生视频",
                  "value": {
                    "model": "kling-v4-flash",
                    "input": {
                      "prompt": "镜头缓缓推进，人物自然转身",
                      "first_frame_url": "https://example.com/first-frame.png"
                    },
                    "parameters": {
                      "kling_type": "i2v",
                      "duration": 5
                    }
                  }
                },
                "omniReferenceImage": {
                  "summary": "Omni 参考图生成视频",
                  "value": {
                    "model": "kling-v4-flash",
                    "input": {
                      "prompt": "保持 @image_1 的面孔、发型与服装，人物在夜晚城市街道缓慢转身，伴随脚步声"
                    },
                    "parameters": {
                      "kling_type": "omni_video",
                      "duration": 5,
                      "aspect_ratio": "adaptive",
                      "audio": false,
                      "contents": [
                        {
                          "type": "refer_image",
                          "url": "https://example.com/character.png",
                          "id": "image_1"
                        }
                      ]
                    }
                  }
                },
                "omniEditOriginalAudio": {
                  "summary": "Omni 编辑视频并保留输入视频原声",
                  "value": {
                    "model": "kling-v4-flash",
                    "input": {
                      "prompt": "保留 @video_1 的人物与动作，将背景改为雨后街道，保留输入视频原声"
                    },
                    "parameters": {
                      "kling_type": "omni_video",
                      "duration": 5,
                      "audio": true,
                      "contents": [
                        {
                          "type": "base_video",
                          "url": "https://example.com/source-video.mp4",
                          "id": "video_1"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务提交成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4FlashSubmitResponse"
                },
                "example": {
                  "output": {
                    "task_id": "task_id"
                  },
                  "request_id": "request_id"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/TaskError"
          },
          "default": {
            "$ref": "#/components/responses/TaskError"
          }
        }
      }
    },
    "/v1/tasks/status": {
      "get": {
        "tags": [
          "Kling/v4-flash"
        ],
        "operationId": "getKlingV4FlashTaskStatus",
        "summary": "查询 Kling v4 Flash 任务状态",
        "description": "使用提交返回的 output.task_id 查询；成功时 output.urls 返回视频地址。",
        "parameters": [
          {
            "name": "task_id",
            "in": "query",
            "required": true,
            "description": "提交响应中的 output.task_id。",
            "schema": {
              "type": "string"
            },
            "example": "task_id"
          }
        ],
        "responses": {
          "200": {
            "description": "任务状态响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4FlashStatusResponse"
                },
                "example": {
                  "output": {
                    "task_id": "task_id",
                    "task_status": "Success",
                    "urls": [
                      "https://example.com/result.mp4"
                    ],
                    "submit_time": 1756959000,
                    "finish_time": 1756959050
                  },
                  "usage": {
                    "duration": 5
                  },
                  "request_id": ""
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/TaskError"
          },
          "default": {
            "$ref": "#/components/responses/TaskError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "在 Authorization: Bearer <YOUR_API_KEY> 请求头中传入 ModelVerse API 密钥。"
      }
    },
    "responses": {
      "TaskError": {
        "description": "参数不合法或任务请求失败。",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/KlingV4FlashErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "KlingV4FlashSubmitRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "kling-v4-flash"
          },
          "input": {
            "$ref": "#/components/schemas/KlingV4FlashInput"
          },
          "parameters": {
            "$ref": "#/components/schemas/KlingV4FlashParameters"
          }
        }
      },
      "KlingV4FlashInput": {
        "type": "object",
        "description": "必须传入 input 对象；t2v 必须提供 prompt，i2v 必须提供且仅提供一个首帧，Omni 必须通过 input.prompt 或 contents 的 prompt 项提供提示词。",
        "properties": {
          "prompt": {
            "type": "string",
            "description": "生成提示词，可用 @id 引用素材；同时提供 contents prompt 时文本必须一致。"
          },
          "first_frame_url": {
            "type": "string",
            "description": "首帧图片地址，可触发 i2v；也可通过 contents 的 first_frame 提供。",
            "example": "https://example.com/first-frame.png"
          }
        }
      },
      "KlingV4FlashParameters": {
        "type": "object",
        "properties": {
          "kling_type": {
            "type": "string",
            "enum": [
              "t2v",
              "i2v",
              "omni_video"
            ],
            "description": "生成类型；可省略并按输入素材推断，显式类型必须与素材匹配。"
          },
          "duration": {
            "type": "integer",
            "minimum": 3,
            "maximum": 20,
            "description": "目标输出时长，单位秒，可省略；省略时不承诺固定输出时长。"
          },
          "resolution": {
            "type": "string",
            "enum": [
              "720p"
            ],
            "description": "仅支持 720p；可省略，由上游默认使用 720p。"
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "21:9",
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4",
              "adaptive"
            ],
            "description": "t2v 支持除 adaptive 外的六种比例；Omni 额外支持 adaptive；i2v 不支持此参数。"
          },
          "audio": {
            "type": "boolean",
            "description": "Omni 声音控制。false 或省略使用 native 原生音频；true 使用 original 保留输入视频原声，此时必须包含 base_video 或 feature_video。此参数不是静音开关。"
          },
          "contents": {
            "type": "array",
            "description": "i2v / Omni 内容项，t2v 不接受。素材 id 必须唯一，可通过提示词 @id 引用。",
            "items": {
              "$ref": "#/components/schemas/KlingV4FlashContent"
            }
          }
        }
      },
      "KlingV4FlashContent": {
        "type": "object",
        "required": [
          "type"
        ],
        "description": "i2v 仅支持 prompt 和一个 first_frame。Omni 支持以下全部类型；不支持 middle_frame、last_frame 或 voice。\nOmni 最多 10 张图片、5 个视频（base_video 最多 1 个）、7 个 element，素材合计最多 15 项，并且必须有提示词。\n",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "prompt",
              "first_frame",
              "refer_image",
              "feature_video",
              "base_video",
              "element"
            ]
          },
          "text": {
            "type": "string",
            "description": "type=prompt 时必填且不能为空白。"
          },
          "url": {
            "type": "string",
            "description": "first_frame、refer_image、feature_video、base_video 必填的素材地址。"
          },
          "id": {
            "type": "string",
            "description": "素材引用标识，任务内唯一；element 必填，其余素材可选。提示词可使用 @id 引用。"
          },
          "element_id": {
            "type": "string",
            "description": "type=element 时必填，并且必须同时提供 id。"
          }
        }
      },
      "KlingV4FlashSubmitResponse": {
        "$ref": "Kling-v4.yaml#/components/schemas/KlingV4SubmitResponse"
      },
      "KlingV4FlashStatusResponse": {
        "$ref": "Kling-v4.yaml#/components/schemas/KlingV4StatusResponse"
      },
      "KlingV4FlashErrorResponse": {
        "$ref": "Kling-v4.yaml#/components/schemas/KlingV4ErrorResponse"
      }
    }
  }
}
```
