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

# Pixverse v6 動画生成

>  - Pixverse v6 統合動画生成モデル
- テキストから動画、画像から動画、始終フレームトランジション、複数参照画像融合、動画延長に対応
- 360p/540p/720p/1080p の解像度、1～15 秒の動画長に対応
- 非同期タスク API。送信後はタスク ID で結果を取得します 

<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": "pixverse-v6",
      "prompt": "A cinematic shot of a corgi running through a sunflower field at golden hour",
      "size": "16:9",
      "resolution": "540p",
      "duration": 5
    }'
  ```

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

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

  payload = {
      "model": "pixverse-v6",
      "prompt": "A cinematic shot of a corgi running through a sunflower field at golden hour",
      "size": "16:9",
      "resolution": "540p",
      "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: "pixverse-v6",
    prompt: "A cinematic shot of a corgi running through a sunflower field at golden hour",
    size: "16:9",
    resolution: "540p",
    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));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01JWXXXXXXXXXXXX"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "type": "invalid_request_error",
      "message": "invalid duration 20, allowed range: 1-15 seconds"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "認証に失敗しました。API キーを確認してください",
      "type": "authentication_error"
    }
  }
  ```

  ```json 403 theme={null}
  {
    "error": {
      "code": 403,
      "message": "insufficient quota: balance=0, required=0.25",
      "type": "quota_not_enough"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "リクエストが多すぎます。しばらくしてから再試行してください",
      "type": "rate_limit_error"
    }
  }
  ```
</ResponseExample>

## 認証

<ParamField header="Authorization" type="string" required>
  すべてのエンドポイントは Bearer Token による認証が必要です。

  API Key の取得：

  [API Key 管理ページ](https://apimart.ai/keys) にアクセスして API Key を取得してください。

  リクエストヘッダーに以下を追加します：

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

## リクエストパラメータ

<ParamField body="model" type="string" required>
  動画生成モデル名。`pixverse-v6` で固定です。
</ParamField>

<ParamField body="prompt" type="string" required>
  動画コンテンツの説明。最大 5000 文字。すべてのモードで必須です。
</ParamField>

<ParamField body="resolution" type="string" default="540p">
  動画解像度。課金に直接影響します。

  * `360p`：SD
  * `540p`：標準（デフォルト）
  * `720p`：HD
  * `1080p`：フル HD

  <Warning>
    指定外の解像度はパラメータエラーになります。
  </Warning>
</ParamField>

<ParamField body="duration" type="integer" default="5">
  動画の長さ（秒）。範囲は `1-15`。

  <Warning>
    始終フレームトランジションモードでは `5` または `8` 秒のみ対応します。
  </Warning>
</ParamField>

<ParamField body="size" type="string" default="16:9">
  動画のアスペクト比。テキストから動画および複数参照画像融合モードでのみ有効です。

  * `16:9`：横長ワイド（デフォルト）
  * `4:3`：横長 4:3
  * `1:1`：正方形
  * `3:4`：縦長 3:4
  * `9:16`：縦型
  * `2:3`：縦長 2:3
  * `3:2`：横長 3:2
  * `21:9`：シネマワイド
</ParamField>

<ParamField body="seed" type="integer" default="0">
  ランダムシード。範囲は `0-2147483647`。同一の prompt と seed で類似結果を再現できます。
</ParamField>

<ParamField body="negative_prompt" type="string">
  ネガティブプロンプト。生成したくない内容を除外します。最大 2048 文字。
</ParamField>

<ParamField body="audio" type="boolean" default="false">
  オーディオトラックを生成するかどうか。

  * `true`：オーディオを生成（課金単価が上がります）
  * `false`：オーディオなし（デフォルト）
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  動画の右下にウォーターマークを追加するかどうか。

  * `true`：ウォーターマークを追加
  * `false`：ウォーターマークなし（デフォルト）
</ParamField>

<ParamField body="motion_mode" type="string">
  モーションモード。

  * `normal`：標準モード（`pixverse-v6` はこの値のみ対応）

  <Warning>
    `fast` は旧モデル専用です。`pixverse-v6` で指定すると上流に拒否されます。
  </Warning>
</ParamField>

<ParamField body="generate_multi_clip_switch" type="boolean" default="false">
  複数クリップ連続動画を生成するかどうか。テキストから動画および画像から動画モードのみ対応します。

  * `true`：複数クリップ連続動画を生成
  * `false`：単一クリップ（デフォルト）
</ParamField>

<ParamField body="image_urls" type="array<url>">
  画像から動画モードの入力画像 URL 配列。先頭の 1 枚のみ使用されます。

  画像は公開アクセス可能な HTTP/HTTPS URL である必要があります。
</ParamField>

<ParamField body="first_frame_image" type="url">
  始終フレームトランジションモードの開始フレーム画像 URL。`last_frame_image` と必ずペアで指定します。
</ParamField>

<ParamField body="last_frame_image" type="url">
  始終フレームトランジションモードの終了フレーム画像 URL。`first_frame_image` と必ずペアで指定します。
</ParamField>

<ParamField body="img_references" type="array<url>">
  複数参照画像融合モードの参照画像 URL 配列。1～7 枚に対応します。

  このフィールドを指定すると複数参照画像融合モードがトリガーされます。
</ParamField>

<ParamField body="extend_from_task_id" type="string">
  動画延長の元タスク ID。このフィールドを指定すると動画延長モードがトリガーされます。

  元タスクは現在のユーザーのものであり、モデルが `pixverse-v6`、ステータスが `completed` である必要があります。
</ParamField>

## 生成モード

アダプタはリクエストフィールドに応じて自動的に対応する生成モードへ振り分けます。優先順位順にマッチし、最初に条件を満たしたものが採用されます。

| モード           | トリガー条件                                          | 説明                       |
| ------------- | ----------------------------------------------- | ------------------------ |
| テキストから動画      | 画像/延長フィールド未指定                                   | `prompt` から動画を生成         |
| 画像から動画        | `image_urls` を 1 枚指定                            | 先頭の画像を入力画像として使用          |
| 始終フレームトランジション | `first_frame_image` と `last_frame_image` の両方を指定 | 2 フレーム間の滑らかなトランジションを生成   |
| 複数参照画像融合      | `img_references` 配列を指定                          | 1～7 枚の参照画像を融合して動画を生成     |
| 動画延長          | `extend_from_task_id` を指定                       | 完了済み Pixverse タスクから続けて生成 |

<Warning>
  すべての画像入力は公開アクセス可能な HTTP/HTTPS URL のみ対応します。base64 や Data URI には対応していません。ローカル画像のみの場合は、先にオブジェクトストレージへアップロードして URL を渡してください。
</Warning>

## パラメータルール

| 制約       | 説明                                                                            |
| -------- | ----------------------------------------------------------------------------- |
| 動画長      | `1 ≤ duration ≤ 15` 秒。トランジションモードは `5` または `8` 秒のみ                             |
| 解像度      | `360p`、`540p`、`720p`、`1080p` のみ対応                                             |
| アスペクト比   | `size` はテキストから動画および複数参照画像融合モードでのみ有効                                           |
| プロンプト長   | `prompt` は最大 5000 文字、`negative_prompt` は最大 2048 文字                            |
| 画像から動画   | `image_urls` は先頭の 1 枚のみ使用                                                     |
| トランジション  | `first_frame_image` と `last_frame_image` をペアで指定                               |
| モーションモード | `pixverse-v6` は `normal` のみ対応                                                 |
| 複数参照画像融合 | `img_references` は 1～7 枚に対応                                                   |
| 動画延長     | `extend_from_task_id` は現在のユーザー所有の `completed` 状態の `pixverse-v6` タスクである必要があります |

## レスポンス

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

## タスク結果の取得

動画生成は非同期タスクです。送信後に `task_id` が返されます。[タスクステータス取得](/ja/api-reference/tasks/status) エンドポイントで進捗と結果を確認してください。

```bash cURL theme={null}
curl --request GET \
  --url https://api.apimart.ai/v1/tasks/task_01JWXXXXXXXXXXXX \
  --header 'Authorization: Bearer <token>'
```

ステータスが `completed` または `failed` になるまで、5 秒間隔のポーリングを推奨します。

### 成功結果の例

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KSPX48B8V1M6C2ZN0D0T4BKB",
    "status": "completed",
    "progress": 100,
    "cost": 0.2,
    "credits_cost": 2,
    "created": 1779958948,
    "completed": 1779958999,
    "estimated_time": 100,
    "actual_time": 51,
    "result": {
      "videos": [
        {
          "url": ["https://upload.apimart.ai/f/video/xxxx.mp4"],
          "expires_at": 1780045399
        }
      ]
    }
  }
}
```

動画 URL のパスは `data.result.videos[0].url[0]` です。`url` フィールド自体も配列です。動画リンクは通常 24 時間で期限切れとなるため、早めにダウンロードまたは転送してください。

### 失敗結果の例

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KSPX48B8V1M6C2ZN0D0T4BKB",
    "status": "failed",
    "progress": 100,
    "cost": 0,
    "credits_cost": 0,
    "created": 1779958948,
    "completed": 1779958960,
    "error": {
      "code": "task_failed",
      "message": "pixverse error 400063: moderation failed",
      "type": "task_failed"
    }
  }
}
```

