> ## 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 Video O1 Videogenerierung

>  - Reasoning-erweitertes Modell für Videogenerierung in höchster Qualität
- Asynchroner Verarbeitungsmodus, gibt eine Task-ID für nachfolgende Abfragen zurück
- Einheitliche Text-to-Video- / Image-to-Video-Schnittstelle mit Bildreferenz-Syntax
- Unterstützt Standardmodus (720P) und Profimodus (1080P)
- Bilder im Prompt mit `<<<image_N>>>`-Syntax referenzieren 

<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-video-o1",
      "prompt": "Make the person in <<<image_1>>> wave at the camera",
      "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-video-o1",
      "prompt": "Make the person in <<<image_1>>> wave at the camera",
      "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-video-o1",
    prompt: "Make the person in <<<image_1>>> wave at the camera",
    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-video-o1",
          "prompt":       "Make the person in <<<image_1>>> wave at the camera",
          "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-video-o1",
            "prompt": "Make the person in <<<image_1>>> wave at the camera",
            "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-video-o1",
      "prompt" => "Make the person in <<<image_1>>> wave at the camera",
      "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-video-o1",
    prompt: "Make the person in <<<image_1>>> wave at the camera",
    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-video-o1",
      "prompt": "Make the person in <<<image_1>>> wave at the camera",
      "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-video-o1"",
              ""prompt"": ""Make the person in <<<image_1>>> wave at the camera"",
              ""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": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Invalid authentication credentials",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient balance. Please top up your account",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Rate limit exceeded. Please try again later",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error. Please try again later",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## Autorisierung

