> ## 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 v3 Omni 비디오 생성

>  - 비동기 처리 모드, 후속 조회를 위한 작업 ID 반환
- 통합 텍스트-비디오/이미지-비디오 인터페이스, 이미지 참조 구문 지원
- 표준 모드(720P), 프로페셔널 모드(1080P), 4K 모드 지원
- image_N 이미지 참조 구문으로 프롬프트에서 이미지 참조
- 오디오가 포함된 비디오 생성 지원 (video_list와 배타적) 

<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-v3-omni",
      "prompt": "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
      "image_urls": ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
      "mode": "std",
      "duration": 5,
      "aspect_ratio": "16:9"
    }'
  ```

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

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

  payload = {
      "model": "kling-v3-omni",
      "prompt": "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
      "image_urls": ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
      "mode": "std",
      "duration": 5,
      "aspect_ratio": "16:9"
  }

  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-v3-omni",
    prompt: "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
    image_urls: ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
    mode: "std",
    duration: 5,
    aspect_ratio: "16:9"
  };

  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));
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://api.apimart.ai/v1/videos/generations"

      payload := map[string]interface{}{
          "model":        "kling-v3-omni",
          "prompt":       "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
          "image_urls":   []string{"https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"},
          "mode":         "std",
          "duration":     5,
          "aspect_ratio": "16:9",
      }

      jsonData, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;

  public class Main {
      public static void main(String[] args) throws Exception {
          String url = "https://api.apimart.ai/v1/videos/generations";

          String payload = """
          {
            "model": "kling-v3-omni",
            "prompt": "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
            "image_urls": ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
            "mode": "std",
            "duration": 5,
            "aspect_ratio": "16:9"
          }
          """;

          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create(url))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(payload))
              .build();

          HttpResponse<String> response = client.send(request,
              HttpResponse.BodyHandlers.ofString());

          System.out.println(response.body());
      }
  }
  ```

  ```php PHP theme={null}
  <?php

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

  $payload = [
      "model" => "kling-v3-omni",
      "prompt" => "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
      "image_urls" => ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
      "mode" => "std",
      "duration" => 5,
      "aspect_ratio" => "16:9"
  ];

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer <token>",
      "Content-Type: application/json"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ?>
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

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

  payload = {
    model: "kling-v3-omni",
    prompt: "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
    image_urls: ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
    mode: "std",
    duration: 5,
    aspect_ratio: "16:9"
  }

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(url)
  request["Authorization"] = "Bearer <token>"
  request["Content-Type"] = "application/json"
  request.body = payload.to_json

  response = http.request(request)
  puts response.body
  ```

  ```swift Swift theme={null}
  import Foundation

  let url = URL(string: "https://api.apimart.ai/v1/videos/generations")!

  let payload: [String: Any] = [
      "model": "kling-v3-omni",
      "prompt": "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
      "image_urls": ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
      "mode": "std",
      "duration": 5,
      "aspect_ratio": "16:9"
  ]

  var request = URLRequest(url: url)
  request.httpMethod = "POST"
  request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
  request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

  let task = URLSession.shared.dataTask(with: request) { data, response, error in
      if let error = error {
          print("Error: \(error)")
          return
      }

      if let data = data, let responseString = String(data: data, encoding: .utf8) {
          print(responseString)
      }
  }

  task.resume()
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Text;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main(string[] args)
      {
          var url = "https://api.apimart.ai/v1/videos/generations";

          var payload = @"{
              ""model"": ""kling-v3-omni"",
              ""prompt"": ""<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다"",
              ""image_urls"": [""https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp""],
              ""mode"": ""std"",
              ""duration"": 5,
              ""aspect_ratio"": ""16:9""
          }";

          using var client = new HttpClient();
          client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

          var content = new StringContent(payload, Encoding.UTF8, "application/json");
          var response = await client.PostAsync(url, content);
          var result = await response.Content.ReadAsStringAsync();

          Console.WriteLine(result);
      }
  }
  ```
