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

# Kling Motion Control görevi oluşturma

> Bir karakter görselinden ve referans hareket videosundan, uyumlu CometAPI rotasıyla Kling Motion Control görevi oluşturun.

Bu endpoint'i, bir karakter görselinden ve bir
referans videosundan Motion Control görevi oluşturmak için kullanın.

<Warning>
  Bu sayfa uyumlu Motion Control rotasını açıklar. Kling Video 3.0
  Motion Control ayrı bir API sözleşmesi kullanır.
</Warning>

## Gerekli medya

`image_url` genel bir URL'yi veya ham bir Base64 dizesini kabul eder.

* 10 MB veya daha küçük bir JPG, JPEG ya da PNG görseli kullanın.
* Her görsel boyutunu 300 ile 65.536 piksel arasında tutun.
* 1:2,5 ile 2,5:1 arasında bir en-boy oranı kullanın.
* Base64'ü ham kodlanmış dize olarak, bir
  `data:image/...;base64,` öneki olmadan gönderin.
* Hareket
  referansıyla eşleşen vücut kadrajına sahip, engellenmemiş tek bir karakter gösterin.

`video_url` genel bir MP4 veya MOV URL'sini kabul eder.

* 100 MB veya daha küçük bir video kullanın.
* Kısa kenarı en az 340 piksel yapın.
* Uzun kenarı en fazla 3850 piksel yapın.
* Görünür tek bir karakter içeren kesintisiz bir çekim kullanın.
* Kesintilerden, kamera değişikliklerinden ve aşırı hızlı hareketlerden kaçının.

<Note>
  Süre sınırlarına uyun ve iç içe terminal `task_status` değerini inceleyin. Bir
  dış HTTP 200 veya yanıt `code: 0`, başarılı bir
  üretim sonucunu değil, sorgu yanıtını doğrular.
</Note>

## orientation değerini ayarlayın

`character_orientation` zorunludur ve `image` veya `video` değerlerini kabul eder.

| Değer   | Referans video süresi |
| ------- | --------------------- |
| `image` | 3–10 saniye           |
| `video` | 3–30 saniye           |

`element_list` kullanırsanız `character_orientation` değerini `video` olarak ayarlayın.

## Modeli ve modu seçin

Uyumlu rota `kling-v2-6` ve `kling-v3` değerlerini kabul eder. Her iki model değeri de
her iki mod değerini kabul eder:

| Model        | `std`        | `pro`        |
| ------------ | ------------ | ------------ |
| `kling-v2-6` | Kabul edilir | Kabul edilir |
| `kling-v3`   | Kabul edilir | Kabul edilir |

`model_name` değerini atlarsanız istek `kling-v2-6` değerini kullanır. `mode` değerini atlarsanız,
istek `std` değerini kullanır. `kling-v3` değeri, uyumlu istek biçimini
bu sayfada açıklandığı şekilde korur; ayrı Kling 3.0 yol-sürüm
sözleşmesini seçmez.

Uyumlu sözleşme sabit bir çıktı çözünürlüğünü garanti etmez. Uygulamanız belirli boyutlar gerektiriyorsa
döndürülen her videoyu inceleyin.

`keep_original_sound` `yes` veya `no` değerlerini kabul eder. Bu alanı atlarsanız istek
`yes` değerini kullanır.

## Görev akışı

<Steps>
  <Step title="Motion Control isteğini gönderin">
    Kaynak görseli, referans videosunu ve orientation değerini gönderin. Bir
    model, mod ve ses değeri seçin veya belgelenmiş varsayılanlarını kullanın. Döndürülen
    `task_id` değerini saklayın.
  </Step>

  <Step title="Görevi sorgulayın">
    Şunu kullanın: [Bir Kling görevi alma](./individual-queries) döndürülen `task_id` ile.
    Durum `succeed` veya `failed` olana kadar devam edin.
  </Step>

  <Step title="Sonucu saklayın">
    Sonucu hemen indirin ve saklayın. Kling'in uyumlu API
    belgeleri, üretilen videoların 30 gün sonra silindiğini belirtir. Döndürülen
    URL'nin 30 günün tamamı boyunca erişilebilir kalacağına güvenmeyin.
  </Step>
