> ## 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.

# MiniMax-H3 Videogenerierung

>  - Asynchroner Verarbeitungsmodus, gibt eine Task-ID für spätere Abfragen zurück
- Unterstützt Text-to-Video, Image-to-Video (erstes / letztes / erstes+letztes Einzelbild) und multimodale Referenz-zu-Video (Referenzbilder + Videos + Audio)
- Native 2K-Ausgabe, Dauer 4 ~ 15 Sekunden, mit Audiospur
- Nutzt dieselben Submit- und Abfrage-APIs wie MiniMax-Hailuo-02 / MiniMax-Hailuo-2.3 

<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": "MiniMax-H3",
      "prompt": "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
      "duration": 5,
      "resolution": "2K",
      "aspect_ratio": "16:9"
    }'
  ```

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

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

  payload = {
      "model": "MiniMax-H3",
      "prompt": "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
      "duration": 5,
      "resolution": "2K",
      "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: "MiniMax-H3",
    prompt: "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
    duration: 5,
    resolution: "2K",
    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":        "MiniMax-H3",
          "prompt":       "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
          "duration":     5,
          "resolution":   "2K",
          "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": "MiniMax-H3",
            "prompt": "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
            "duration": 5,
            "resolution": "2K",
            "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" => "MiniMax-H3",
      "prompt" => "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
      "duration" => 5,
      "resolution" => "2K",
      "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: "MiniMax-H3",
    prompt: "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
    duration: 5,
    resolution: "2K",
    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": "MiniMax-H3",
      "prompt": "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
      "duration": 5,
      "resolution": "2K",
      "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"": ""MiniMax-H3"",
              ""prompt"": ""A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work"",
              ""duration"": 5,
              ""resolution"": ""2K"",
              ""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_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed, please check your API key",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient account balance, please top up and try again",
      "type": "payment_required"
    }
  }
  ```

  ```json 422 theme={null}
  {
    "error": {
      "code": 422,
      "message": "Content safety review failed",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests, please try again later",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error, please retry later",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## Autorisierung

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

  API-Key abrufen:

  Besuchen Sie die [Seite zur API-Key-Verwaltung](https://apimart.ai/keys), um Ihren API-Key zu erhalten

  Fügen Sie ihn zum Request-Header hinzu:

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

## Generierungsmodi

MiniMax-H3 wählt den passenden Modus automatisch anhand der Anfragefelder. **Kein `mode`-Feld erforderlich**:

| Modus                          | Auslöser                                                                                           | Funktion                                                                   |
| ------------------------------ | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| **Text-to-Video (T2V)**        | Nur `prompt` und allgemeine Felder                                                                 | Rein textgesteuerte Generierung                                            |
| **Image-to-Video (I2V)**       | `first_frame_image` / `last_frame_image` (oder `first_frame` / `last_frame` in `image_with_roles`) | Steuerung erstes Einzelbild, letztes Einzelbild, erstes+letztes Einzelbild |
| **Multimodal Reference (R2V)** | `image_urls` / `video_urls` / `audio_urls` oder `reference_image` in `image_with_roles`            | Referenzbilder + Videos + Audio                                            |

<Warning>
  **Strikte gegenseitige Ausschließlichkeit**: Image-to-Video-Felder (`first_frame_image` / `last_frame_image` sowie `first_frame` / `last_frame` in `image_with_roles`) können nicht mit multimodalen Referenzfeldern (`image_urls`, `video_urls`, `audio_urls` und `reference_image` in `image_with_roles`) kombiniert werden. Eine Mischung gibt **400** zurück.
</Warning>

<Warning>
  **Audio allein ist nicht erlaubt.** Wenn Sie `audio_urls` übergeben, müssen Sie auch mindestens ein Referenzbild oder Referenzvideo angeben.
</Warning>

## Anfrageparameter

### Allgemeine Felder

<ParamField body="model" type="string" required>
  Fester Wert: `MiniMax-H3`

  <Warning>
    **`model` ist erforderlich und muss explizit gesendet werden.** Clients, die bereits mit Hailuo integriert sind, können umschalten, indem sie `model` auf `MiniMax-H3` setzen.
  </Warning>
</ParamField>

<ParamField body="prompt" type="string" required>
  Beschreibung des Videoinhalts. **In jedem Szenario erforderlich und nicht leer**, maximal **7000** Zeichen pro Anfrage.

  Beschreiben Sie Szene, Subjekt, Bewegung und Stil detailliert für bessere Ergebnisse.

  Beispiel: `"A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work"`
</ParamField>

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

  * Bereich: Ganzzahl von `4` bis `15`
  * Standard: `5`
</ParamField>

<ParamField body="resolution" type="string" default="2K">
  Videoauflösung

  * Unterstützter Wert: nur `2K` (Standard)
</ParamField>

<ParamField body="aspect_ratio" type="string">
  Seitenverhältnis. Sie können auch `size` oder `ratio` mit derselben Wirkung übergeben.

  Zulässige Verhältnisse: `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`

  Das Verhalten je Szenario ist unten unter „Regeln zum Seitenverhältnis“ beschrieben.
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  Ob ein AIGC-Wasserzeichen hinzugefügt werden soll

  Standard: `false`

  Kompatibler Alias: `aigc_watermark`
</ParamField>

<ParamField body="webhook" type="string">
  URL, die eine Benachrichtigung erhält, wenn die Aufgabe einen Endzustand erreicht (Erfolg / Fehler)

  <Note>
    Verwenden Sie `webhook`. Übergeben Sie nicht die offizielle `callback_url`. `callback_url` ist für den internen Gebrauch reserviert und wird von Benutzern nicht akzeptiert.
  </Note>
</ParamField>

### Image-to-Video-Felder

Für Image-to-Video mit **erstem / letztem Einzelbild** Rollen explizit angeben. Nicht aus der Anzahl von `image_urls` ableiten.

<ParamField body="first_frame_image" type="string">
  URL des ersten Einzelbildes

  Wenn angegeben, wird dieses Bild als **Anfangsbild** des Videos verwendet.
</ParamField>

<ParamField body="last_frame_image" type="string">
  URL des letzten Einzelbildes

  Wenn angegeben, wird dieses Bild als **Endbild** verwendet. Mit `first_frame_image` für die Steuerung von Erst- und Endbild kombinieren.
</ParamField>

### Multimodale Referenzfelder

<ParamField body="image_urls" type="string[]">
  Array von Referenzbild-URLs

  <Warning>
    **Jedes Bild in `image_urls` wird als Referenzbild (`reference_image`) behandelt**, unabhängig von der Anzahl. Sie werden nie automatisch anhand der Array-Länge dem ersten / ersten+letzten Einzelbild zugeordnet.
  </Warning>

  * Anzahl: ≤ **9**
</ParamField>

<ParamField body="video_urls" type="string[]">
  Array von Referenzvideo-URLs

  * Anzahl: ≤ **3**
  * Format und Grenzen: siehe „Eingabe-Medienlimits“ unten
</ParamField>

<ParamField body="audio_urls" type="string[]">
  Array von Referenzaudio-URLs

  * Anzahl: ≤ **3**
  * Kann nicht allein verwendet werden; muss mit einem Referenzbild oder Referenzvideo kombiniert werden
</ParamField>

### Gemeinsames Bild-Array (optionale Form)

<ParamField body="image_with_roles" type="object[]">
  Rollenmarkiertes Bild-Array. Kann `first_frame_image` / `last_frame_image` / `image_urls` ersetzen. Jedes Element:

  <Expandable title="image_with_roles-Element">
    <ResponseField name="url" type="string" required>
      Bild-URL
    </ResponseField>

    <ResponseField name="role" type="string" required>
      Bildrolle. Zulässige Werte:

      * `first_frame` (akzeptiert auch `first`) — erstes Einzelbild (I2V)
      * `last_frame` (akzeptiert auch `last`) — letztes Einzelbild (I2V)
      * `reference_image` (akzeptiert auch `reference`) — Referenzbild (R2V)
    </ResponseField>
  </Expandable>

  Beispiel (erstes + letztes Einzelbild):

  ```json theme={null}
  {
    "image_with_roles": [
      {"url": "https://example.com/start.png", "role": "first_frame"},
      {"url": "https://example.com/end.png", "role": "last_frame"}
    ]
  }
  ```

  Beispiel (Referenzbild):

  ```json theme={null}
  {
    "image_with_roles": [
      {"url": "https://example.com/char.png", "role": "reference_image"}
    ]
  }
  ```
</ParamField>

## Regeln zum Seitenverhältnis

| Szenario                                         | Verhalten von `aspect_ratio`                                                              |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| **Text-to-Video** (nur Prompt)                   | Muss ein konkretes Verhältnis sein; weglassen oder `adaptive` **fällt auf `16:9` zurück** |
| **Image-to-Video** (erstes / letztes Einzelbild) | Wird durch das Eingabebild bestimmt; jeder Wert wird ignoriert (immer `adaptive`)         |
| **Multimodale Referenz**                         | Optional, Standard `adaptive`; kann auch ein explizites Verhältnis setzen                 |

Zulässige konkrete Verhältnisse: `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`.

## Eingabe-Medienlimits

Gesamtgröße des Request-Bodys ≤ **64 MB**. Für große Dateien öffentliche URLs verwenden; **kein Base64 verwenden**.

### Bilder

| Element                | Limit                                                             |
| ---------------------- | ----------------------------------------------------------------- |
| Format                 | JPG / JPEG / PNG / WEBP / HEIC / HEIF                             |
| Pro Datei              | ≤ 30 MB                                                           |
| Breite / Höhe          | 256 \~ 5760 px                                                    |
| Seitenverhältnis (w/h) | 0.4 \~ 2.5                                                        |
| Anzahl                 | Erstes Einzelbild ≤ 1, letztes Einzelbild ≤ 1, Referenzbilder ≤ 9 |

### Video (nur multimodale Referenz)

| Element                  | Limit                                       |
| ------------------------ | ------------------------------------------- |
| Format                   | MP4 (`.mp4`), MOV (`.mov`)                  |
| Codec                    | Video H.264/AVC, H.265/HEVC; Audio AAC, MP3 |
| Pro Datei                | ≤ 50 MB                                     |
| Anzahl                   | ≤ 3                                         |
| Dauer                    | Pro Clip 2 \~ 15 s; **Gesamtdauer ≤ 15 s**  |
| Größe / Verhältnis / FPS | 256 \~ 5760 px / 0.4 \~ 2.5 / 23.976 \~ 60  |

### Audio (nur multimodale Referenz)

| Element   | Limit                                  |
| --------- | -------------------------------------- |
| Format    | WAV, MP3                               |
| Pro Datei | ≤ 15 MB                                |
| Anzahl    | ≤ 3                                    |
| Dauer     | Pro Clip 2 \~ 15 s; Gesamtdauer ≤ 15 s |

## Parameter-Einschränkungen

Verstöße werden mit **400** abgelehnt (sensibler Inhalt kann **422** zurückgeben) und **werden nicht abgerechnet**:

| Parameter                                        | Einschränkung                                                                                             |
| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
| `prompt`                                         | In jedem Szenario erforderlich und nicht leer, ≤ 7000 Zeichen                                             |
| `duration`                                       | Nur Ganzzahl von `4` bis `15`                                                                             |
| `resolution`                                     | Nur `2K`                                                                                                  |
| `aspect_ratio`                                   | Siehe „Regeln zum Seitenverhältnis“; T2V fällt bei Weglassen auf `16:9` zurück                            |
| Erstes/letztes Einzelbild vs. Referenzressourcen | **Gegenseitig ausschließend**, können nicht gemischt werden                                               |
| `audio_urls`                                     | Kann nicht allein verwendet werden; muss mit Referenzbild oder -video kombiniert werden                   |
| Referenzbilder                                   | ≤ 9                                                                                                       |
| Referenzvideos                                   | ≤ 3                                                                                                       |
| Referenzaudio                                    | ≤ 3                                                                                                       |
| Probe-Fehler bei Referenzvideo                   | Gibt `input_video_probe_failed` zurück (URL nicht erreichbar oder Datei beschädigt), **keine Abrechnung** |

## 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">
      Aufgabenstatus; `submitted` bei der Erstübermittlung
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Eindeutige Aufgabenkennung zur Abfrage von Status und Ergebnissen
    </ResponseField>
  </Expandable>
</ResponseField>

## Anfragebeispiele

### Fall 1: Text-zu-Video

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "A boy playing basketball by the sea at dusk, waves crashing, cinematic camera work",
  "duration": 6,
  "resolution": "2K",
  "aspect_ratio": "16:9"
}
```

