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

>  - 비동기 처리 모드, 후속 조회를 위한 작업 ID 반환
- 텍스트-비디오, 이미지-비디오(첫 프레임 / 끝 프레임 / 첫+끝 프레임), 멀티모달 참조-비디오(참조 이미지 + 참조 비디오 + 참조 오디오) 지원
- 2K 네이티브 출력, 길이 4 ~ 15초, 오디오 트랙 포함
- MiniMax-Hailuo-02 / MiniMax-Hailuo-2.3 과 동일한 제출 및 조회 API 공유 

<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": "잘못된 요청 매개변수입니다",
      "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 422 theme={null}
  {
    "error": {
      "code": 422,
      "message": "콘텐츠 안전 심사를 통과하지 못했습니다",
      "type": "invalid_request_error"
    }
  }
  ```

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

## 생성 모드

MiniMax-H3 는 요청 필드에 따라 해당 모드로 자동 라우팅합니다. **`mode` 필드는 필요하지 않습니다**:

| 모드                | 트리거 조건                                                                                             | 기능                       |
| ----------------- | -------------------------------------------------------------------------------------------------- | ------------------------ |
| **텍스트-비디오 (T2V)** | `prompt` 및 공통 필드만 전달                                                                               | 순수 텍스트 기반 생성             |
| **이미지-비디오 (I2V)** | `first_frame_image` / `last_frame_image` (또는 `image_with_roles` 의 `first_frame` / `last_frame`) 전달 | 첫 프레임, 끝 프레임, 첫+끝 프레임 제어 |
| **멀티모달 참조 (R2V)** | `image_urls` / `video_urls` / `audio_urls`, 또는 `image_with_roles` 의 `reference_image` 전달           | 참조 이미지 + 참조 비디오 + 참조 오디오 |

<Warning>
  **엄격한 상호 배타**: 이미지-비디오 필드(`first_frame_image` / `last_frame_image`, 및 `image_with_roles` 의 `first_frame` / `last_frame`)와 멀티모달 참조 필드(`image_urls`, `video_urls`, `audio_urls`, 및 `image_with_roles` 의 `reference_image`)는 동시에 사용할 수 없습니다. 혼용 시 **400** 이 반환됩니다.
</Warning>

<Warning>
  **오디오만 단독 사용은 불가합니다.** `audio_urls` 를 전달할 경우 참조 이미지 또는 참조 비디오를 최소 하나 함께 제공해야 합니다.
</Warning>

## 요청 매개변수

### 공통 필드

<ParamField body="model" type="string" required>
  고정값: `MiniMax-H3`

  <Warning>
    **`model` 필드는 필수이며 명시적으로 전달해야 합니다.** 이미 Hailuo 시리즈를 연동한 클라이언트는 `model` 을 `MiniMax-H3` 로 변경하기만 하면 본 모델을 사용할 수 있습니다.
  </Warning>
</ParamField>

<ParamField body="prompt" type="string" required>
  비디오 콘텐츠 설명. **모든 시나리오에서 필수이며 비어 있을 수 없습니다.** 요청당 최대 **7000** 자.

  장면, 주체, 동작, 스타일 등을 자세히 설명하면 더 나은 생성 결과를 얻을 수 있습니다.

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

<ParamField body="duration" type="integer" default="5">
  출력 길이(초)

  * 범위: `4` \~ `15` 정수
  * 기본값: `5`
</ParamField>

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

  * 지원 값: `2K` 만 가능(기본값)
</ParamField>

<ParamField body="aspect_ratio" type="string">
  화면비. `size` 또는 `ratio` 로도 동일하게 전달할 수 있습니다.

  허용 비율: `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`

  시나리오별 동작은 아래 "화면비 규칙"을 참조하세요.
</ParamField>

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

  기본값: `false`

  호환 별칭: `aigc_watermark`
</ParamField>

<ParamField body="webhook" type="string">
  작업이 최종 상태(성공 / 실패)에 도달했을 때 본 서비스가 이 주소로 푸시합니다

  <Note>
    `webhook` 을 사용하세요. 공식 `callback_url` 은 전달하지 마세요. `callback_url` 은 본 서비스 내부용이며 사용자 입력을 받지 않습니다.
  </Note>
</ParamField>

### 이미지-비디오 필드

**첫 / 끝 프레임** 이미지-비디오를 수행하려면 역할을 명시적으로 지정하세요. `image_urls` 개수로 추론하지 마세요.

<ParamField body="first_frame_image" type="string">
  첫 프레임 이미지 URL

  전달 시 해당 이미지가 비디오의 **시작 프레임**으로 사용됩니다.
</ParamField>

<ParamField body="last_frame_image" type="string">
  끝 프레임 이미지 URL

  전달 시 해당 이미지가 비디오의 **종료 프레임**으로 사용됩니다. `first_frame_image` 와 조합하여 첫+끝 프레임 제어가 가능합니다.
</ParamField>

### 멀티모달 참조 필드

<ParamField body="image_urls" type="string[]">
  참조 이미지 URL 배열

  <Warning>
    **`image_urls` 의 이미지는 개수와 관계없이 모두 참조 이미지(`reference_image`)로 처리됩니다.** 개수에 따라 첫 / 첫+끝 프레임으로 자동 매핑되지 않습니다.
  </Warning>

  * 수량: ≤ **9**
</ParamField>

<ParamField body="video_urls" type="string[]">
  참조 비디오 URL 배열

  * 수량: ≤ **3**
  * 형식 및 제한: 아래 "입력 미디어 제한" 참조
</ParamField>

<ParamField body="audio_urls" type="string[]">
  참조 오디오 URL 배열

  * 수량: ≤ **3**
  * 단독 사용 불가. 참조 이미지 또는 참조 비디오와 함께 사용해야 합니다
</ParamField>

### 공통 이미지 배열(선택 형식)

<ParamField body="image_with_roles" type="object[]">
  역할이 지정된 이미지 배열. `first_frame_image` / `last_frame_image` / `image_urls` 를 대체할 수 있습니다. 각 요소 구조:

  <Expandable title="image_with_roles 요소">
    <ResponseField name="url" type="string" required>
      이미지 URL
    </ResponseField>

    <ResponseField name="role" type="string" required>
      이미지 역할. 허용 값:

      * `first_frame` (`first` 도 허용) — 첫 프레임 (I2V)
      * `last_frame` (`last` 도 허용) — 끝 프레임 (I2V)
      * `reference_image` (`reference` 도 허용) — 참조 이미지 (R2V)
    </ResponseField>
  </Expandable>

  예시(첫 + 끝 프레임):

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

  예시(참조 이미지):

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

## 화면비 규칙

| 시나리오                       | `aspect_ratio` 동작                             |
| -------------------------- | --------------------------------------------- |
| **텍스트-비디오** (prompt 만)     | 구체적 비율 필요. 생략 또는 `adaptive` 시 **`16:9` 로 폴백** |
| **이미지-비디오** (첫 / 끝 프레임 있음) | 입력 이미지에 의해 결정. 전달 값은 무시됨(항상 `adaptive`)       |
| **멀티모달 참조**                | 선택 사항. 기본값 `adaptive`. 구체적 비율을 명시할 수도 있음      |

허용되는 구체적 비율: `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`.

## 입력 미디어 제한

요청 본문 총 크기 ≤ **64 MB**. 큰 파일은 공개 URL 을 사용하고, **Base64 는 사용하지 마세요**.

### 이미지

| 항목         | 제한                                    |
| ---------- | ------------------------------------- |
| 형식         | JPG / JPEG / PNG / WEBP / HEIC / HEIF |
| 파일당        | ≤ 30 MB                               |
| 너비 / 높이    | 256 \~ 5760 px                        |
| 화면비(너비/높이) | 0.4 \~ 2.5                            |
| 수량         | 첫 프레임 ≤ 1, 끝 프레임 ≤ 1, 참조 이미지 ≤ 9      |

### 비디오(멀티모달 참조 전용)

| 항목            | 제한                                         |
| ------------- | ------------------------------------------ |
| 형식            | MP4(`.mp4`), MOV(`.mov`)                   |
| 코덱            | 비디오 H.264/AVC, H.265/HEVC; 오디오 AAC, MP3    |
| 파일당           | ≤ 50 MB                                    |
| 수량            | ≤ 3                                        |
| 길이            | 클립당 2 \~ 15 s; **총 길이 ≤ 15 s**             |
| 크기 / 비율 / FPS | 256 \~ 5760 px / 0.4 \~ 2.5 / 23.976 \~ 60 |

### 오디오(멀티모달 참조 전용)

| 항목  | 제한                         |
| --- | -------------------------- |
| 형식  | WAV, MP3                   |
| 파일당 | ≤ 15 MB                    |
| 수량  | ≤ 3                        |
| 길이  | 클립당 2 \~ 15 s; 총 길이 ≤ 15 s |

## 매개변수 제약

다음 제약을 위반하면 요청이 거부되고 **400** 이 반환됩니다(민감 콘텐츠는 **422** 가능). **과금되지 않습니다**:

| 매개변수             | 제약                                                         |
| ---------------- | ---------------------------------------------------------- |
| `prompt`         | 모든 시나리오에서 필수이며 비어 있지 않아야 함, ≤ 7000 자                       |
| `duration`       | `4` \~ `15` 정수만 허용                                         |
| `resolution`     | `2K` 만 허용                                                  |
| `aspect_ratio`   | "화면비 규칙" 참조; T2V 에서 생략 시 `16:9` 로 폴백                       |
| 첫/끝 프레임 vs 참조 자산 | **상호 배타**, 혼용 불가                                           |
| `audio_urls`     | 단독 사용 불가. 참조 이미지 또는 참조 비디오와 함께 사용 필수                       |
| 참조 이미지           | ≤ 9                                                        |
| 참조 비디오           | ≤ 3                                                        |
| 참조 오디오           | ≤ 3                                                        |
| 참조 비디오 프로브 실패    | `input_video_probe_failed` 반환(URL 접근 불가 또는 파일 손상), **미과금** |

## 응답

<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">
      작업 고유 ID. 상태 및 결과 조회에 사용
    </ResponseField>
  </Expandable>
</ResponseField>

## 요청 예시

### 케이스 1: 텍스트-비디오

```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"
}
```

### 케이스 2: 이미지-비디오 — 첫 프레임

```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"
}
```

### 케이스 3: 이미지-비디오 — 첫 + 끝 프레임

```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
}
```

### 케이스 4: 멀티모달 참조-비디오

```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"
}
```

### 케이스 5: 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>
  **작업 결과 조회**

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

  권장 폴링 간격: **5 \~ 10초**마다. 클라이언트 타임아웃: **15분**. 성공 시 `result.videos[0].url` 이 mp4 URL 입니다. 비디오 URL 은 약 **24시간** 후 만료되므로 즉시 저장하세요. 실패한 작업은 자동으로 환불됩니다.
</Note>