</Steps>

## İsteğe bağlı alanlar

| Alan               | Yapı                                                   | Kısıtlama                                                                                                  |
| ------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| `prompt`           | Dize, en fazla 2500 karakter                           | Uyumlu istek yapısındaki isteğe bağlı metin alanı.                                                         |
| `callback_url`     | URI dizesi veya boş dize                               | Geri çağırma URI'si yapılandırılmadığında alanı atlayın ya da boş dize kullanın.                           |
| `external_task_id` | Hesabınız için benzersiz dize                          | Görevi uygulamanızla ilişkilendirir. CometAPI sorguları için döndürülen `task_id` değerinin yerine geçmez. |
| `element_list`     | En fazla bir `{"element_id": 123}` nesnesi içeren dizi | Bu alanı yalnızca şununla birlikte kullanın `character_orientation: "video"`.                              |
| `watermark_info`   | `{"enabled": boolean}`                                 | Uyumlu filigran yapısı yalnızca `enabled` Boolean değerini içerir.                                         |

## Geri çağırma yapısı

Legacy geri çağırma şeması aşağıdaki yapıya sahiptir:

```json theme={null}
{
  "task_id": "<task_id>",
  "task_status": "succeed",
  "task_status_msg": "",
  "created_at": 1785398400000,
  "updated_at": 1785398460000,
  "final_unit_deduction": "<value>",
  "final_balance_deduction": {
    "quota": "<value>",
    "list_price": "<value>"
  },
  "task_info": {
    "external_task_id": "<your_unique_id>"
  },
  "task_result": {
    "videos": [
      {
        "id": "<video_id>",
        "url": "https://media.example.com/<file_id>.mp4",
        "duration": "6.4"
      }
    ]
  }
}
```

Geri çağırma durumu `submitted`, `processing`, `succeed` veya `failed` olabilir.
Terminal sonuç alanları yalnızca terminal durum için döndürüldüklerinde bulunur.

## Sonuç alanları

| Alan                                 | Tür                                       | Açıklama                                                        |
| ------------------------------------ | ----------------------------------------- | --------------------------------------------------------------- |
| `task_result.videos[].id`            | Dize                                      | Üretilen video kimliği.                                         |
| `task_result.videos[].url`           | URI dizesi                                | Üretilen videonun teslim URL'si.                                |
| `task_result.videos[].watermark_url` | URI dizesi                                | Görev bir tane döndürdüğünde filigranlı videonun teslim URL'si. |
| `task_result.videos[].duration`      | Dize                                      | Üretilen videonun saniye cinsinden süresi.                      |
| `final_unit_deduction`               | Dize                                      | Görevle birlikte döndürülen nihai birim kesinti değeri.         |
| `final_balance_deduction`            | `{"quota": string, "list_price": string}` | Görevle birlikte döndürülen nihai bakiye kesinti değerleri.     |

Görev durumu `submitted`, `processing`, `succeed` veya `failed` olabilir.