### Fall 2: Bild-zu-Video — Erstes Einzelbild

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "Pull focus to the people in the background and add more steam to the ramen bowl.",
  "first_frame_image": "https://cdn.example.com/ramen.png",
  "duration": 5,
  "resolution": "2K"
}
```

### Fall 3: Bild-zu-Video — Erstes + letztes Einzelbild

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "Camera slowly transitions from morning light to sunset",
  "first_frame_image": "https://cdn.example.com/morning.png",
  "last_frame_image": "https://cdn.example.com/sunset.png",
  "duration": 8
}
```

### Fall 4: Multimodale Referenz-zu-Video

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "Character speaks: Follow the wind, live free. Leave worries behind, enjoy the moment. Voice references audio 1",
  "image_with_roles": [
    {"url": "https://cdn.example.com/char.png", "role": "reference_image"}
  ],
  "video_urls": ["https://cdn.example.com/ref_motion.mp4"],
  "audio_urls": ["https://cdn.example.com/ref_voice.mp3"],
  "duration": 5,
  "resolution": "2K"
}
```

### Fall 5: Erstes + letztes Einzelbild über image\_with\_roles

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "Camera slowly transitions from morning light to sunset",
  "image_with_roles": [
    {"url": "https://cdn.example.com/morning.png", "role": "first_frame"},
    {"url": "https://cdn.example.com/sunset.png", "role": "last_frame"}
  ],
  "duration": 8
}
```

<Note>
  **Aufgabenergebnisse abfragen**

  Die Videogenerierung ist eine asynchrone Aufgabe, die nach der Übermittlung eine `task_id` zurückgibt. Verwenden Sie den Endpunkt [Aufgabenstatus abrufen](/de/api-reference/tasks/status), um den Generierungsfortschritt und die Ergebnisse abzufragen.

  Empfohlenes Abfrageintervall: alle **5 \~ 10 Sekunden**. Client-Timeout: **15 Minuten**. Bei Erfolg ist `result.videos[0].url` die mp4-URL. Video-URLs laufen in etwa **24 Stunden** ab — speichern Sie sie zeitnah. Fehlgeschlagene Aufgaben werden automatisch erstattet.
</Note>
