> ## Documentation Index
> Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wan 3.0 オールインワン動画生成

> Wan 3.0 All-in-One モデルで動画を生成 — テキストから動画、最初/最後フレーム制御、画像・動画・音声などのマルチモーダル参照に対応

<Note>
  **中国本土のユーザー向け：** 中国本土のユーザーは `https://toapis.cn` を API エンドポイント（Base URL）としてご利用ください。本ドキュメント内の例では `https://toapis.com` を `https://toapis.cn` に置き換えてください。
</Note>

Wan 3.0 の公開モデル名は `wan3.0-video` です。1つのモデルで以下の生成方式をサポートします：

* テキストから動画生成
* 最初フレームまたは最初/最後フレーム制御
* 参照画像・参照動画・参照音声の組み合わせ生成
* ファイルまたは公開 Web ページの参照

API は非同期タスクです。送信が成功するとタスク ID が返され、[動画タスクステータス](../../tasks/video-status)エンドポイントで進捗と結果を照会できます。

<Warning>
  **最初/最後フレームモードと参照素材モードは併用できません。**

  リクエストに `first_frame` または `last_frame` が含まれる場合、参照画像・参照動画・参照音声・ファイル・Web リンクを同時に渡すことはできません。参照画像・参照動画・参照音声同士は組み合わせて使用できます。
</Warning>

## 認証

<ParamField header="Authorization" type="string" required>
  Bearer Token 認証を使用します：

  ```text theme={null}
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

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

<ParamField body="model" type="string" default="wan3.0-video" required>
  モデル名。`wan3.0-video` 固定です。
</ParamField>

<ParamField body="prompt" type="string">
  動画の内容、被写体の動作、カメラワーク、音声の説明。`prompt` とメディア素材の少なくとも一方を指定する必要があります。

  マルチモーダル参照を使用する場合、配列の順序に合わせてプロンプトに「画像1」「動画1」「音声1」と記述できます。
</ParamField>

<ParamField body="duration" type="integer" default="5">
  出力時間。`2` 〜 `30` 秒をサポートします。`-1` を指定するとスマート時間モードになり、モデルがプロンプトと素材に応じて出力の長さを自動決定します。
</ParamField>

<ParamField body="ratio" type="string" default="adaptive">
  出力アスペクト比。以下をサポートします：

  * `adaptive`：参照素材に応じて自動調整
  * `16:9`
  * `9:16`
  * `1:1`
  * `4:3`
  * `3:4`

  互換フィールド `aspect_ratio` も使用できます。両方を同時に渡す必要はありません。
</ParamField>

<ParamField body="resolution" type="string" default="1080p">
  出力解像度。`480p`、`720p`、`1080p` をサポートします。
</ParamField>

<ParamField body="audio" type="boolean" default={true}>
  音声を生成するかどうか。デフォルトで有効です。
</ParamField>

<ParamField body="watermark" type="boolean" default={false}>
  ウォーターマークを追加するかどうか。デフォルトで無効です。
</ParamField>

<ParamField body="seed" type="integer">
  オプションの乱数シード。同じパラメータとシードで類似した結果を再現しやすくなります。
</ParamField>

<ParamField body="image_with_roles" type="object[]">
  最初/最後フレーム制御の配列。各項目には以下が含まれます：

  * `url`：公開アクセス可能な画像 URL
  * `role`：`first_frame` または `last_frame`

  最初フレームと最後フレームはそれぞれ最大1つまで指定できます。`last_frame` を使用する場合は `first_frame` も必ず指定してください。
</ParamField>

<ParamField body="reference_images" type="string[]">
  参照画像 URL の配列。最大 `10` 枚。`image_with_roles` の最初/最後フレームと併用できません。
</ParamField>

<ParamField body="video_list" type="object[]">
  参照動画の配列。最大 `5` 本、合計 `15` 秒以内。各項目は以下の構造を使用します：

  ```json theme={null}
  {
    "video_url": "https://example.com/reference.mp4"
  }
  ```
</ParamField>

<ParamField body="audio_with_roles" type="object[]">
  参照音声の配列。最大 `5` 本、合計 `15` 秒以内。各項目には以下が含まれます：

  * `url`：公開アクセス可能な音声 URL
  * `role`：`reference_audio` 固定
</ParamField>

<ParamField body="metadata" type="object">
  ファイルまたは Web ページの参照は `metadata.media` で渡します。

  <Expandable title="metadata.media 構造を展開">
    `media` はオブジェクトの配列で、各項目に `type` と `url` が含まれます：

    * ファイル：`{ "type": "file", "url": "https://example.com/brief.pdf" }`
    * Web ページ：`{ "type": "link", "url": "https://example.com/article" }`

    1回のリクエストで指定できるのはファイル1つまたは Web ページ1つのみで、併用はできません。ファイルと Web ページは最初/最後フレームモードとも併用できません。
  </Expandable>
</ParamField>

<Note>
  ローカルの画像や動画は、事前にアップロードして公開 URL を取得してください。生成リクエストにローカルファイルパスや base64 データを直接渡さないでください。
</Note>

## 素材の組み合わせルール

| リクエスト内容 | 対応 | 説明 |
| - | -: | - |
| プロンプトのみ | ○ | テキストから動画 |
| 最初フレームのみ | ○ | 最初フレーム制御 |
| 最初フレームと最後フレーム | ○ | 最後フレームは単独で使用不可 |
| 参照画像と参照動画 | ○ | 組み合わせ参照可能 |
| 参照画像・動画・音声 | ○ | 組み合わせ参照可能 |
| 最初フレームと参照動画 | × | 最初/最後フレームモードと参照素材モードは併用不可 |
| 最初/最後フレームと参照画像 | × | 最初/最後フレームモードと参照素材モードは併用不可 |
| ファイルと Web リンク | × | 両者は併用不可 |

以下のエラーが返された場合：

```text theme={null}
Wan 3.0 cannot mix first/last frames with reference assets/files/web pages in the same request.
```

最初/最後フレームを削除して参照素材を残すか、すべての参照素材を削除して最初/最後フレームのみを残してください。

## リクエスト例

### テキストから動画

```bash theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan3.0-video",
    "prompt": "雨上がりの東京の街を走る茶トラ猫、映画的なカメラワーク",
    "duration": 5,
    "ratio": "16:9",
    "resolution": "1080p",
    "audio": true,
    "watermark": false
  }'
