> ## 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-Hailuo-2.3 動画生成

>  - 非同期処理モード、タスクIDを返してその後の照会に使用
- テキストから動画、画像から動画（先頭フレーム画像）をサポート
- 6秒と10秒の長さ、768p/1080p解像度をサポート
- 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": "MiniMax-Hailuo-2.3",
      "prompt": "かわいい子猫が草原を走っている",
      "duration": 6,
      "resolution": "768p",
      "prompt_optimizer": true,
      "fast_pretreatment": false,
      "watermark": false
    }'
  ```

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

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

  payload = {
      "model": "MiniMax-Hailuo-2.3",
      "prompt": "かわいい子猫が草原を走っている",
      "duration": 6,
      "resolution": "768p",
      "prompt_optimizer": True,
      "fast_pretreatment": False,
      "watermark": False
  }

  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-Hailuo-2.3",
    prompt: "かわいい子猫が草原を走っている",
    duration: 6,
    resolution: "768p",
    prompt_optimizer: true,
    fast_pretreatment: false,
    watermark: false
  };

  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-Hailuo-2.3",
          "prompt":             "かわいい子猫が草原を走っている",
          "duration":           6,
          "resolution":         "768p",
          "prompt_optimizer":   true,
          "fast_pretreatment":  false,
          "watermark":          false,
      }

      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-Hailuo-2.3",
            "prompt": "かわいい子猫が草原を走っている",
            "duration": 6,
            "resolution": "768p",
            "prompt_optimizer": true,
            "fast_pretreatment": false,
            "watermark": false
          }
          """;

          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-Hailuo-2.3",
      "prompt" => "かわいい子猫が草原を走っている",
      "duration" => 6,
      "resolution" => "768p",
      "prompt_optimizer" => true,
      "fast_pretreatment" => false,
      "watermark" => false
  ];

  $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-Hailuo-2.3",
    prompt: "かわいい子猫が草原を走っている",
    duration: 6,
    resolution: "768p",
    prompt_optimizer: true,
    fast_pretreatment: false,
    watermark: false
  }

  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-Hailuo-2.3",
      "prompt": "かわいい子猫が草原を走っている",
      "duration": 6,
      "resolution": "768p",
      "prompt_optimizer": true,
      "fast_pretreatment": false,
      "watermark": false
  ]

  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-Hailuo-2.3"",
              ""prompt"": ""かわいい子猫が草原を走っている"",
              ""duration"": 6,
              ""resolution"": ""768p"",
              ""prompt_optimizer"": true,
              ""fast_pretreatment"": false,
              ""watermark"": false
          }";

          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 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>
  対応モデル：

  * `MiniMax-Hailuo-2.3` - Hailuo 2.3 モデル
  * `MiniMax-Hailuo-2.3-Fast` - Hailuo 2.3 Fast モデル（より高速）

  <Warning>
    **MiniMax-Hailuo-2.3-Fast**：<br />
    このモデルでは、`first_frame_image` の指定が必須です。
  </Warning>
</ParamField>

<ParamField body="prompt" type="string" required>
  動画コンテンツの説明（最大2000文字）

  シーン、アクション、スタイルなどを詳しく記述すると、より良い生成結果が得られます。カメラワーク指令をサポートしています（下記のカメラワーク指令を参照）。

  例：`"かわいい子猫が草原を走っている"`
</ParamField>

<ParamField body="duration" type="integer" default="6">
  動画の長さ（秒）

  オプション：

  * `6` - 6秒動画
  * `10` - 10秒動画

  デフォルト：`6`

  <Warning>
    **1080p 制限**：1080p解像度使用時は、6秒の長さのみサポート
  </Warning>
</ParamField>

<ParamField body="resolution" type="string" default="768p">
  動画の解像度

  オプション：

  * `768p` - 高解像度
  * `1080p` - フルHD（6秒の長さのみサポート）

  デフォルト：`768p`
</ParamField>

<ParamField body="first_frame_image" type="string">
  動画の先頭フレーム画像

  2つの形式をサポート：

  * **公開URL**：`https://example.com/start.jpg`
  * **Base64エンコード**：`data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABg...`

  指定すると、この画像が動画の開始フレームとして使用されます

  <Warning>
    **MiniMax-Hailuo-2.3-Fast**：<br />
    このモデルでは、`first_frame_image` の指定が必須です。
  </Warning>
</ParamField>

<ParamField body="prompt_optimizer" type="boolean" default="true">
  プロンプトを自動最適化するかどうか

  有効にすると、システムがプロンプトを自動的に最適化し、より良い生成結果を得られます

  デフォルト：`true`
</ParamField>

<ParamField body="fast_pretreatment" type="boolean" default="false">
  プロンプト最適化時間を短縮するかどうか

  有効にすると処理速度が速くなりますが、最適化品質がわずかに影響を受ける場合があります

  デフォルト：`false`
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  ウォーターマークを追加するかどうか

  デフォルト：`false`
</ParamField>

## 解像度と長さの組み合わせ

| 解像度   | サポートされる長さ | 備考            |
| ----- | --------- | ------------- |
| 768p  | 6秒、10秒    | すべてサポート       |
| 1080p | 6秒        | 10秒はサポートされません |

## カメラワーク指令

`prompt` 内で `[指令]` 構文を使用してカメラワークを制御できます。15種類の指令をサポート：

| カテゴリ    | 指令                                 |
| ------- | ---------------------------------- |
| パン      | `[左移]`（左パン）`[右移]`（右パン）             |
| 水平回転    | `[左摇]`（左回転）`[右摇]`（右回転）             |
| プッシュ/プル | `[推进]`（プッシュイン）`[拉远]`（プルアウト）        |
| 垂直移動    | `[上升]`（上昇）`[下降]`（下降）               |
| 垂直回転    | `[上摇]`（チルトアップ）`[下摇]`（チルトダウン）       |
| ズーム     | `[变焦推近]`（ズームイン）`[变焦拉远]`（ズームアウト）    |
| その他     | `[晃动]`（シェイク）`[跟随]`（フォロー）`[固定]`（固定） |

**使用例**：

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "[推进]猫が庭を走り、カメラがゆっくりとクローズアップに寄る"
}
```

## レスポンス

<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": "MiniMax-Hailuo-2.3",
  "prompt": "かわいい子猫が草原を走っている、晴れた日"
}
```

### シーン 2：高品質 1080p 動画

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "都市の夜景、ネオンが点滅、車の流れ",
  "duration": 6,
  "resolution": "1080p",
  "prompt_optimizer": true,
  "watermark": false
}
```

### シーン 3：先頭フレーム画像から動画生成

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "子猫がカメラに向かって走ってくる、微笑んでウインク",
  "first_frame_image": "https://example.com/cat.jpg",
  "duration": 6,
  "resolution": "1080p"
}
```

### シーン 4：カメラワーク指令の使用

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "[推进]猫が庭を走り、カメラがゆっくりとクローズアップに寄る",
  "duration": 6,
  "resolution": "768p"
}
```

### シーン 5：高速前処理モード

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "波がビーチに打ちつける、夕暮れ時",
  "duration": 10,
  "resolution": "768p",
  "prompt_optimizer": true,
  "fast_pretreatment": true
}
```

<Note>
  **タスク結果の照会**

  動画生成は非同期タスクです。送信後に `task_id` が返されます。[タスクステータスの取得](/ja/api-reference/tasks/status) エンドポイントで生成の進捗と結果を照会できます。
</Note>
