Wan-R2V はマルチモーダル入力(画像、動画、音声)を受け取り、複数のキャラクターを含む動画を生成します。この際、シーン間でキャラクターの外見と声を保持します。
リファレンス: ユーザーガイド
可用性
API 呼び出しが成功するためには、モデル、エンドポイント URL、および API キーがすべて同一リージョンに属している必要があります。リージョンをまたいだ呼び出しは失敗します。
モデルの選択: モデルのリージョンを確認します。
URL の選択: 対応するリージョンのエンドポイント URL を選択します。HTTP URL がサポートされています。
API キーの設定: リージョンを選択し、API キーを取得して、環境変数として API キーを設定します。
本トピックのサンプルコードはシンガポールリージョン向けです。
Alibaba Cloud Model Studio では、中国 (北京) リージョンおよびシンガポールリージョン向けにワークスペース専用ドメインがリリースされました。新しい専用ドメインは、推論リクエストに対して優れたパフォーマンスと高い安定性を提供します。新しいドメインへの移行を推奨します。
中国 (北京):
https://dashscope.aliyuncs.comからhttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.comへシンガポール:
https://dashscope-intl.aliyuncs.comからhttps://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.comへ
{WorkspaceId} はご利用のワークスペース ID です。これは Alibaba Cloud Model Studio コンソールのワークスペース詳細ページで確認できます。既存のドメインは引き続き完全に機能します。
HTTP
この API は新プロトコルを使用し、wan2.7 モデルをサポートしています。
動画生成には通常 1 ~ 5 分かかります。そのため、API は非同期呼び出しを使用します。ワークフローは次の 2 ステップで構成されます。タスクの作成、その後結果のポーリングです。
ステップ 1: タスクを作成し、タスク ID を取得する
シンガポール
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
北京
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
{WorkspaceId} は、実際のワークスペース IDに置き換えてください。
-
タスク作成後、返された
task_idを使用して結果をクエリします。task_idの有効期間は 24 時間です。重複するタスクを作成しないでください。代わりに、ポーリングを使用して結果を取得してください。 -
初心者向けのガイドについては、「Postman または cURL による API 呼び出し」をご参照ください。
リクエストパラメーター | 複数被写体リファレンス (画像 + 動画 + 音声)複数のリファレンスアセット (画像および動画) を渡し、音声を指定して動画を生成できます。 単一画像リファレンス (マルチパネル画像)9 パネルのリファレンス画像を提供して、ストーリー、カメラ構図、キャラクターデザインを制御し、動画を生成できます。 |
ヘッダー | |
Content-Type リクエストのコンテンツタイプです。 | |
Authorization Model Studio API キーを使用してリクエストを認証します。例: Bearer sk-xxxx。 | |
X-DashScope-Async 非同期処理を有効にします。HTTP リクエストは非同期呼び出しのみをサポートします。 重要
このリクエストヘッダーが欠落している場合、「current user api does not support synchronous calls」というエラーが返されます。 | |
リクエスト本文 | |
model モデル名です。モデルとその価格の一覧については、「モデル価格」をご参照ください。 例: wan2.7-r2v、wan2.7-r2v-2026-06-12。 | |
input プロンプトなどの基本的な入力情報です。 | |
parameters 動画の解像度などの動画処理パラメーターです。 | |
レスポンスパラメーター | 成功時のレスポンス
エラー時のレスポンスタスクの作成に失敗しました。「エラーコード」をご参照ください。
|
output タスクの出力情報です。 | |
request_id トレースおよびトラブルシューティング用の一意のリクエスト識別子です。 | |
code エラーコードです。失敗したリクエストでのみ返されます。「エラーコード」をご参照ください。 | |
message 詳細なエラーメッセージです。失敗したリクエストでのみ返されます。「エラーコード」をご参照ください。 |
ステップ 2: タスク ID で結果をクエリする
シンガポール
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
北京
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
{WorkspaceId} は、実際のワークスペース IDに置き換えてください。
-
ポーリングの推奨: 動画生成には数分かかります。15 秒などの適切な間隔でポーリングメカニズムを使用してください。
-
タスク状態の遷移: PENDING → RUNNING → SUCCEEDED または FAILED。
-
結果リンク: タスクが成功すると、24 時間有効な動画 URL が返されます。OSS などの永続ストレージに動画をダウンロードして保存してください。
-
task_idの有効期間: 24 時間。この期間を過ぎると、クエリはタスクステータスとしてUNKNOWNを返します。
リクエストパラメーター | タスク結果のクエリ
|
ヘッダー | |
Authorization Model Studio API キーを使用してリクエストを認証します。例: Bearer sk-xxxx。 | |
パスパラメーター | |
task_id タスクの ID です。 |
レスポンスパラメーター | タスク成功動画 URL の有効期間は 24 時間のみで、その後自動的にパージされます。生成された動画は速やかに保存してください。 タスク失敗タスクが失敗した場合、 タスククエリの有効期限切れ
|
output タスクの出力情報です。 | |
usage 出力統計情報です。成功したタスクでのみ設定されます。 | |
request_id トレースおよびトラブルシューティング用の一意のリクエスト識別子です。 |
DashScope SDK
SDK のパラメーター名は、HTTP API とほぼ一致しています。パラメーター構造は言語の特性に基づいてカプセル化されています。
リファレンス動画タスクの処理時間は通常 1 ~ 5 分です。SDK は HTTP 非同期フローをラップし、同期呼び出しと非同期呼び出しの両方をサポートしています。
実際の処理時間は、キューの長さおよびサービスステータスによって異なります。
Python SDK
DashScope Python SDK 1.25.16 以降が必要です。
古いバージョンでは、「url error, please check url!」などのエラーが発生する可能性があります。更新手順については、「SDK のインストール」をご参照ください。
base_http_api_url はモデルのリージョンに基づいて設定します。
シンガポール
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
北京
dashscope.base_http_api_url = 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1'
{WorkspaceId} は、実際のワークスペース IDに置き換えてください。
同期呼び出し
同期呼び出しは、動画生成が完了するまでブロッキングされ、結果を直接返します。
リクエスト例
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os
# 以下の URL はシンガポールリージョン用です。呼び出し時に {WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください: api_key="sk-xxx"
# API キーはリージョンによって異なります。API キーの取得方法については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_sync_call_r2v():
# 同期呼び出し。結果を直接返します。
print('please wait...')
rsp = VideoSynthesis.call(
api_key=api_key,
model='wan2.7-r2v-2026-06-12',
prompt='Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, "The sunshine is so nice today." Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, "That sounds lovely. Can you sing it again?"',
media=[
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/sjuytr/wan-r2v-object-girl.jpg",
"reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/gbqewz/wan-r2v-girl-voice.mp3"
},
{
"type": "reference_video",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4",
"reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/isllrq/wan-r2v-boy-voice.mp3"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/rtjeqf/wan-r2v-object3.png"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
}
],
resolution='720P',
ratio='16:9',
duration=10,
prompt_extend=False,
watermark=True)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_sync_call_r2v()レスポンス例
video_url の有効期間は 24 時間です。動画は速やかにダウンロードしてください。
{
"status_code": 200,
"request_id": "b040d446-f9b6-977f-b9ad-xxxxxx",
"code": null,
"message": "",
"output": {
"task_id": "5dab3291-393e-424d-929b-xxxxxx",
"task_status": "SUCCEEDED",
"video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
"submit_time": "2026-04-17 17:12:49.076",
"scheduled_time": "2026-04-17 17:13:00.384",
"end_time": "2026-04-17 17:29:43.386",
"orig_prompt": "Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, \"The sunshine is so nice today.\" Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, \"That sounds lovely. Can you sing it again?\""
},
"usage": {
"video_count": 1,
"video_duration": 0,
"video_ratio": "",
"duration": 15,
"input_video_duration": 5,
"output_video_duration": 10,
"SR": 720,
"ratio": "16:9"
}
}非同期呼び出し
非同期呼び出しはすぐにタスク ID を返します。完了を個別にポーリングまたは待機します。
リクエスト例
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# 以下の URL はシンガポールリージョン用です。呼び出し時に {WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください: api_key="sk-xxx"
# API キーはリージョンによって異なります。API キーの取得方法については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_r2v():
# 非同期呼び出し。task_id を返します。
rsp = VideoSynthesis.async_call(
api_key=api_key,
model='wan2.7-r2v-2026-06-12',
prompt='Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, "The sunshine is so nice today." Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, "That sounds lovely. Can you sing it again?"',
media=[
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/sjuytr/wan-r2v-object-girl.jpg",
"reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/gbqewz/wan-r2v-girl-voice.mp3"
},
{
"type": "reference_video",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4",
"reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/isllrq/wan-r2v-boy-voice.mp3"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/rtjeqf/wan-r2v-object3.png"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
}
],
resolution='720P',
ratio='16:9',
duration=10,
prompt_extend=False,
watermark=True)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
# 非同期タスク情報を取得します。
status = VideoSynthesis.fetch(task=rsp, api_key=api_key)
if status.status_code == HTTPStatus.OK:
print(status.output.task_status)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(status.status_code, status.code, status.message))
# 非同期タスクの完了を待ちます。
rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call_r2v()レスポンス例
タスク作成時のレスポンス例:
{ "status_code": 200, "request_id": "6dc3bf6c-be18-9268-9c27-xxxxxx", "code": "", "message": "", "output": { "task_id": "686391d9-7ecf-4290-a8e9-xxxxxx", "task_status": "PENDING", "video_url": "" }, "usage": null }タスク結果クエリ時のレスポンス例:
video_url の有効期間は 24 時間です。動画は速やかにダウンロードしてください。
{ "status_code": 200, "request_id": "b040d446-f9b6-977f-b9ad-xxxxxx", "code": null, "message": "", "output": { "task_id": "5dab3291-393e-424d-929b-xxxxxx", "task_status": "SUCCEEDED", "video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx", "submit_time": "2026-04-17 17:12:49.076", "scheduled_time": "2026-04-17 17:13:00.384", "end_time": "2026-04-17 17:29:43.386", "orig_prompt": "Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, \"The sunshine is so nice today.\" Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, \"That sounds lovely. Can you sing it again?\"" }, "usage": { "video_count": 1, "video_duration": 0, "video_ratio": "", "duration": 15, "input_video_duration": 5, "output_video_duration": 10, "SR": 720, "ratio": "16:9" } }
Java SDK
以下のコードを実行する前に、DashScope Java SDK のバージョンが 2.22.14 以上であることを確認してください。
古いバージョンでは、「url error, please check url!」などのエラーが発生する可能性があります。更新手順については、「SDK のインストール」をご参照ください。
baseHttpApiUrl はモデルのリージョンに基づいて設定します。
シンガポール
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
北京
Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
{WorkspaceId} は、実際のワークスペース IDに置き換えてください。
同期呼び出し
同期呼び出しは、動画生成が完了するまでブロッキングされ、結果を直接返します。
リクエスト例
// Copyright (c) Alibaba, Inc. and its affiliates.
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Ref2Video {
static {
// 以下の URL はシンガポールリージョン用です。呼び出し時に {WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください: apiKey="sk-xxx"
// API キーはリージョンによって異なります。API キーの取得方法については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
public static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void ref2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
List<VideoSynthesisParam.Media> media = new ArrayList<VideoSynthesisParam.Media>(){{
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/sjuytr/wan-r2v-object-girl.jpg")
.type("reference_image")
.referenceVoice("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/gbqewz/wan-r2v-girl-voice.mp3")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4")
.type("reference_video")
.referenceVoice("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/isllrq/wan-r2v-boy-voice.mp3")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/rtjeqf/wan-r2v-object3.png")
.type("reference_image")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png")
.type("reference_image")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png")
.type("reference_image")
.build());
}};
Map<String, Object> parameters = new HashMap<>();
parameters.put("resolution", "720P");
parameters.put("ratio", "16:9");
parameters.put("prompt_extend", false);
parameters.put("watermark", true);
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.7-r2v-2026-06-12")
.prompt("Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, \"The sunshine is so nice today.\" Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, \"That sounds lovely. Can you sing it again?\"")
.media(media)
.duration(10)
.parameters(parameters)
.build();
System.out.println("please wait...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
ref2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}レスポンス例
video_url の有効期間は 24 時間です。動画は速やかにダウンロードしてください。
{
"request_id": "f6365287-336f-9f2b-ab59-xxxxxx",
"output": {
"task_id": "cb7f1da5-a987-41de-b0a4-xxxxxx",
"task_status": "SUCCEEDED",
"video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxxx",
"orig_prompt": "Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, \"The sunshine is so nice today.\" Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, \"That sounds lovely. Can you sing it again?\"",
"submit_time": "2026-04-17 17:15:11.536",
"scheduled_time": "2026-04-17 17:15:20.316",
"end_time": "2026-04-17 17:29:44.277"
},
"usage": {
"video_count": 1,
"duration": 15,
"input_video_duration": 5,
"output_video_duration": 10,
"SR": 720
},
"status_code": 200,
"code": "",
"message": ""
}非同期呼び出し
非同期呼び出しはすぐにタスク ID を返します。完了を個別にポーリングまたは待機します。
リクエスト例
// Copyright (c) Alibaba, Inc. and its affiliates.
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisListResult;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.task.AsyncTaskListParam;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Ref2VideoAsync {
static {
// 以下の URL はシンガポールリージョン用です。呼び出し時に {WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください: apiKey="sk-xxx"
// API キーはリージョンによって異なります。API キーの取得方法については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
public static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void asyncRef2video() throws ApiException, NoApiKeyException, InputRequiredException, InterruptedException {
VideoSynthesis vs = new VideoSynthesis();
List<VideoSynthesisParam.Media> media = new ArrayList<VideoSynthesisParam.Media>(){{
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/sjuytr/wan-r2v-object-girl.jpg")
.type("reference_image")
.referenceVoice("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/gbqewz/wan-r2v-girl-voice.mp3")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4")
.type("reference_video")
.referenceVoice("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/isllrq/wan-r2v-boy-voice.mp3")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/rtjeqf/wan-r2v-object3.png")
.type("reference_image")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png")
.type("reference_image")
.build());
add(VideoSynthesisParam.Media.builder()
.url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png")
.type("reference_image")
.build());
}};
Map<String, Object> parameters = new HashMap<>();
parameters.put("resolution", "720P");
parameters.put("ratio", "16:9");
parameters.put("prompt_extend", false);
parameters.put("watermark", true);
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.7-r2v-2026-06-12")
.prompt("Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, \"The sunshine is so nice today.\" Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, \"That sounds lovely. Can you sing it again?\"")
.media(media)
.duration(10)
.parameters(parameters)
.build();
// 非同期タスクを送信します。
VideoSynthesisResult result = vs.asyncCall(param);
System.out.println("task_id: " + result.getOutput().getTaskId());
System.out.println(JsonUtils.toJson(result));
// タスクの完了を待ちます。
result = vs.wait(result, null);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
asyncRef2video();
} catch (ApiException | NoApiKeyException | InputRequiredException | InterruptedException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}レスポンス例
タスク作成時のレスポンス例:
{ "request_id": "5dbf9dc5-4f4c-9605-85ea-xxxxxxxx", "output": { "task_id": "7277e20e-aa01-4709-xxxxxxxx", "task_status": "PENDING" } }タスク結果クエリ時のレスポンス例:
video_url の有効期間は 24 時間です。動画は速やかにダウンロードしてください。
{ "request_id": "f6365287-336f-9f2b-ab59-xxxxxx", "output": { "task_id": "cb7f1da5-a987-41de-b0a4-xxxxxx", "task_status": "SUCCEEDED", "video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxxx", "orig_prompt": "Video 1 holds Image 3, plays a soothing country folk song on the chair from Image 4, and says, \"The sunshine is so nice today.\" Image 1, holding Image 2, walks past Video 1, places Image 2 on the table next to it, and says, \"That sounds lovely. Can you sing it again?\"", "submit_time": "2026-04-17 17:15:11.536", "scheduled_time": "2026-04-17 17:15:20.316", "end_time": "2026-04-17 17:29:44.277" }, "usage": { "video_count": 1, "duration": 15, "input_video_duration": 5, "output_video_duration": 10, "SR": 720 }, "status_code": 200, "code": "", "message": "" }
エラーコード
モデル呼び出しが失敗してエラーメッセージが返された場合は、「エラーコード」を参照して解決してください。
よくある質問
主題に音声を追加するにはどうすればよいですか(音声リファレンス)?
wan2.7 のみが音声リファレンスをサポートしています。media オブジェクト内で、reference_voice パラメーターに音声 URL を渡すことで、リファレンス画像または動画の被写体にリファレンス音声を指定できます。
{
"media": [
{
"type": "reference_image",
"url": "<URL of the reference image>",
"reference_voice": "<URL of the audio>"
},
{
"type": "reference_video",
"url": "<URL of the reference video>",
"reference_voice": "<URL of the audio>"
}
]
}