```

### 最初/最後フレームから動画生成

```bash theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan3.0-video",
    "prompt": "カメラが自然に寄り、人物が立った状態から微笑んで手を振る姿へ変化する",
    "duration": 8,
    "ratio": "adaptive",
    "resolution": "1080p",
    "image_with_roles": [
      {
        "url": "https://example.com/first-frame.png",
        "role": "first_frame"
      },
      {
        "url": "https://example.com/last-frame.png",
        "role": "last_frame"
      }
    ]
  }'
```

### 参照動画から動画生成

このリクエストでは `first_frame` や `last_frame` を同時に渡さないでください。

```bash theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan3.0-video",
    "prompt": "動画1のカメラワークと人物の動きを参考に、新しいストリートダンス動画を生成",
    "duration": 10,
    "ratio": "adaptive",
    "resolution": "720p",
    "audio": true,
    "video_list": [
      {
        "video_url": "https://example.com/reference-video.mp4"
      }
    ]
  }'
```

### 画像・動画・音声の組み合わせ参照

```bash theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan3.0-video",
    "prompt": "画像1のキャラクター、動画1の動き、音声1のリズムを使って動画を生成",
    "duration": 10,
    "ratio": "16:9",
    "resolution": "720p",
    "audio": true,
    "reference_images": [
      "https://example.com/character.png"
    ],
    "video_list": [
      {
        "video_url": "https://example.com/motion.mp4"
      }
    ],
    "audio_with_roles": [
      {
        "url": "https://example.com/music.mp3",
        "role": "reference_audio"
      }
    ]
  }'
```

### ファイル参照

```bash theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan3.0-video",
    "prompt": "ファイルの内容に基づいて簡潔な製品紹介動画を生成",
    "duration": 10,
    "ratio": "16:9",
    "resolution": "1080p",
    "metadata": {
      "media": [
        {
          "type": "file",
          "url": "https://example.com/product-brief.pdf"
        }
      ]
    }
  }'
```

## レスポンス

<ResponseField name="id" type="string">
  動画タスク ID。タスクステータスの照会に使用します。
</ResponseField>

<ResponseField name="object" type="string">
  オブジェクトタイプ。通常は `generation.task` です。
</ResponseField>

<ResponseField name="model" type="string">
  このリクエストで使用されたモデル名。
</ResponseField>

<ResponseField name="status" type="string">
  タスクステータス：`queued`、`in_progress`、`completed`、または `failed`。
</ResponseField>

<ResponseField name="progress" type="integer">
  タスクの進捗。`0` 〜 `100` の範囲。
</ResponseField>

<ResponseField name="created_at" type="integer">
  タスク作成タイムスタンプ。
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "tsk_vid_xxx",
    "object": "generation.task",
    "model": "wan3.0-video",
    "status": "in_progress",
    "progress": 10,
    "created_at": 1781577600
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.