# Submit a Kling v4 video task

> Video Generation

`kling_type` accepts `t2v`, `i2v`, or `omni_video`. If omitted, video and Omni-specific inputs select `omni_video`,
otherwise image inputs select `i2v`, and requests without media select `t2v`.
T2V requires `input.prompt` and rejects `parameters.contents`. I2V and Omni accept media through input fields or `parameters.contents`.
Explicit variants must match the supplied media. Image frames alone do not count as video input; video input is detected from
`base_video` or `feature_video` in the final contents.
For Omni multi-reference tasks, assign unique `id` values to media items in `parameters.contents` and cite them as `@id` in the prompt.
State which attributes to keep or reference, where each reference applies, the scene, the event sequence, and audio requirements;
a bare reference without an intended use leaves the interpretation to the model.

## Endpoint

`POST https://api.modelverse.cn/v1/tasks/submit`

## Request Body

## Responses

- **200** — Task submitted.
- **400** — Invalid parameters or task creation failure.
- **default** — Error response.

## OpenAPI Definition

```json
{
  "openapi": "3.1.0",
  "x-language": "en-US",
  "info": {
    "title": "ModelVerse Kling v4 Video Task API",
    "version": "1.0.0",
    "description": "ModelVerse exposes text-to-video, image-to-video, and Omni video generation under the single public model ID `kling-v4`.\nSubmit tasks with `POST /v1/tasks/submit` and retrieve results with `GET /v1/tasks/status`.\nSelect the variant with `parameters.kling_type` or let the service infer it from the input.\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API endpoint."
    }
  ],
  "tags": [
    {
      "name": "Kling/v4",
      "description": "Asynchronous Kling v4 video tasks."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/tasks/submit": {
      "post": {
        "tags": [
          "Kling/v4"
        ],
        "operationId": "submitKlingV4Task",
        "summary": "Submit a Kling v4 video task",
        "description": "`kling_type` accepts `t2v`, `i2v`, or `omni_video`. If omitted, video and Omni-specific inputs select `omni_video`,\notherwise image inputs select `i2v`, and requests without media select `t2v`.\nT2V requires `input.prompt` and rejects `parameters.contents`. I2V and Omni accept media through input fields or `parameters.contents`.\nExplicit variants must match the supplied media. Image frames alone do not count as video input; video input is detected from\n`base_video` or `feature_video` in the final contents.\nFor Omni multi-reference tasks, assign unique `id` values to media items in `parameters.contents` and cite them as `@id` in the prompt.\nState which attributes to keep or reference, where each reference applies, the scene, the event sequence, and audio requirements;\na bare reference without an intended use leaves the interpretation to the model.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KlingV4SubmitRequest"
              },
              "examples": {
                "textToVideo": {
                  "summary": "Text-to-video",
                  "value": {
                    "model": "kling-v4",
                    "input": {
                      "prompt": "An orange cat walking along a rain-soaked street, cinematic lighting"
                    },
                    "parameters": {
                      "kling_type": "t2v",
                      "duration": 5,
                      "resolution": "720p",
                      "aspect_ratio": "16:9"
                    }
                  }
                },
                "firstAndLastFrames": {
                  "summary": "Image-to-video with first and last frames",
                  "value": {
                    "model": "kling-v4",
                    "input": {
                      "prompt": "The camera moves forward as the subject turns naturally",
                      "first_frame_url": "https://example.com/first-frame.png",
                      "last_frame_url": "https://example.com/last-frame.png"
                    },
                    "parameters": {
                      "kling_type": "i2v",
                      "duration": 5,
                      "resolution": "1080p"
                    }
                  }
                },
                "contentsFirstAndLastFrames": {
                  "summary": "First and last frames via contents",
                  "value": {
                    "model": "kling-v4",
                    "input": {},
                    "parameters": {
                      "kling_type": "i2v",
                      "duration": 5,
                      "resolution": "1080p",
                      "contents": [
                        {
                          "type": "prompt",
                          "text": "The camera moves forward as the subject turns naturally"
                        },
                        {
                          "type": "first_frame",
                          "url": "https://example.com/first-frame.png"
                        },
                        {
                          "type": "last_frame",
                          "url": "https://example.com/last-frame.png"
                        }
                      ]
                    }
                  }
                },
                "omniVideoInput": {
                  "summary": "Omni with a base video",
                  "value": {
                    "model": "kling-v4",
                    "input": {
                      "prompt": "Follow the action rhythm of @video_1 but replace its background; apply cinematic color grading and soft ambient audio"
                    },
                    "parameters": {
                      "kling_type": "omni_video",
                      "duration": 5,
                      "resolution": "720p",
                      "contents": [
                        {
                          "type": "base_video",
                          "url": "https://example.com/source-video.mp4",
                          "id": "video_1"
                        }
                      ]
                    }
                  }
                },
                "omniMultiReference": {
                  "summary": "Omni image and video references",
                  "value": {
                    "model": "kling-v4",
                    "input": {
                      "prompt": "Keep the face, hairstyle and clothing from @image_1. Follow the motion rhythm of @video_1 but not its background. Set the scene on a cinematic city street at night; turn slowly, then walk toward the camera, with footsteps and soft music."
                    },
                    "parameters": {
                      "kling_type": "omni_video",
                      "duration": 5,
                      "resolution": "1080p",
                      "contents": [
                        {
                          "type": "refer_image",
                          "url": "https://example.com/character.png",
                          "id": "image_1"
                        },
                        {
                          "type": "feature_video",
                          "url": "https://example.com/motion-reference.mp4",
                          "id": "video_1"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task submitted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4SubmitResponse"
                },
                "example": {
                  "output": {
                    "task_id": "task_id"
                  },
                  "request_id": "request_id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or task creation failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/status": {
      "get": {
        "tags": [
          "Kling/v4"
        ],
        "operationId": "getKlingV4TaskStatus",
        "summary": "Get Kling v4 task status",
        "description": "Use `output.task_id` from the submit response. When successful, `output.urls` contains the generated resource URL.",
        "parameters": [
          {
            "name": "task_id",
            "in": "query",
            "required": true,
            "description": "output.task_id from the submit response.",
            "schema": {
              "type": "string"
            },
            "example": "task_id"
          }
        ],
        "responses": {
          "200": {
            "description": "Task status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4StatusResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Completed task",
                    "value": {
                      "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": ""
                    }
                  },
                  "failure": {
                    "summary": "Failed task",
                    "value": {
                      "output": {
                        "task_id": "task_id",
                        "task_status": "Failure",
                        "submit_time": 1756959000,
                        "finish_time": 1756959019,
                        "error_message": "Generation failed"
                      },
                      "request_id": ""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid task ID or query failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KlingV4ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "Send your ModelVerse API key as `Authorization: Bearer <YOUR_API_KEY>`."
      }
    },
    "schemas": {
      "KlingV4SubmitRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "kling-v4"
          },
          "input": {
            "$ref": "#/components/schemas/KlingV4Input"
          },
          "parameters": {
            "$ref": "#/components/schemas/KlingV4Parameters"
          }
        }
      },
      "KlingV4Input": {
        "type": "object",
        "description": "The input object is required. T2V requires a prompt and no image/video media. I2V requires at least one image.\nOmni requires a prompt, supplied either in `input.prompt` or a prompt item in `parameters.contents`.\nUpstream image requirements: JPG, JPEG, or PNG; at most 30 MB per image; width and height at least 300 px;\naspect ratio from 2:5 to 5:2; image URL or Base64 input.\nUpstream video requirements: MP4 or MOV; at most 300 MB per clip; input video duration 3–30 seconds;\nwidth and height each 700–4553 px; pixel area at most 8,294,400; aspect ratio from 2:5 to 5:2;\nframe rate 24–60 fps; video must be supplied via URL.\nThese are upstream media requirements, not file properties individually checked by this API at submission time.\n",
        "properties": {
          "prompt": {
            "type": "string",
            "description": "For non-T2V variants, merged into contents. If both input and contents provide prompt text, they must match.\nFor Omni, cite media with an `id` in `parameters.contents` using `@id` (for example, `@image_1`).\nDescribe each reference's purpose and scope, overall setting, event sequence, and audio requirements.\n"
          },
          "first_frame_url": {
            "type": "string",
            "description": "First-frame image; may trigger automatic I2V selection.",
            "example": "https://example.com/first-frame.png"
          },
          "last_frame_url": {
            "type": "string",
            "description": "Last-frame image, used with a first-frame image.",
            "example": "https://example.com/last-frame.png"
          },
          "img_url": {
            "type": "string",
            "description": "Legacy first-frame image input."
          },
          "images": {
            "type": "array",
            "description": "First image becomes first_frame; subsequent images become middle_frame.",
            "items": {
              "type": "string"
            }
          },
          "video_url": {
            "type": "string",
            "description": "Legacy video input, converted to base_video; may trigger Omni selection.",
            "example": "https://example.com/source-video.mp4"
          }
        }
      },
      "KlingV4Parameters": {
        "type": "object",
        "properties": {
          "kling_type": {
            "type": "string",
            "enum": [
              "t2v",
              "i2v",
              "omni_video"
            ],
            "description": "Choose the upstream variant, or omit it for input-based inference. Explicit variants must be compatible with the media.\nThis value is also used for billing tiers; the public model ID remains `kling-v4`.\n"
          },
          "duration": {
            "type": "integer",
            "minimum": 3,
            "maximum": 30,
            "description": "Requested output duration in seconds. The V4 adaptor accepts nonzero integer durations from 3 to 30,\nbut the general task validator checks the model's billing `allowed_duration` first. The desired value,\nparticularly 16–30 seconds, must be listed in that configuration. Omitting duration does not apply\nthe billing `default_duration` automatically.\n"
          },
          "resolution": {
            "type": "string",
            "enum": [
              "720p",
              "1080p"
            ],
            "description": "Resolution; normalized to lowercase before validation, so `720P` and `1080P` also work."
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "21:9",
              "16:9",
              "9:16",
              "1:1",
              "adaptive"
            ],
            "description": "Allowed for T2V and Omni only; `adaptive` is Omni-only. I2V rejects this parameter."
          },
          "contents": {
            "type": "array",
            "description": "Content items for I2V or Omni; not accepted by T2V. Alternatively, use input media fields and let the service\nconvert them into contents. If both representations are provided, they must match item-by-item exactly;\nprefer one representation per request.\nAssign a unique id to each media item referenced in `input.prompt` or a prompt content item's text, then cite it as `@id`.\n",
            "items": {
              "$ref": "#/components/schemas/KlingV4Content"
            }
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "Watermark setting, taking precedence over `watermark` when supplied."
          },
          "watermark": {
            "type": "boolean",
            "description": "Legacy watermark setting used if `watermark_enabled` is omitted."
          },
          "external_task_id": {
            "type": "string",
            "description": "Custom task ID forwarded upstream. Use the returned `output.task_id` for status queries."
          }
        }
      },
      "KlingV4Content": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "prompt",
              "first_frame",
              "middle_frame",
              "last_frame",
              "refer_image",
              "base_video",
              "feature_video",
              "element",
              "voice"
            ],
            "description": "I2V accepts prompt and first_frame / middle_frame / last_frame only. Omni accepts all.\n"
          },
          "text": {
            "type": "string",
            "description": "Required and nonblank for type=prompt; may cite media with an id in the same contents array using @id."
          },
          "url": {
            "type": "string",
            "description": "Required for image and video items; images accept URLs or Base64, while videos require URLs. See KlingV4Input for media specifications."
          },
          "id": {
            "type": "string",
            "description": "Media identifier unique within a task; required for element and voice items. Cite an id such as image_1 in the prompt as @image_1."
          },
          "element_id": {
            "type": "string",
            "description": "Required for type=element."
          },
          "voice_id": {
            "type": "string",
            "description": "Required for type=voice."
          }
        },
        "description": "I2V requires 1–10 images. Omni accepts up to 10 images, 5 videos (at most one base_video), 7 elements,\nand 3 voices, at most 15 resources total, and requires a prompt. IDs must be unique.\n"
      },
      "KlingV4SubmitResponse": {
        "type": "object",
        "required": [
          "output",
          "request_id"
        ],
        "properties": {
          "output": {
            "type": "object",
            "required": [
              "task_id"
            ],
            "properties": {
              "task_id": {
                "type": "string",
                "description": "Asynchronous task ID for subsequent status queries."
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "Submission request identifier."
          }
        }
      },
      "KlingV4StatusResponse": {
        "type": "object",
        "required": [
          "output",
          "request_id"
        ],
        "properties": {
          "output": {
            "type": "object",
            "required": [
              "task_id",
              "task_status"
            ],
            "properties": {
              "task_id": {
                "type": "string"
              },
              "task_status": {
                "type": "string",
                "enum": [
                  "Pending",
                  "Running",
                  "Success",
                  "Failure",
                  "Unknown",
                  "Cancelled",
                  "Expired"
                ],
                "description": "Public task status."
              },
              "urls": {
                "type": "array",
                "description": "Generated resource URLs; the Vtrix adaptor currently extracts the first available video or image URL.",
                "items": {
                  "type": "string"
                }
              },
              "submit_time": {
                "type": "integer",
                "format": "int64",
                "description": "Submission time as a Unix timestamp in seconds."
              },
              "finish_time": {
                "type": "integer",
                "format": "int64",
                "description": "Completion time as a Unix timestamp in seconds."
              },
              "error_message": {
                "type": "string",
                "description": "Error message when the task fails."
              }
            }
          },
          "usage": {
            "type": "object",
            "description": "Upstream usage; prefers `quantity` over `duration` when available.",
            "properties": {
              "duration": {
                "type": "integer",
                "description": "Reported billable usage or duration in seconds; may differ from requested output duration."
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "Currently an empty string for status queries."
          }
        }
      },
      "KlingV4ErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "request_id": {
            "type": "string"
          }
        }
      }
    }
  }
}
```