失敗時は通常 `cost` は `0` です。エラー理由は `data.error.message` から読み取ってください。

## 使用シナリオ

### シナリオ 1：テキストから動画

```json theme={null}
{
  "model": "pixverse-v6",
  "prompt": "A neon-lit alley in Tokyo at night, light rain, anamorphic lens flare",
  "size": "21:9",
  "resolution": "720p",
  "duration": 8,
  "seed": 42,
  "audio": true
}
```

### シナリオ 2：画像から動画

```json theme={null}
{
  "model": "pixverse-v6",
  "prompt": "Camera slowly zooms in, gentle wind moves the leaves",
  "image_urls": ["https://example.com/first-frame.jpg"],
  "resolution": "540p",
  "duration": 5
}
```

### シナリオ 3：始終フレームトランジション

```json theme={null}
{
  "model": "pixverse-v6",
  "prompt": "transform smoothly from a puppy to a cat",
  "first_frame_image": "https://example.com/puppy.jpg",
  "last_frame_image": "https://example.com/cat.jpg",
  "resolution": "540p",
  "duration": 5,
  "motion_mode": "normal"
}
```

### シナリオ 4：複数参照画像融合

```json theme={null}
{
  "model": "pixverse-v6",
  "prompt": "A girl wearing the outfit from image 2, holding the cat from image 3",
  "img_references": [
    "https://example.com/character.jpg",
    "https://example.com/outfit.jpg",
    "https://example.com/cat.jpg"
  ],
  "size": "9:16",
  "resolution": "720p",
  "duration": 5
}
```

### シナリオ 5：動画延長

```json theme={null}
{
  "model": "pixverse-v6",
  "prompt": "the character now walks into a forest",
  "extend_from_task_id": "task_01JWXXXXXXXXXXXX",
  "resolution": "540p",
  "duration": 5
}
```