</RequestExample>

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

  ```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>
  모든 API 엔드포인트는 Bearer Token 인증이 필요합니다

  API 키 받기:

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

  요청 헤더에 추가:

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

## 요청 매개변수

<ParamField body="model" type="string" required>
  비디오 생성 모델 이름

  지원 모델:

  * `kling-v3-omni` - Kling v3 Omni (통합 인터페이스)
</ParamField>

<ParamField body="prompt" type="string" required>
  긍정 텍스트 프롬프트

  `<<<image_N>>>` 구문으로 `image_urls`의 이미지를 참조할 수 있습니다. `N`은 1부터 시작합니다.

  예시: `"<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다"`

  <Note>
    이미지가 제공되었지만 프롬프트에 `<<<image_N>>>` 참조가 없는 경우, 시스템이 자동으로 프롬프트 앞에 `<<<image_1>>>`을 추가합니다.
  </Note>
</ParamField>

<ParamField body="negative_prompt" type="string">
  원하지 않는 콘텐츠를 제외하기 위한 네거티브 프롬프트입니다. 최대 길이는 2500자입니다.
</ParamField>

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

  옵션:

  * `std` - 표준 모드 (720P)
  * `pro` - 프로페셔널 모드 (1080P)
  * `4k` - 4K 초고화질 모드

  기본값: `std`
</ParamField>

<ParamField body="duration" type="integer" default="5">
  기본값: `5`
  비디오 길이 (초)

  값 범위: 3-15 (최소 3초, 최대 15초)

  **⚠️ 주의:** 순수한 숫자(예: `6`)를 입력해야 합니다. 따옴표를 추가하면 오류가 발생합니다
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  비디오 화면 비율

  옵션:

  * `16:9` - 가로
  * `9:16` - 세로
  * `1:1` - 정사각형

  기본값: `16:9`
</ParamField>

<ParamField body="image_urls" type="array<url>">
  이미지 참조를 위한 이미지 URL 배열

  프롬프트에서 `<<<image_N>>>` 구문으로 해당 위치의 이미지를 참조합니다 (N은 1부터 시작)

  예시: `["https://example.com/photo.jpg"]`

  <Warning>
    * 이미지 URL은 공개적으로 접근 가능해야 하며 핫링크 보호가 없어야 합니다
    * 이미지-비디오 모드에서는 `aspect_ratio`가 실제 이미지 비율로 대체될 수 있습니다
  </Warning>
</ParamField>

<ParamField body="image_with_roles" type="array<object>">
  역할 기반 이미지 배열이며, 이미지-비디오에서 권장됩니다.

  각 항목 형식: `{ "url": "...", "role": "..." }`

  * `first_frame`: 첫 프레임
  * `last_frame`: 끝 프레임
  * `reference`: 참조 이미지

  <Warning>
    `image_urls` 와 `image_with_roles` 는 둘 중 하나만 사용하세요. 동시에 전달하지 마세요.
  </Warning>
</ParamField>

<ParamField body="video_list" type="array" optional>
  참조 비디오 목록(URL 방식), 최대 1개까지 지원합니다.

  `refer_type`으로 유형을 구분합니다:

  * `base`: 편집 대상 비디오(기본값)
  * `feature`: 특징 참조 비디오

  `keep_original_sound`로 원본 오디오 유지 여부를 설정합니다:

  * `no`: 유지하지 않음(기본값)
  * `yes`: 원본 오디오 유지

  요청 형식:

  ```json theme={null}
  "video_list":[
    { "video_url": "video_url", "refer_type": "base", "keep_original_sound": "no" }
  ]
  ```

  <Warning>
    * `video_url`은 비워둘 수 없으며, 비디오 URL은 접근 가능해야 합니다
    * `refer_type=base`인 경우:
      * 비디오 시작/끝 프레임을 정의할 수 없습니다
      * 참조 비디오는 3-10초여야 합니다
      * 생성 비디오 길이는 업로드한 비디오를 따릅니다
    * `refer_type=feature`이고 `video_url`이 비어 있지 않은 경우:
      * `image_urls`에는 첫 프레임 이미지만 업로드할 수 있습니다
    * 비디오 요구사항: MP4/MOV만 지원; 길이 3초 이상; 해상도 720px-2160px; 프레임레이트 24-60fps(출력은 24fps); 크기 200MB 이하
  </Warning>
</ParamField>

<ParamField body="multi_shot" type="boolean" default="false">
  멀티 샷 분할 모드 활성화 여부.
</ParamField>

<ParamField body="shot_type" type="string">
  분할 방식: `customize`(사용자 정의) / `intelligence`(지능형).

  `multi_shot=true`일 때 필수입니다.
</ParamField>

<ParamField body="multi_prompt" type="array<object>">
  분할 리스트. 각 항목은 `{ index, prompt, duration }` 입니다.

  * 최소 1개, 최대 6개 분할
  * 각 분할의 `duration`은 정수이며 1 이상이어야 함
  * 모든 분할 `duration` 합계는 상위 `duration`과 같아야 함
  * `index`는 1부터 시작해 연속 증가해야 함
  * `multi_shot=true` 이고 `shot_type=customize`일 때 필수

  예시:

  ```json theme={null}
  [
    { "index": 1, "prompt": "a happy dog in running@element_cat", "duration": 3 },
    { "index": 2, "prompt": "a happy dog play with a cat@element_dog", "duration": 3 }
  ]
  ```
</ParamField>

<ParamField body="element_list" type="array<object>">
  참조 주체 목록. 최대 3개 주체까지 지원합니다. 다음을 지원:

  * `name`, `description`, `element_input_urls` 로 즉시 생성

  일반 형식:

  ```json theme={null}
  [
    {
      "name": "element_dog",
      "description": "a golden retriever, fluffy fur, friendly expression",
      "element_input_urls": [
        "https://example.com/image1.png",
        "https://example.com/image2.png"
      ]
    },
    {
      "name": "element_cat",
      "description": "an orange tabby cat, round face, bright eyes",
      "element_input_urls": [
        "https://example.com/image1.png",
        "https://example.com/image2.png"
      ]
    }
  ]
  ```

  설명:

  * 즉시 생성 시 `name`, `description`, `element_input_urls` 필수
  * `element_input_urls`: 주체당 2\~4장(1장은 정면, 나머지는 참조)
  * `prompt`에서 `@name`으로 참조 (예: `"@element_dog 와 @element_cat 이 잔디에서 쫓고 놉니다"`)
</ParamField>

<ParamField body="watermark" type="boolean">
  워터마크 추가 여부
</ParamField>

<ParamField body="audio" type="boolean" default="false">
  오디오가 포함된 비디오를 생성할지 여부

  <Warning>
    이 매개변수는 `video_list`와 서로 배타적입니다.

    `video_list`에 값이 있는 경우 `audio` 매개변수는 필요하지 않습니다.
  </Warning>
</ParamField>

### 매개변수 상호 제약 및 경계

* `image_urls` 와 `image_with_roles` 는 둘 중 하나만 사용
* `mode=4k` 는 `kling-v3-omni` 에서 사용 가능
* 끝 프레임만 단독 입력(첫 프레임 없음)은 유효하지 않음
* 첫/끝 프레임과 비디오 편집은 상호 배타적: `video_list.refer_type=base`(또는 미지정)일 때 첫/끝 프레임 사용 불가
* `video_list` 가 있으면 `audio` 는 무시됩니다
* `video_list` 는 최대 1개
* `multi_prompt` 는 최대 6개 분할, `index` 는 1부터 연속 증가

## 이미지 참조 구문

Omni 모델은 `<<<image_N>>>` 구문을 사용하여 프롬프트에서 이미지를 참조하며, 통합된 텍스트-비디오/이미지-비디오 경험을 제공합니다:

| 구문              | 설명                          |
| --------------- | --------------------------- |
| `<<<image_1>>>` | `image_urls` 배열의 1번째 이미지 참조 |
| `<<<image_2>>>` | `image_urls` 배열의 2번째 이미지 참조 |

<Note>
  **자동 참조**: `image_urls`가 제공되었지만 프롬프트에 `<<<image_N>>>` 참조가 없는 경우, 시스템이 자동으로 프롬프트 앞에 `<<<image_1>>>`을 추가합니다.
</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: 텍스트-비디오 (표준 모드)

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "a golden retriever running on the beach, sunset, cinematic",
  "mode": "std",
  "duration": 5,
  "aspect_ratio": "16:9"
}
```