<ParamField header="Authorization" type="string" required>
  Alle API-Endpunkte erfordern eine Authentifizierung per Bearer Token

  API-Schlüssel abrufen:

  Besuchen Sie die [Seite zur API-Schlüsselverwaltung](https://apimart.ai/keys), um Ihren API-Schlüssel zu erhalten

  Fügen Sie ihn dem Anfrage-Header hinzu:

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

## Anfrageparameter

<ParamField body="model" type="string" required>
  Name des Videogenerierungsmodells

  Unterstützte Modelle:

  * `kling-video-o1` — Kling Video O1 (Reasoning-erweitert, höchste Qualität)
</ParamField>

<ParamField body="prompt" type="string" required>
  Positiver Textprompt

  Unterstützt das Referenzieren von Bildern aus `image_urls` mit der Syntax `<<<image_N>>>`, wobei `N` bei 1 beginnt.

  Beispiel: `"Make the person in <<<image_1>>> wave at the camera"`

  <Note>
    Wenn Bilder bereitgestellt werden, der Prompt aber keine `<<<image_N>>>`-Referenz enthält, fügt das System automatisch `<<<image_1>>>` an den Anfang des Prompts an.
  </Note>
</ParamField>

<ParamField body="mode" type="string" default="std">
  Generierungsmodus

  Optionen:

  * `std` — Standardmodus (720P)
  * `pro` — Profimodus (1080P)

  Standard: `std`
</ParamField>

<ParamField body="duration" type="integer" default="5">
  Videodauer (Sekunden)

  Optionen: `5` oder `10`

  Standard: `5`
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  Seitenverhältnis des Videos

  Optionen:

  * `16:9` — Querformat
  * `9:16` — Hochformat
  * `1:1` — Quadrat

  Standard: `16:9`
</ParamField>

<ParamField body="image_urls" type="array<url>">
  Array mit Bild-URLs für Bildreferenzen

  Referenzieren Sie die entsprechenden Bilder im Prompt mit der Syntax `<<<image_N>>>` (N beginnt bei 1)

  Beispiel: `["https://example.png"]`

  <Warning>
    * Bild-URLs müssen öffentlich zugänglich sein, ohne Hotlink-Schutz
    * Im Image-to-Video-Modus kann `aspect_ratio` durch das tatsächliche Seitenverhältnis des Bildes überschrieben werden
    * Bis zu zwei Bilder. Das erste Element im Array ist das Startbild, das zweite das Endbild
  </Warning>
</ParamField>

<ParamField body="image_with_roles" type="array<object>">
  Rollenbasiertes Bild-Array, empfohlen für Image-to-Video.

  Format jedes Elements: `{ "url": "...", "role": "..." }`

  * `first_frame`: erstes Bild
  * `last_frame`: letztes Bild
  * `reference`: Referenzbild

  <Warning>
    - `image_urls` und `image_with_roles` schließen sich gegenseitig aus, übergeben Sie nicht beide gleichzeitig.
    - Bei mehr als 2 Bildern wird das Festlegen von Start- und Endbild nicht unterstützt.
  </Warning>
</ParamField>

<ParamField body="video_list" type="array" optional>
  Liste der Referenzvideos (URL-basiert), bis zu 1 Video.

  Verwenden Sie `refer_type`, um Typen zu unterscheiden:

  * `base`: zu bearbeitendes Video (Standard)
  * `feature`: Feature-Referenzvideo

  Verwenden Sie `keep_original_sound`, um zu steuern, ob der Originalton beibehalten wird:

  * `no`: nicht behalten (Standard)
  * `yes`: Originalton behalten

  Anfrageformat:

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

  <Warning>
    * `video_url` darf nicht leer sein, und die Video-URL muss zugänglich sein
    * Bei `refer_type=base`:
      * Erste/letzte Bilder können nicht definiert werden
      * Das Referenzvideo muss 3–10 Sekunden lang sein
      * Die Dauer des erzeugten Videos richtet sich nach dem hochgeladenen Video
    * Bei `refer_type=feature` und nicht leerer `video_url`:
      * `image_urls` darf nur ein Bild für das erste Bild enthalten
    * Video-Anforderungen: Nur MP4/MOV; mindestens 3 Sekunden Dauer; Auflösung 720–2160 px; Bildrate 24–60 fps (Ausgabe ist 24 fps); maximal 200 MB Größe
  </Warning>
</ParamField>

## Bildreferenz-Syntax

Das Video-O1-Modell verwendet die Syntax `<<<image_N>>>`, um Bilder in Prompts zu referenzieren, und bietet so ein einheitliches Text-to-Video- / Image-to-Video-Erlebnis:

| Syntax          | Beschreibung                                   |
| --------------- | ---------------------------------------------- |
| `<<<image_1>>>` | Verweist auf das 1. Bild im Array `image_urls` |
| `<<<image_2>>>` | Verweist auf das 2. Bild im Array `image_urls` |

<Note>
  **Automatische Referenz**: Wenn `image_urls` bereitgestellt wird, der Prompt aber keine `<<<image_N>>>`-Referenz enthält, fügt das System automatisch `<<<image_1>>>` an den Anfang des Prompts an.
</Note>

## Antwort

<ResponseField name="code" type="integer">
  Statuscode der Antwort, 200 bei Erfolg
</ResponseField>

<ResponseField name="data" type="array">
  Datenarray der Antwort

  <Expandable title="Array-Elemente">
    <ResponseField name="status" type="string">
      Task-Status, `submitted` bei der ersten Einreichung
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Eindeutige Task-ID zur Abfrage von Status und Ergebnis
    </ResponseField>
  </Expandable>
</ResponseField>

## Anwendungsfälle

### Fall 1: Text-zu-Video (höchste Qualität)

```json theme={null}
{
  "model": "kling-video-o1",
  "prompt": "A cinematic shot of a city skyline at golden hour",
  "mode": "pro",
  "duration": 5,
  "aspect_ratio": "16:9"
}
```

### Fall 2: Bildreferenz (einzelnes Bild)

```json theme={null}
{
  "model": "kling-video-o1",
  "prompt": "Make the person in <<<image_1>>> wave at the camera",
  "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
}
```

### Fall 3: Mehrere Bildreferenzen

```json theme={null}
{
  "model": "kling-video-o1",
  "prompt": "The character in <<<image_1>>> walks toward the scene in <<<image_2>>>",
  "image_urls": [
    "https://example.com/character.jpg",
    "https://example.com/scene.jpg"
  ],
  "mode": "pro",
  "duration": 5
}
```

### Fall 4: Bild ohne explizite Referenz bereitgestellt (automatisch hinzugefügt)

```json theme={null}
{
  "model": "kling-video-o1",
  "prompt": "The person slowly turns and smiles",
  "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
}
```

> Das System fügt `<<<image_1>>>` automatisch am Anfang des Prompts hinzu, was `"<<<image_1>>>The person slowly turns and smiles"` entspricht.

<Note>
  **Aufgabenergebnisse abfragen**

  Die Videogenerierung ist eine asynchrone Aufgabe, die bei der Einreichung eine `task_id` zurückgibt. Verwenden Sie den Endpunkt [Aufgabenstatus abrufen](/de/api-reference/tasks/status), um Fortschritt und Ergebnis abzufragen.
</Note>
