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

# wan2.6-i2v-flash 画像から動画

>  - 万相 2.6 高速版画像から動画モデル
- 最初のフレーム画像とテキストプロンプトからスムーズな動画を生成
- 音声/無音切替、マルチショットナレーション、カスタム音声をサポート
- 720p/1080p 解像度、2-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": "wan2.6-i2v-flash",
      "prompt": "人物が振り向いて微笑む",
      "image_urls": ["https://example.com/portrait.jpg"],
      "resolution": "1080p",
      "duration": 5
    }'
  ```

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

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

  payload = {
      "model": "wan2.6-i2v-flash",
      "prompt": "人物が振り向いて微笑む",
      "image_urls": ["https://example.com/portrait.jpg"],
      "resolution": "1080p",
      "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: "wan2.6-i2v-flash",
    prompt: "人物が振り向いて微笑む",
    image_urls: ["https://example.com/portrait.jpg"],
    resolution: "1080p",
    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));
  ```

  ```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":      "wan2.6-i2v-flash",
          "prompt":     "人物が振り向いて微笑む",
          "image_urls": []string{"https://example.com/portrait.jpg"},
          "resolution": "1080p",
          "duration":   5,
      }

      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": "wan2.6-i2v-flash",
            "prompt": "人物が振り向いて微笑む",
            "image_urls": ["https://example.com/portrait.jpg"],
            "resolution": "1080p",
            "duration": 5
          }
          """;

          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" => "wan2.6-i2v-flash",
      "prompt" => "人物が振り向いて微笑む",
      "image_urls" => ["https://example.com/portrait.jpg"],
      "resolution" => "1080p",
      "duration" => 5
  ];

  $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: "wan2.6-i2v-flash",
    prompt: "人物が振り向いて微笑む",
    image_urls: ["https://example.com/portrait.jpg"],
    resolution: "1080p",
    duration: 5
  }

  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": "wan2.6-i2v-flash",
      "prompt": "人物が振り向いて微笑む",
      "image_urls": ["https://example.com/portrait.jpg"],
      "resolution": "1080p",
      "duration": 5
  ]

  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"": ""wan2.6-i2v-flash"",
              ""prompt"": ""人物が振り向いて微笑む"",
              ""image_urls"": [""https://example.com/portrait.jpg""],
              ""resolution"": ""1080p"",
              ""duration"": 5
          }";

          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>
  すべてのエンドポイントで Bearer Token 認証が必要です

  API Key の取得：

  [API Key 管理ページ](https://apimart.ai/keys) で API Key を取得してください

  リクエストヘッダーに追加：

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

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

<ParamField body="model" type="string" required>
  動画生成モデル名、`wan2.6-i2v-flash` 固定
</ParamField>

<ParamField body="image_urls" type="array<string>" required>
  参照画像 URL 配列（最初のフレーム画像 1 枚のみサポート）

  公開アクセス可能な画像 URL または Base64 エンコード（`data:image/png;base64,...`）をサポート

  例：`["https://example.com/image.jpg"]`

  <Note>
    画像の要件：

    * 形式：JPEG、JPG、PNG（透明チャンネル不可）、BMP、WEBP
    * 解像度：幅/高さ 240-8000 ピクセル
    * サイズ：≤ 10MB
  </Note>
</ParamField>

<ParamField body="prompt" type="string">
  動画の内容説明

  画像から動画では任意ですが推奨、期待する動作や効果を記述

  主体、動作、カメラ、スタイルを明確に指定してください

  例：`"画像の人物が微笑んで手を振り、カメラがゆっくりズームイン"`
</ParamField>

<ParamField body="negative_prompt" type="string">
  ネガティブプロンプト、表示したくない内容を記述

  最大 500 文字

  例：`"ぼやけ, 低品質, 変形"`
</ParamField>

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

  オプション：

  * `720p` - HD
  * `1080p` - FHD（デフォルト）

  デフォルト：`1080p`

  <Note>
    解像度は料金に直接影響します。1080p は 720p より高価です。アスペクト比は入力画像により決定されます。
  </Note>
</ParamField>

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

  サポート範囲：`2` \~ `15` 秒（整数）

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

<ParamField body="audio" type="boolean" default="true">
  音声付き動画を生成するかどうか

  `true`：マッチするBGM/効果音を自動生成（デフォルト）

  `false`：無音動画を出力

  デフォルト：`true`

  <Note>
    モデルが `wan2.6-i2v` の場合、このパラメータはサポートされません。
  </Note>
</ParamField>

<ParamField body="audio_url" type="string">
  カスタム音声 URL（wav/mp3、3-30 秒、≤ 15MB）

  `audio` より優先度が低い：`audio=false` の場合は無視されます

  音声が動画より長い場合は自動トリミング、短い場合は残りが無音になります

  <Warning>
    音声ファイルの要件：

    * 形式：wav、mp3
    * 長さ：3-30 秒
    * サイズ：≤ 15MB
  </Warning>
</ParamField>

<ParamField body="prompt_extend" type="boolean" default="true">
  プロンプトのスマート書き換えを有効にするかどうか

  短いプロンプトの効果を大幅に向上させますが、処理時間が増加します

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

<ParamField body="shot_type" type="string">
  ショットタイプ、`prompt_extend=true` と併用が必要

  オプション：

  * `single` - シングルショット（デフォルト）、連続した 1 ショットの動画を出力
  * `multi` - マルチショット、複数ショットの切り替えで構成されたナラティブ動画を出力

  <Note>
    `shot_type` は `prompt` より優先度が高い。プロンプトに「マルチショット」と書いても、`single` に設定するとシングルショットが出力されます。
  </Note>
</ParamField>

<ParamField body="seed" type="integer">
  ランダムシード（≥0）、同じシードを指定すると類似の結果を再現できます

  例：`12345`
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  「AI生成」ウォーターマークを追加するかどうか（右下）

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

## 音声制御説明

| パラメータの組み合わせ                         | 結果                    |
| ----------------------------------- | --------------------- |
| `audio` と `audio_url` を渡さない         | 自動音声生成（デフォルト）         |
| `audio_url: "https://..."`          | 指定した音声を使用             |
| `audio: false`                      | 無音動画                  |
| `audio: false` + `audio_url: "..."` | 無音動画（`audio` の優先度が高い） |

## レスポンス

<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": "wan2.6-i2v-flash",
  "image_urls": ["https://example.com/image.jpg"]
}
```

