openapi: 3.1.0
info:
  title: Kling v3
  version: '1.0'
  description: Kling 3.0 video generation model. Supports text-to-video, image-to-video, first/last-frame interpolation, and multi-reference image-to-video.
servers:
- url: https://openapi.imini.ai/imini/router
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Pass `Authorization: Bearer <YOUR_API_KEY>` in the request header. Go to the [API Keys management page](https://imini.ai/api-keys) to create and manage API Keys.
security:
- ApiKeyAuth: []
paths:
  /v1/videos/generate:
    post:
      summary: Kling v3
      operationId: generateKlingV3
      security:
      - ApiKeyAuth: []
      description: |
        Submit an asynchronous video generation task. You will need to poll the query endpoint to retrieve the result.

        > Model ID: `kling/kling-v3` · Underlying: Kling 3.0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model
              properties:
                model:
                  type: string
                  description: Fixed value `kling/kling-v3`.
                prompt:
                  type: string
                  description: |
                    The prompt. Up to **2500** characters.

                    > May be empty when `extra_params.multi_shot` (multi-shot mode) is enabled; in that case, per-shot prompts are provided via `extra_params.multi_prompt`.
                  example: A cinematic shot of an orange cat stretching slowly under cherry blossoms, warm sunlight
                resolution:
                  type: string
                  description: Output resolution. Defaults to `720P`.
                  default: 720P
                  enum:
                  - 720P
                  - 1080P
                aspect_ratio:
                  type: string
                  description: Output aspect ratio. Defaults to `16:9`.
                  default: '16:9'
                  enum:
                  - '16:9'
                  - '9:16'
                  - '1:1'
                duration:
                  type: integer
                  description: Video duration in seconds. Defaults to `5`; range `3 ~ 15`.
                  default: 5
                  minimum: 3
                  maximum: 15
                generate_audio:
                  type: boolean
                  description: Whether to generate audio. Defaults to `false`.
                  default: false
                reference_images:
                  type: array
                  description: |
                    Reference image list, **up to 4 images**. When empty, the task is text-to-video; otherwise the input mode is determined by the `reference_type` combination:
                    - **Image-to-video**: 1 image with `first_frame`
                    - **First/last-frame interpolation**: 1 `first_frame` + 1 `last_frame`
                    - **Multi-reference image-to-video**: up to 4 images with `asset`

                    **Image constraints** (each image must satisfy):
                    - Format: `jpg` / `jpeg` / `png`
                    - File size: ≤ **10 MB**
                    - Dimensions: width and height each ≥ **200 px**
                    - Aspect ratio: **1:2.5 ~ 2.5:1**
                  maxItems: 4
                  items:
                    type: object
                    required:
                    - url
                    properties:
                      url:
                        type: string
                        description: |
                          Image address, in one of two forms:
                          **1)** A publicly accessible URL (`http://` or `https://`);
                          **2)** A Data URI base64 encoding (starting with `data:image/`).

                          Constraints: format `jpg` / `jpeg` / `png`; file ≤ 10 MB; width and height ≥ 200 px; aspect ratio 1:2.5 ~ 2.5:1.
                      reference_type:
                        type: string
                        description: |
                          Reference type:
                          - `asset` — generic asset reference (default)
                          - `first_frame` — first frame
                          - `last_frame` — last frame
                        default: asset
                        enum:
                        - asset
                        - first_frame
                        - last_frame
                extra_params:
                  type: object
                  description: Kling's official extension parameters. All optional.
                  properties:
                    multi_shot:
                      type: boolean
                      default: false
                      description: |
                        Whether to enable multi-shot mode.
                        - `true`: multi-shot enabled. The top-level `prompt` is ignored and first/last-frame generation is not supported;
                        - `false`: multi-shot disabled. `shot_type` and `multi_prompt` are ignored.
                    shot_type:
                      type: string
                      description: |
                        Shot type. Only effective when `multi_shot=true`.
                        - `intelligence` — model splits shots automatically from `prompt`;
                        - `customize` — each shot is explicitly defined via `multi_prompt`.
                      enum:
                      - intelligence
                      - customize
                    multi_prompt:
                      type: array
                      description: |
                        Per-shot definitions. **Required when `multi_shot=true` and `shot_type=customize`.**

                        - Minimum **1**, maximum **6** shots
                        - Each shot prompt is up to **512** characters
                        - Each shot duration must be ≥ 1s and ≤ the total `duration`
                        - The sum of all shot durations must equal the total `duration`
                      minItems: 1
                      maxItems: 6
                      items:
                        type: object
                        required:
                        - index
                        - prompt
                        - duration
                        properties:
                          index:
                            type: integer
                            description: Shot index, starting from `1`.
                          prompt:
                            type: string
                            description: Prompt for this shot. Up to 512 characters.
                            maxLength: 512
                          duration:
                            type: string
                            description: Shot duration in seconds, passed as a string (e.g. `"5"`). Must be ≥ 1 and ≤ the total `duration`.
                            example: "5"
                    negative_prompt:
                      type: string
                      maxLength: 2500
                      description: Negative prompt. Up to **2500** characters.
                    cfg_scale:
                      type: number
                      minimum: 0
                      maximum: 1
                      default: 0.5
                      description: |
                        Generation freedom. Defaults to `0.5`; range `[0, 1]`.

                        Higher values reduce the model's freedom and increase adherence to the prompt.
                    camera_control:
                      type: object
                      description: |
                        Camera movement control configuration.

                        **Scope**: Only takes effect for **text-to-video** and **image-to-video (first frame, `reference_type=first_frame`)**. **Not supported for multi-reference image-to-video (`reference_type=asset`).**
                      properties:
                        type:
                          type: string
                          enum:
                          - simple
                          - down_back
                          - forward_up
                          - right_turn_forward
                          - left_turn_forward
                          description: |
                            Predefined camera movement type.
                            - `simple` — custom movement; requires `config` to specify exact parameters
                            - `down_back` — push down and pull back
                            - `forward_up` — push forward and tilt up
                            - `right_turn_forward` — turn right and push forward
                            - `left_turn_forward` — turn left and push forward
                        config:
                          type: object
                          description: |
                            Six fields specifying camera motion or change along different axes.

                            Required when `type=simple`; must be omitted otherwise.

                            **Choose 1 of 6** — exactly one field may be non-zero; all others must be 0.
                          properties:
                            horizontal:
                              type: number
                              minimum: -10
                              maximum: 10
                              description: |
                                Horizontal pan along the x-axis.
                                Range `[-10, 10]`: negative pans left, positive pans right.
                            vertical:
                              type: number
                              minimum: -10
                              maximum: 10
                              description: |
                                Vertical pan along the y-axis.
                                Range `[-10, 10]`: negative pans down, positive pans up.
                            pan:
                              type: number
                              minimum: -10
                              maximum: 10
                              description: |
                                Horizontal rotation around the y-axis.
                                Range `[-10, 10]`: negative rotates left, positive rotates right.
                            tilt:
                              type: number
                              minimum: -10
                              maximum: 10
                              description: |
                                Vertical rotation around the x-axis.
                                Range `[-10, 10]`: negative tilts down, positive tilts up.
                            roll:
                              type: number
                              minimum: -10
                              maximum: 10
                              description: |
                                Roll around the z-axis.
                                Range `[-10, 10]`: negative rolls counter-clockwise, positive rolls clockwise.
                            zoom:
                              type: number
                              minimum: -10
                              maximum: 10
                              description: |
                                Zoom — controls focal length and field of view.
                                Range `[-10, 10]`: negative narrows the field of view (longer focal length), positive widens it.
                  additionalProperties: true
            examples:
              "Text to Video - Multi-Shot":
                summary: Text to Video - Multi-Shot
                value:
                  model: kling/kling-v3
                  resolution: 720P
                  aspect_ratio: '9:16'
                  duration: 8
                  generate_audio: true
                  extra_params:
                    multi_shot: true
                    shot_type: customize
                    multi_prompt:
                    - index: 1
                      prompt: Two friends talking under a streetlight at night. Warm glow, casual poses, no dialogue.
                      duration: '2'
                    - index: 2
                      prompt: A runner sprinting through a forest, leaves flying. Low-angle shot, focus on movement.
                      duration: '3'
                    - index: 3
                      prompt: A woman hugging a cat, smiling. Soft sunlight, cozy home setting, emphasize warmth.
                      duration: '3'
              "Image to Video - Multi-Shot":
                summary: Image to Video - Multi-Shot
                value:
                  model: kling/kling-v3
                  prompt: ''
                  reference_images:
                  - url: https://file.iminicdn.com/public/2026/04/11/2042857867857498112/8QUzTr7a.png
                  resolution: 720P
                  aspect_ratio: '16:9'
                  duration: 10
                  generate_audio: true
                  extra_params:
                    multi_shot: true
                    shot_type: customize
                    multi_prompt:
                    - index: 1
                      prompt: '[Close-up] The motorcycle engine vibrates intensely; thick white exhaust plumes into the freezing air.'
                      duration: '1'
                    - index: 2
                      prompt: '[Low Angle] Camera near the snow surface; the rear wheel kicks up a massive spray of ice and snow while speeding past.'
                      duration: '2'
                    - index: 3
                      prompt: '[Wide Shot] Aerial view. The motorcycle rides solitarily across the vast white ice field with grand snowy mountains in the background.'
                      duration: '2'
                    - index: 4
                      prompt: '[Medium Shot] Profile of the rider in a weathered leather jacket, the goggles reflecting the cold winter light.'
                      duration: '1'
                    - index: 5
                      prompt: '[Medium Shot] Dynamic tracking shot moving parallel to the bike, capturing the balance of riding on snow.'
                      duration: '2'
                    - index: 6
                      prompt: '[Long Shot] Zoom out slowly as the rider disappears into the grey horizon, with the forest shrouded in snow mist.'
                      duration: '2'
              "First & Last Frame":
                summary: First & Last Frame
                value:
                  model: kling/kling-v3
                  prompt: ''
                  reference_images:
                  - url: https://file.iminicdn.com/public/2026/04/11/2042869610478440448/Xq4AGRrI.jpg
                    reference_type: first_frame
                  - url: https://file.iminicdn.com/public/2026/04/11/2042869610478440448/f2nTCl56.jpg
                    reference_type: last_frame
                  resolution: 720P
                  aspect_ratio: '9:16'
                  duration: 5
              "Multi Reference Images":
                summary: Multi Reference Images
                value:
                  model: kling/kling-v3
                  prompt: In the park, a little boy and a puppy are having a picnic and playing on the grass by the lake.
                  reference_images:
                  - url: https://file.iminicdn.com/public/2026/04/11/2042877824624365568/O5hm7DKe.png
                    reference_type: asset
                  - url: https://file.iminicdn.com/public/2026/04/11/2042877824624365568/iW_m9uHk.png
                    reference_type: asset
                  - url: https://file.iminicdn.com/public/2026/04/11/2042877824624365568/yHYHwPnG.png
                    reference_type: asset
                  resolution: 720P
                  aspect_ratio: '16:9'
                  duration: 5
      responses:
        '200':
          description: Submitted successfully (asynchronous mode)
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    type: string
                    description: Unique task ID, used for subsequent polling
                    example: task_2042864638838083584
                  model:
                    type: string
                    description: The model ID used for this task
                    example: kling/kling-v3
                  created_at:
                    type: string
                    description: Task creation time (ISO 8601)
                    example: '2026-04-11T07:17:39.146Z'
                  request_id:
                    type: string
                    description: Unique request ID
                    example: 291a4117-9df8-4349-aee1-bdf8ffcacb9a
        '400':
          description: Validation Error (e.g. invalid parameter, invalid prompt)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: Error code
                        example: INVALID_PARAMETER
                      message:
                        type: string
                        description: Error message details
                        example: prompt exceeds max length 2500
                      status:
                        type: integer
                        description: HTTP status code
                        example: 400
                      request_id:
                        type: string
                        description: Unique request identifier
                        example: req_abc123
