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

# Kling v2.6 Motion Control 동영상 생성

>  - Kling 모션 컨트롤 모델 (참조 이미지 + 참조 동영상)
- 통합 엔드포인트 `/v1/videos/generations` 를 통해 호출
- image / video 두 가지 캐릭터 방향 지원, 최대 시간 각각 10s / 30s
- 비동기 작업 — 제출 후 task_id 반환 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "kling-v2-6-motion-control",
      "prompt": "참조 동영상에 따라 캐릭터가 몸을 돌려 손을 흔드는 동작, 영화적 조명",
      "image_url": "https://example.com/ref-image.png",
      "video_url": "https://example.com/ref-video-8s.mp4",
      "keep_original_sound": "yes",
      "character_orientation": "image",
      "mode": "std",
      "watermark_info": {"enabled": false}
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "kling-v2-6-motion-control",
      "prompt": "참조 동영상에 따라 캐릭터가 몸을 돌려 손을 흔드는 동작, 영화적 조명",
      "image_url": "https://example.com/ref-image.png",
      "video_url": "https://example.com/ref-video-8s.mp4",
      "keep_original_sound": "yes",
      "character_orientation": "image",
      "mode": "std",
      "watermark_info": {"enabled": False}
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "kling-v2-6-motion-control",
    prompt: "참조 동영상에 따라 캐릭터가 몸을 돌려 손을 흔드는 동작, 영화적 조명",
    image_url: "https://example.com/ref-image.png",
    video_url: "https://example.com/ref-video-8s.mp4",
    keep_original_sound: "yes",
    character_orientation: "image",
    mode: "std",
    watermark_info: { enabled: false }
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "요청 파라미터가 유효하지 않습니다",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "인증에 실패했습니다. API 키를 확인해 주세요.",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "잔액이 부족합니다. 충전 후 다시 시도해 주세요.",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "요청이 너무 많습니다. 잠시 후 다시 시도해 주세요.",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "서버 내부 오류가 발생했습니다. 잠시 후 다시 시도해 주세요.",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## 인증

<ParamField header="Authorization" type="string" required>
  모든 요청에 Bearer Token 인증이 필요합니다

  API Key 발급:

  [API Key 관리 페이지](https://apimart.ai/keys)에서 API Key를 발급받으세요

  각 요청에 다음 헤더를 추가하세요:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## 요청 파라미터

<ParamField body="model" type="string" required>
  모델 이름: `kling-v3-motion-control` 또는 `kling-v2-6-motion-control`
</ParamField>

<ParamField body="prompt" type="string">
  동작, 카메라 움직임, 스타일을 보완하는 텍스트 프롬프트

  선택 사항이지만 구체적으로 작성할수록 안정적인 결과를 얻을 수 있습니다

  예: `"캐릭터가 참조 동영상에 맞춰 춤을 춥니다, 부드러운 동작, 사실적인 스타일"`
</ParamField>

<ParamField body="image_url" type="string" required>
  참조 이미지 URL

  공개적으로 접근 가능한 링크여야 합니다
</ParamField>

<ParamField body="video_url" type="string" required>
  참조 동영상 URL

  공개적으로 접근 가능한 직접 링크여야 합니다. mp4/mov 권장, 100MB 이하

  <Warning>
    서버가 `video_url`의 실제 시간을 측정합니다. 최소 3초이며, 최대값은 `character_orientation`에 따라 결정됩니다.
  </Warning>
</ParamField>

<ParamField body="keep_original_sound" type="string" default="yes">
  참조 동영상의 원본 음성을 유지할지 여부

  선택 값:

  * `yes`: 원본 음성 유지 (기본값)
  * `no`: 원본 음성 유지 안 함
</ParamField>

<ParamField body="character_orientation" type="string" required>
  캐릭터 방향 제어 방식

  선택 값:

  * `image`: 참조 이미지의 캐릭터 방향 사용 (참조 동영상 시간: `3~10s`)
  * `video`: 참조 동영상의 캐릭터 방향 사용 (참조 동영상 시간: `3~30s`)
</ParamField>

<ParamField body="mode" type="string" required>
  생성 모드

  선택 값:

  * `std`: 표준 모드 (속도와 품질의 균형)
  * `pro`: 고품질 모드 (처리 시간이 길어집니다)
</ParamField>

<ParamField body="watermark_info" type="object">
  워터마크 제어 객체 (선택 사항)

  <Expandable title="watermark_info 필드">
    <ParamField body="enabled" type="boolean" default="false">
      워터마크 추가 여부

      * `true`: 워터마크 추가
      * `false`: 워터마크 추가 안 함 (기본값)
    </ParamField>
  </Expandable>
</ParamField>

## 시간 규칙

| 조건                              | 허용 참조 동영상 시간 |
| ------------------------------- | ------------ |
| `character_orientation = image` | `3s ~ 10s`   |
| `character_orientation = video` | `3s ~ 30s`   |

<Note>
  과금 시간은 서버가 `video_url`에서 측정한 실제 시간을 기준으로 하며, 클라이언트 측 추정값이 아닙니다.
</Note>

## 응답

<ResponseField name="code" type="integer">
  응답 상태 코드, 성공 시 200
</ResponseField>

<ResponseField name="data" type="array">
  응답 데이터 배열

  <Expandable title="배열 요소">
    <ResponseField name="status" type="string">
      작업 상태, 초기 제출 시 `submitted`
    </ResponseField>

    <ResponseField name="task_id" type="string">
      작업 고유 식별자, 작업 상태 및 결과 조회에 사용
    </ResponseField>
  </Expandable>
</ResponseField>

## 사용 예시

### 예시 1: image 방향 (10초 이내)

```json theme={null}
{
  "model": "kling-v2-6-motion-control",
  "prompt": "참조 이미지의 캐릭터 방향에 맞춰 몸을 돌려 손을 흔드는 동작",
  "image_url": "https://example.com/ref-image.png",
  "video_url": "https://example.com/ref-video-8s.mp4",
  "character_orientation": "image",
  "mode": "std",
  "keep_original_sound": "yes",
  "watermark_info": {"enabled": false}
}
```

### 예시 2: video 방향 (30초 이내)

```json theme={null}
{
  "model": "kling-v2-6-motion-control",
  "prompt": "참조 동영상의 캐릭터 방향과 리듬을 따라 부드러운 동작을 유지",
  "image_url": "https://example.com/ref-image.png",
  "video_url": "https://example.com/ref-video-12s.mp4",
  "character_orientation": "video",
  "mode": "pro",
  "keep_original_sound": "no",
  "watermark_info": {"enabled": false}
}
```