### シーン 2：全パラメータ

```json theme={null}
{
  "model": "wan2.6-i2v-flash",
  "prompt": "画像の人物が微笑んで手を振り、カメラがゆっくりズームイン",
  "image_urls": ["https://example.com/image.jpg"],
  "negative_prompt": "ぼやけ, 低品質, 変形",
  "resolution": "1080p",
  "duration": 10,
  "seed": 12345,
  "prompt_extend": true,
  "shot_type": "multi",
  "audio": true,
  "watermark": false
}
```

### シーン 3：カスタム音声

```json theme={null}
{
  "model": "wan2.6-i2v-flash",
  "prompt": "人物が音楽に合わせて踊る",
  "image_urls": ["https://example.com/dancer.jpg"],
  "audio_url": "https://example.com/music.mp3",
  "resolution": "1080p",
  "duration": 10
}
```

### シーン 4：無音動画

```json theme={null}
{
  "model": "wan2.6-i2v-flash",
  "prompt": "花がゆっくり咲く",
  "image_urls": ["https://example.com/flower.jpg"],
  "audio": false,
  "resolution": "720p",
  "duration": 5
}
```

### シーン 5：エフェクトテンプレート

```json theme={null}
{
  "model": "wan2.6-i2v-flash",
  "image_urls": ["https://example.com/person.jpg"],
  "template": "flying",
  "resolution": "720p"
}
```

### シーン 6：Base64 画像

```json theme={null}
{
  "model": "wan2.6-i2v-flash",
  "prompt": "猫を立ち上がって歩かせる",
  "image_urls": ["data:image/png;base64,iVBORw0KGgo..."],
  "duration": 5
}
```

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

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