> ## 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 3.0 Turbo 비디오 생성

>  - 비동기 처리 모드, 이후 조회에 사용할 작업 ID를 반환
- 텍스트-투-비디오, 이미지-투-비디오(첫 프레임 제어) 지원
- 720P / 1080P 두 가지 해상도 지원
- 3-15초 비디오 길이 지원
- 멀티 샷 분할 화면 지원(고정 형식 프롬프트로 표현) 

<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-3.0-turbo",
      "prompt": "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
      "aspect_ratio": "16:9",
      "resolution": "1080p",
      "duration": 5
    }'
  ```

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

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

  payload = {
      "model": "kling-3.0-turbo",
      "prompt": "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
      "aspect_ratio": "16:9",
      "resolution": "1080p",
      "duration": 5
  }

  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-3.0-turbo",
    prompt: "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
    aspect_ratio: "16:9",
    resolution: "1080p",
    duration: 5
  };

  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-3.0-turbo",
          "prompt":       "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
          "aspect_ratio": "16:9",
          "resolution":   "1080p",
          "duration":     5,
      }

      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-3.0-turbo",
            "prompt": "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
            "aspect_ratio": "16:9",
            "resolution": "1080p",
            "duration": 5
          }
          """;

          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-3.0-turbo",
      "prompt" => "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
      "aspect_ratio" => "16:9",
      "resolution" => "1080p",
      "duration" => 5
  ];

  $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-3.0-turbo",
    prompt: "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
    aspect_ratio: "16:9",
    resolution: "1080p",
    duration: 5
  }

  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-3.0-turbo",
      "prompt": "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
      "aspect_ratio": "16:9",
      "resolution": "1080p",
      "duration": 5
  ]

  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-3.0-turbo"",
              ""prompt"": ""코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛"",
              ""aspect_ratio"": ""16:9"",
              ""resolution"": ""1080p"",
              ""duration"": 5
          }";

          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 Key 발급:

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

  사용 시 요청 헤더에 다음을 추가합니다:

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

## 요청 파라미터

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

  지원되는 모델:

  * `kling-3.0-turbo` - Kling 3.0 Turbo
</ParamField>

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

  업스트림 제한은 3072자 이하이며, 2500자 이하를 권장합니다.

  예시: `"코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛"`
</ParamField>

<ParamField body="first_frame_image" type="string">
  **이미지 URL** 또는 **Base64**를 지원합니다.

  <Warning>
    첫 프레임 이미지 업스트림 제한:

    * 형식: `.jpg` / `.jpeg` / `.png`
    * 크기: ≤ 50MB
    * 너비/높이: ≥ 300px
    * 종횡비: `1:2.5` \~ `2.5:1`
  </Warning>
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  비디오 종횡비

  선택 가능한 값:

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

  기본값: `16:9`

  <Note>
    **텍스트-투-비디오에서만 적용됩니다**. 이미지-투-비디오 시 이 필드는 무효이며, 비디오 비율은 첫 프레임 이미지로 결정됩니다.
  </Note>
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  비디오 해상도

  선택 가능한 값:

  * `720p`
  * `1080p`

  기본값: `720p`
</ParamField>

<ParamField body="duration" type="integer" default="5">
  비디오 길이(초)

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

  기본값: `5`

  **⚠️ 주의:** 반드시 순수 숫자를 입력해야 하며(예: `6`), 따옴표를 붙이지 마세요. 그렇지 않으면 오류가 발생합니다
</ParamField>

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

  명시적으로 전달했을 때만 업스트림으로 전송되며, 전달하지 않으면 워터마크를 추가하지 않습니다.
</ParamField>

## 텍스트-투-비디오 vs 이미지-투-비디오

시스템은 `first_frame_image` 제공 여부에 따라 생성 모드를 **자동으로 판단**합니다. 첫 프레임 이미지가 있으면 이미지-투-비디오, 없으면 텍스트-투-비디오로 처리되며, 사용자가 명시적으로 선언할 필요가 없습니다.

| 파라미터                | 텍스트-투-비디오  | 이미지-투-비디오                   |
| ------------------- | ---------- | --------------------------- |
| `prompt`            | ✅ 필수       | ✅ 선택(비워 두면 첫 프레임 이미지만으로 생성) |
| `first_frame_image` | ❌ 전달 안 함   | ✅ 필수                        |
| `aspect_ratio`      | ✅ 선택       | ❌ 무효(비율은 첫 프레임 이미지로 결정)     |
| `resolution`        | ✅ 선택       | ✅ 선택                        |
| `duration`          | ✅ 선택(3-15) | ✅ 선택(3-15)                  |
| `watermark`         | ✅ 선택       | ✅ 선택                        |

## 응답

<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: 텍스트-투-비디오(1080P)

```json theme={null}
{
  "model": "kling-3.0-turbo",
  "prompt": "코기 한 마리가 해변을 달린다, 영화 같은 느낌, 황혼의 빛",
  "aspect_ratio": "16:9",
  "resolution": "1080p",
  "duration": 5
}
```

### 시나리오 2: 텍스트-투-비디오(세로 화면 720P)

```json theme={null}
{
  "model": "kling-3.0-turbo",
  "prompt": "도쿄 시부야 교차로, 비 내리는 밤 네온사인이 젖은 바닥에 비치고, 행인들이 우산을 쓰고 지나간다",
  "aspect_ratio": "9:16",
  "resolution": "720p",
  "duration": 10
}
```

### 시나리오 3: 이미지-투-비디오(첫 프레임 이미지)

```json theme={null}
{
  "model": "kling-3.0-turbo",
  "prompt": "카메라가 천천히 다가가고, 인물이 미소 짓는다",
  "first_frame_image": "https://cdn.example.com/first.jpg",
  "resolution": "720p",
  "duration": 5
}
```

### 시나리오 4: 첫 프레임 이미지만으로 비디오 생성(프롬프트 없이)

```json theme={null}
{
  "model": "kling-3.0-turbo",
  "first_frame_image": "https://cdn.example.com/first.jpg",
  "resolution": "1080p",
  "duration": 5
}
```

### 시나리오 5: 멀티 샷 분할 화면(텍스트-투-비디오)

```json theme={null}
{
  "model": "kling-3.0-turbo",
  "prompt": "샷 1,2,해변에서 코기가 달린다；샷 2,3,카메라가 인물에게 다가가 미소 짓는다；",
  "aspect_ratio": "16:9",
  "resolution": "1080p",
  "duration": 5
}
```

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

  비디오 생성은 비동기 작업으로, 제출 후 `task_id`를 반환합니다. [작업 상태 조회](/ko/api-reference/tasks/status) API를 사용하여 생성 진행 상황과 결과를 조회하세요.
</Note>