<Tip>
  Şunlara bakın: [Kling Motion Control API referansı](https://kling.ai/document-api/api/video/motion-control/legacy)
  ve [Kling geri çağırma protokolü](https://kling.ai/document-api/api/get-started/callbacks)
  API ayrıntıları için.
</Tip>


## OpenAPI

````yaml api/openapi/video/kling/post-motion-control.openapi.json POST /kling/v1/videos/motion-control
openapi: 3.1.0
info:
  title: Kling Motion Control API
  version: 1.0.0
  description: >-
    Create a Kling Motion Control task from a character image and a reference
    motion video.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/motion-control:
    post:
      summary: Create a Kling Motion Control task
      description: >-
        Submit a character image and a reference motion video. The response
        contains a task ID that you can use for status queries.
      operationId: create_kling_motion_control
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - image_url
                - video_url
                - character_orientation
              properties:
                model_name:
                  type: string
                  description: >-
                    Model ID for this compatible Motion Control request. Omit
                    this field to use `kling-v2-6`. The `kling-v3` value keeps
                    this compatible request shape; it does not select the
                    separate Kling 3.0 path-version contract.
                  enum:
                    - kling-v2-6
                    - kling-v3
                  default: kling-v2-6
                image_url:
                  type: string
                  description: >-
                    Character image as a public URL or a raw Base64 string. Send
                    raw Base64 without a `data:image/...;base64,` prefix;
                    data-URI input is outside the compatible contract. Supported
                    formats are JPG, JPEG, and PNG. The image must be 10 MB or
                    smaller. Its width and height must each be from 300 through
                    65,536 pixels, and its aspect ratio must be between 1:2.5
                    and 2.5:1.
                video_url:
                  type: string
                  format: uri
                  description: >-
                    Public reference motion video URL. Use an MP4 or MOV file
                    that is 100 MB or smaller. The short edge must be at least
                    340 pixels, and the long edge must not exceed 3850 pixels.
                    The video must be at least 3 seconds long. The maximum
                    duration depends on `character_orientation`.
                prompt:
                  type: string
                  maxLength: 2500
                  description: >-
                    Optional text field in the compatible request structure.
                    Maximum 2500 characters.
                keep_original_sound:
                  type: string
                  description: >-
                    Compatible string enum. Accepted values are `yes` and `no`.
                    Omitted requests use `yes`.
                  enum:
                    - 'yes'
                    - 'no'
                  default: 'yes'
                character_orientation:
                  type: string
                  description: >-
                    Required compatible string enum. With `image`, the reference
                    video can be 3 to 10 seconds long. With `video`, the
                    reference video can be 3 to 30 seconds long.
                  enum:
                    - image
                    - video
                mode:
                  type: string
                  description: >-
                    Both compatible models accept `std` and `pro`. Omitted
                    requests use `std`.
                  enum:
                    - std
                    - pro
                  default: std
                callback_url:
                  description: >-
                    Optional callback field in the compatible structure. Provide
                    a URI, or omit the field or send an empty string when no
                    callback URI is configured.
                  oneOf:
                    - type: string
                      format: uri
                    - type: string
                      const: ''
                external_task_id:
                  type: string
                  description: >-
                    Optional ID for correlation in your application. The value
                    must be unique for your account. Store the returned
                    `task_id` for CometAPI status queries.
                element_list:
                  type: array
                  maxItems: 1
                  description: >-
                    Optional compatible Element structure. Provide at most one
                    object, and combine this field only with
                    `character_orientation: video`.
                  items:
                    type: object
                    required:
                      - element_id
                    properties:
                      element_id:
                        type: integer
                        format: int64
                        description: Kling Element ID in the compatible structure.
                    additionalProperties: false
                watermark_info:
                  type: object
                  description: Optional compatible watermark structure.
                  required:
                    - enabled
                  properties:
                    enabled:
                      type: boolean
                      description: Boolean flag in the compatible watermark structure.
                  additionalProperties: false
              example:
                model_name: kling-v3
                image_url: https://your-image-host.example.com/character.png
                video_url: https://your-video-host.example.com/reference-motion.mp4
                prompt: Studio scene.
                keep_original_sound: 'no'
                character_orientation: video
                mode: std
            examples:
              Image URL:
                summary: Use a public character image URL
                value:
                  model_name: kling-v3
                  image_url: https://your-image-host.example.com/character.png
                  video_url: https://your-video-host.example.com/reference-motion.mp4
                  prompt: Studio scene.
                  keep_original_sound: 'no'
                  character_orientation: video
                  mode: std
              Image base64:
                summary: Use a raw Base64 character image
                value:
                  model_name: kling-v3
                  image_url: <your-image-base64>
                  video_url: https://your-video-host.example.com/reference-motion.mp4
                  prompt: Studio scene.
                  keep_original_sound: 'no'
                  character_orientation: video
                  mode: pro
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                    description: >-
                      Response code. A value of 0 indicates that the request was
                      accepted.
                  message:
                    type: string
                    description: Response message.
                  data:
                    type: object
                    required:
                      - task_id
                      - task_status
                      - task_info
                      - created_at
                      - updated_at
                    properties:
                      task_id:
                        type: string
                        description: System-generated task ID for status queries.
                      task_status:
                        type: string
                        description: Task state after submission.
                        const: submitted
                      task_status_msg:
                        type: string
                        description: Status detail when returned.
                      task_info:
                        type: object
                        description: Additional task metadata. The object can be empty.
                        additionalProperties: true
                      created_at:
                        type: integer
                        format: int64
                        description: Task creation timestamp in milliseconds.
                      updated_at:
                        type: integer
                        format: int64
                        description: Last task update timestamp in milliseconds.
                example:
                  code: 0
                  message: SUCCEED
                  data:
                    task_id: <task_id>
                    task_status: submitted
                    task_info: {}
                    created_at: 1785398400000
                    updated_at: 1785398400000
      x-codeSamples:
        - lang: Shell
          label: Image URL
          source: |
            curl https://api.cometapi.com/kling/v1/videos/motion-control \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "model_name": "kling-v3",
                "image_url": "https://your-image-host.example.com/character.png",
                "video_url": "https://your-video-host.example.com/reference-motion.mp4",
                "prompt": "Studio scene.",
                "keep_original_sound": "no",
                "character_orientation": "video",
                "mode": "std"
              }'
        - lang: Python
          label: Image URL
          source: |
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/motion-control",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                    "model_name": "kling-v3",
                    "image_url": "https://your-image-host.example.com/character.png",
                    "video_url": "https://your-video-host.example.com/reference-motion.mp4",
                    "prompt": "Studio scene.",
                    "keep_original_sound": "no",
                    "character_orientation": "video",
                    "mode": "std",
                },
            )

            result = response.json()
            print(result.get("code"), result.get("data", {}).get("task_id"))
        - lang: JavaScript
          label: Image URL
          source: |
            const response = await fetch(
              "https://api.cometapi.com/kling/v1/videos/motion-control",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify({
                  model_name: "kling-v3",
                  image_url: "https://your-image-host.example.com/character.png",
                  video_url: "https://your-video-host.example.com/reference-motion.mp4",
                  prompt: "Studio scene.",
                  keep_original_sound: "no",
                  character_orientation: "video",
                  mode: "std",
                }),
              },
            );

            const result = await response.json();
            console.log(result.code, result.data?.task_id);
        - lang: Shell
          label: Image base64
          source: |
            curl https://api.cometapi.com/kling/v1/videos/motion-control \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              --data-binary @- <<'JSON'
            {
              "model_name": "kling-v3",
              "image_url": "<base64-encoded-png>",
              "video_url": "https://your-video-host.example.com/reference-motion.mp4",
              "prompt": "Studio scene.",
              "keep_original_sound": "no",
              "character_orientation": "video",
              "mode": "pro"
            }
            JSON
        - lang: Python
          label: Image base64
          source: |
            import base64
            import os
            import requests

            with open("character.png", "rb") as image_file:
                image_base64 = base64.b64encode(image_file.read()).decode("ascii")

            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/motion-control",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                    "model_name": "kling-v3",
                    "image_url": image_base64,
                    "video_url": "https://your-video-host.example.com/reference-motion.mp4",
                    "prompt": "Studio scene.",
                    "keep_original_sound": "no",
                    "character_orientation": "video",
                    "mode": "pro",
                },
            )

            result = response.json()
            print(result.get("code"), result.get("data", {}).get("task_id"))
        - lang: JavaScript
          label: Image base64
          source: >
            import { readFile } from "node:fs/promises";


            const imageBase64 = (await
            readFile("character.png")).toString("base64");

            const response = await fetch(
              "https://api.cometapi.com/kling/v1/videos/motion-control",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify({
                  model_name: "kling-v3",
                  image_url: imageBase64,
                  video_url: "https://your-video-host.example.com/reference-motion.mp4",
                  prompt: "Studio scene.",
                  keep_original_sound: "no",
                  character_orientation: "video",
                  mode: "pro",
                }),
              },
            );


            const result = response.json();

            console.log(result.code, result.data?.task_id);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication. Use your CometAPI API key.

````