### 시나리오 2: 이미지 참조 (단일 이미지)

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "<<<image_1>>>의 인물이 카메라를 향해 손을 흔든다",
  "image_urls": ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
  "mode": "pro",
  "duration": 5
}
```

### 시나리오 3: 다중 이미지 참조

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "<<<image_1>>>의 캐릭터가 <<<image_2>>>의 장면을 향해 걸어간다",
  "image_urls": [
    "https://example.com/character.jpg",
    "https://example.com/scene.jpg"
  ],
  "mode": "pro",
  "duration": 5
}
```

### 시나리오 4: 이미지 제공 시 명시적 참조 없음 (자동 추가)

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "인물이 천천히 고개를 돌려 미소 짓는다",
  "image_urls": ["https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
  "mode": "std",
  "duration": 5
}
```

> 시스템이 자동으로 프롬프트 앞에 `<<<image_1>>>`을 추가하여, `"<<<image_1>>>인물이 천천히 고개를 돌려 미소 짓는다"`와 동일하게 됩니다.

### 시나리오 5: 오디오가 포함된 비디오 생성

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "나뭇가지에서 노래하는 노란 카나리아",
  "audio": true,
  "mode": "std",
  "duration": 5
}
```

> **주의**: `audio`와 `video_list`는 서로 배타적입니다. `video_list`에 값이 있는 경우 `audio` 매개변수는 필요하지 않습니다.

<Note>
  **작업 결과 조회**

  비디오 생성은 비동기 작업으로, 제출 시 `task_id`가 반환됩니다. [작업 상태 가져오기](/ko/api-reference/tasks/status) 엔드포인트를 사용하여 생성 진행 상황과 결과를 조회할 수 있습니다.
</Note>
