Wan テキスト動画生成モデルは、テキストプロンプトからスムーズな動画を生成します。
リファレンス:ユーザーガイド
可用性
モデル、エンドポイント URL、API キーのリージョンを一致させる必要があります。リージョンをまたいだ呼び出しは失敗します。
-
モデルの選択:対象リージョンでモデルが利用可能であることを確認してください。
-
URL の選択:対応するリージョンのエンドポイント URL を使用してください。HTTP と HTTPS の両方がサポートされています。
-
SDK のインストール:SDK を通じて API を呼び出すには、DashScope SDK をインストールします。
このトピックのサンプルコードでは、シンガポールリージョンを使用しています。
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 で、Model Studio コンソールの [ワークスペース詳細] ページで確認できます。既存のドメインは引き続き完全に機能します。
HTTP (wan2.7)
このインターフェイスは新しいプロトコルを使用し、wan2.7 のみをサポートします。
テキスト動画生成タスクには 1~5 分かかります。API は非同期呼び出しを使用します:タスクの作成 → 結果のポーリング。
ステップ 1:タスクの作成
北京
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
シンガポール
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
シンガポール
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
実際のワークスペース ID で {WorkspaceId} を置き換えてください。
-
タスクが作成された後、返された
task_idを使用して結果をクエリします。task_idは 24 時間有効です。重複したタスクを作成しないでください。代わりに、ポーリングを使用して結果を取得してください。 -
初心者向けのガイダンスについては、「Postman または cURL で API を呼び出す」をご参照ください。
リクエストパラメーター |
マルチショットナラティブ
音声ファイルの提供
自動吹き替え
ネガティブプロンプトの使用negative_prompt を使用して「花」の要素を除外し、動画に表示されないようにします。
|
ヘッダー |
|
|
Content-Type リクエストのコンテンツタイプです。 |
|
|
Authorization Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。 |
|
|
X-DashScope-Async 非同期処理を有効にします。HTTP リクエストは非同期呼び出しのみをサポートします。 重要
このリクエストヘッダーがない場合、「current user api does not support synchronous calls」というエラーが返されます。 |
|
リクエストボディ |
|
|
model モデル名。モデルと料金については、「モデルの料金」をご参照ください。 例:wan2.7-t2v, wan2.7-t2v-2026-06-12。 |
|
|
input プロンプトを含む入力データ。 |
|
|
parameters 動画生成パラメーター:解像度、プロンプトリライト、ウォーターマーク。 |
レスポンスパラメーター |
成功レスポンスタスクのステータスと結果をクエリするために
エラーレスポンスタスクの作成に失敗しました。「エラーコード」をご参照ください。
|
|
output タスクの出力。 |
|
|
request_id トレースとトラブルシューティングのための一意のリクエスト識別子。 |
|
|
code エラーコード。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。 |
|
|
message 詳細なエラーメッセージ。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。 |
ステップ 2:結果のクエリ
北京
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
シンガポール
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_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}
実際のワークスペース ID で {WorkspaceId} を置き換えてください。
-
ポーリングの推奨事項:動画生成には数分かかります。15 秒などの適切な間隔でポーリングメカニズムを使用してください。
-
タスク状態の遷移:PENDING → RUNNING → SUCCEEDED または FAILED。
-
結果リンク:タスクが成功すると、24 時間有効な動画 URL が返されます。動画をダウンロードして、OSS などの永続ストレージに保存してください。
-
task_idの有効期間:24 時間。この期間を過ぎると、クエリはタスクのステータスをUNKNOWNとして返します。
リクエストパラメーター |
タスク結果のクエリ前の API 呼び出しで返された |
ヘッダー |
|
|
Authorization Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。 |
|
パスパラメーター |
|
|
task_id タスクの ID。 |
レスポンスパラメーター |
タスクの実行成功動画の URL は 24 時間のみ有効で、その後自動的にパージ (消去) されます。生成された動画は速やかに保存してください。
タスクの実行失敗タスクが失敗すると、
タスククエリの期限切れ
|
|
output タスクの出力。 |
|
|
usage 出力統計。成功したタスクに対してのみ返されます。 |
|
|
request_id トレースとトラブルシューティングのための一意のリクエスト識別子。 |
HTTP (wan2.6 以前)
このインターフェイスはレガシープロトコルを使用し、wan2.6 以前 (wan2.5/wan2.2/wan2.1) をサポートします。
テキスト動画生成タスクには 1~5 分かかるため、API は非同期呼び出しを使用します:タスクの作成 → 結果のポーリング。
ステップ 1:タスクの作成
シンガポール
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
バージニア
POST https://dashscope-us.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
フランクフルト
POST https://<u>{WorkspaceId}.eu-central-1.maas.aliyuncs.com/</u>api/v1/services/aigc/video-generation/video-synthesis
実際のワークスペース ID で {WorkspaceId} を置き換えてください。
-
タスクが作成された後、返された
task_idを使用して結果をクエリします。task_idは 24 時間有効です。重複したタスクを作成しないでください。代わりに、ポーリングを使用して結果を取得してください。 -
初心者向けのガイダンスについては、「Postman または cURL で API を呼び出す」をご参照ください。
リクエストパラメーター |
マルチショットナラティブ
音声ファイルを渡すサポートされているモデル:wan2.6 および wan2.5 シリーズ。
自動吹き替えサポートされているモデル:wan2.6 および wan2.5 シリーズ。
無音動画の生成wan2.2 および wan2.1 シリーズモデルのみが無音動画生成をサポートします。これらのモデルは、追加の設定なしでデフォルトで無音動画を生成します。 wan2.6 および wan2.5 シリーズモデルは、デフォルトで音声付きの動画を生成します。
ネガティブプロンプトの使用サポートされているモデル:すべてのモデル。 negative_prompt を使用して、生成される動画から特定の要素 (「花」など) を除外します。
|
リクエストヘッダー |
|
|
Content-Type リクエストのコンテンツタイプです。 |
|
|
Authorization Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。 |
|
|
X-DashScope-Async 非同期処理を有効にします。HTTP リクエストは非同期呼び出しのみをサポートします。 重要
このリクエストヘッダーがない場合、「current user api does not support synchronous calls」というエラーが返されます。 |
|
リクエストボディ |
|
|
model モデル名。モデルと料金については、「モデルの料金」をご参照ください。 例:wan2.6-t2v。 |
|
|
input プロンプトを含む入力データ。 |
|
|
parameters 動画生成パラメーター:解像度、プロンプトリライト、ウォーターマーク。 |
レスポンスパラメーター |
成功レスポンスタスクのステータスと結果をクエリするために
エラーレスポンスタスクの作成に失敗しました。「エラーコード」をご参照ください。
|
|
output タスクの出力。 |
|
|
request_id トレースとトラブルシューティングのための一意のリクエスト識別子。 |
|
|
code エラーコード。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。 |
|
|
message 詳細なエラーメッセージ。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。 |
ステップ 2:結果のクエリ
シンガポール
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
バージニア
GET https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}
北京
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
フランクフルト
GET https://<u>{WorkspaceId}.eu-central-1.maas.aliyuncs.com</u>/api/v1/tasks/{task_id}
実際のワークスペース ID で {WorkspaceId} を置き換えてください。
-
ポーリングの推奨事項:動画生成には数分かかります。15 秒などの適切な間隔でポーリングメカニズムを使用してください。
-
タスク状態の遷移:PENDING → RUNNING → SUCCEEDED または FAILED。
-
結果リンク:タスクが成功すると、24 時間有効な動画 URL が返されます。動画をダウンロードして、OSS などの永続ストレージに保存してください。
-
task_idの有効期間:24 時間。この期間を過ぎると、クエリはタスクのステータスをUNKNOWNとして返します。
リクエストパラメーター |
タスク結果のクエリ前の API 呼び出しで返された |
ヘッダー |
|
|
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
-
SDK は wan2.6 以前をサポートしています。wan2.7 はサポートされていません。
-
DashScope Python SDK バージョン 1.25.8 以降が必要です。
古いバージョンでは「url error, please check url!」が返される場合があります。更新するには、「SDK のインストール」をご参照ください。
dashscope.base_http_api_url をリージョンエンドポイントに設定します:
北京
dashscope.base_http_api_url = 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1'
シンガポール
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
バージニア
dashscope.base_http_api_url = 'https://dashscope-us.aliyuncs.com/api/v1'
実際のワークスペース ID で {WorkspaceId} を置き換えてください。
同期呼び出し
リクエスト例
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os
# シンガポールリージョンの URL。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference をご参照ください。
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# 環境変数が設定されていない場合は、Model Studio の API キーに置き換えてください:api_key="sk-xxx"。
# API キーはリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_sync_call_t2v():
# 同期 API を呼び出し、結果を返します。
print('お待ちください...')
rsp = VideoSynthesis.call(api_key=api_key,
model='wan2.6-t2v',
prompt="Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them.'",
audio_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3',
size='1280*720',
duration=10,
negative_prompt="",
prompt_extend=True,
watermark=False,
seed=12345)
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_t2v()
レスポンス例
video_url は 24 時間後に期限切れになります。速やかにダウンロードしてください。
{
"status_code": 200,
"request_id": "167f3beb-3dd0-47fe-a83c-xxxxxx",
"code": null,
"message": "",
"output": {
"task_id": "5b65411f-d946-4e29-859e-xxxxxx",
"task_status": "SUCCEEDED",
"video_url": "https://dashscope-result-bj.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
"submit_time": "2025-10-23 11:47:23.879",
"scheduled_time": "2025-10-23 11:47:34.351",
"end_time": "2025-10-23 11:52:35.323",
"orig_prompt": "ローアングルからのショット、ミディアムクローズアップ、暖色系のトーン、混合照明 (デスクランプの光が窓からの曇り空の光と混ざり合っている)、サイドライティング、中央構図。クラシックな探偵事務所で、木製の本棚には古い事件ファイルと灰皿が詰まっている。緑色のデスクランプが、机の中央に広げられた事件ファイルを照らしている。ダークブラウンのトレンチコートとライトグレーのフェドーラ帽を身に着けたキツネが革張りの椅子に座っている。その毛皮は深紅色で、尻尾は端に軽く置かれ、指でゆっくりと黄ばんだページをめくっている。外では、青空の下で霧雨が絶え間なく降り、ガラスに蛇行する筋を残している。キツネはゆっくりと顔を上げ、耳をわずかにひくつかせ、琥珀色の目でカメラをまっすぐ見つめ、滑らかで皮肉な声で、口をはっきりと動かしながら話す。「事件は冷え切っていた、冬の魚よりも冷たく。だが、どんな鶏にも秘密はある。そして、私としては、それらを見つけ出すつもりだった 」。"
},
"usage": {
"video_count": 1,
"video_duration": 0,
"video_ratio": "",
"duration": 10,
"size": "1280*720",
"input_video_duration": 0,
"output_video_duration": 10,
"SR": 720
}
}
非同期呼び出し
リクエスト例
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os
# これはシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference をご参照ください。
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# 環境変数が設定されていない場合は、これを Model Studio の API キーに置き換えてください:api_key="sk-xxx"
# API キーはリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_t2v():
# 非同期 API を呼び出し、タスク情報を返します。
# タスク ID を使用してステータスを確認します。
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.6-t2v',
prompt="Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '.",
audio_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3',
size='1280*720',
duration=10,
negative_prompt="",
prompt_extend=True,
watermark=False,
seed=12345)
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))
# タスクが完了するまで待ちます。このメソッドは fetch を間隔を置いて呼び出し、タスクが完了状態にあるか確認します。
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_t2v()
レスポンス例
-
タスク作成レスポンス例
{ "status_code": 200, "request_id": "c86ff7ba-8377-917a-90ed-xxxxxx", "code": "", "message": "", "output": { "task_id": "721164c6-8619-4a35-a6d9-xxxxxx", "task_status": "PENDING", "video_url": "" }, "usage": null } -
タスククエリレスポンス例
video_url は 24 時間後に期限切れになります。速やかにダウンロードしてください。
{ "status_code": 200, "request_id": "167f3beb-3dd0-47fe-a83c-xxxxxx", "code": null, "message": "", "output": { "task_id": "5b65411f-d946-4e29-859e-xxxxxx", "task_status": "SUCCEEDED", "video_url": "https://dashscope-result-bj.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx", "submit_time": "2025-10-23 11:47:23.879", "scheduled_time": "2025-10-23 11:47:34.351", "end_time": "2025-10-23 11:52:35.323", "orig_prompt": "ローアングル、ミディアムクローズアップ、暖色系のトーン、混合照明 (デスクランプからの実用的な光と窓からの曇り空の光が混ざり合う)、サイドライティング、中央構図で撮影。クラシックな探偵事務所。木製の本棚には古い事件ファイルと灰皿がぎっしり詰まっている。緑色のデスクランプが、机の中央に広げられた事件ファイルを照らしている。ダークブラウンのトレンチコートとライトグレーのフェドーラ帽をかぶったキツネが革製の椅子に座っている。毛皮は深紅色で、尻尾は端に軽く置かれ、指は黄ばんだページをゆっくりとめくっている。外では青空の下で霧雨が絶え間なく降り、ガラスに曲がりくねった筋をつけている。キツネはゆっくりと頭を上げ、耳をわずかにぴくぴくさせ、琥珀色の目でカメラをまっすぐ見つめる。滑らかで皮肉な声で話すと、口がはっきりと動く。「事件は冷え切っていた、冬の魚よりも冷たい。だが、どんな鶏にだって秘密はある。そして、この私は、それを見つけ出すつもりだった。」" }, "usage": { "video_count": 1, "video_duration": 0, "video_ratio": "", "duration": 10, "size": "1280*720", "input_video_duration": 0, "output_video_duration": 10, "SR": 720 } }
Java SDK
-
SDK は wan2.6 以前をサポートしています。wan2.7 はサポートされていません。
-
DashScope Java SDK バージョン 2.22.6 以降が必要です。
古いバージョンでは「url error, please check url!」が返される場合があります。更新するには、「SDK のインストール」をご参照ください。
Constants.baseHttpApiUrl をリージョンエンドポイントに設定します:
シンガポール
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
バージニア
Constants.baseHttpApiUrl = "https://dashscope-us.aliyuncs.com/api/v1";
北京
Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
実際のワークスペース ID で {WorkspaceId} を置き換えてください。
同期呼び出し
リクエスト例
// Copyright (c) Alibaba, Inc. and its affiliates.
// dashscope SDK バージョン 2.18.2 以降
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.HashMap;
import java.util.Map;
public class Text2Video {
static {
// シンガポールリージョンの URL。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference をご参照ください。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 環境変数が設定されていない場合は、値を Model Studio の API キーに置き換えてください:apiKey = "sk-xxx"。
// API キーはリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
public static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void text2Video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
Map<String, Object> parameters = new HashMap<>();
parameters.put("prompt_extend", true);
parameters.put("watermark", false);
parameters.put("seed", 12345);
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-t2v")
.prompt("Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: ''The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them ''.")
.audioUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3")
.negativePrompt("")
.size("1280*720")
.duration(10)
.parameters(parameters)
.build();
System.out.println("お待ちください...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
text2Video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}
レスポンス例
video_url は 24 時間後に期限切れになります。速やかにダウンロードしてください。
{
"request_id": "c1209113-8437-424f-a386-xxxxxx",
"output": {
"task_id": "966cebcd-dedc-4962-af88-xxxxxx",
"task_status": "成功",
"video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
"orig_prompt": "ローアングルからのショット、ミディアムクローズアップ、暖色系のトーン、混合照明 (デスクランプからの実用的な光が窓からの曇り空の光と混ざり合う)、サイドライティング、そして中央構図。クラシックな探偵事務所で、木製の本棚には古い事件ファイルと灰皿が並んでいる。緑色のデスクランプが、机の中央に広げられた事件ファイルを照らしている。ダークブラウンのトレンチコートとライトグレーのフェドーラ帽をかぶったキツネが、革張りの椅子に座っている。その毛皮は深紅色で、尻尾は端に軽く置かれ、指で黄ばんだページをゆっくりとめくっている。外では、青空の下で霧雨が降り続き、ガラスに蛇行する筋を残している。キツネはゆっくりと頭を上げ、耳をわずかにひくつかせ、琥珀色の瞳でカメラをまっすぐ見つめる。滑らかで皮肉な声で話すとき、口がはっきりと動いている。『事件は冷え切っていた、冬の魚よりも冷たく。しかし、どんな鶏にも秘密はある。そして私としては、それらを見つけ出すつもりだった』",
"submit_time": "2026-01-22 23:13:40.553",
"scheduled_time": "2026-01-22 23:13:49.415",
"end_time": "2026-01-22 23:17:56.380"
},
"usage": {
"video_count": 1,
"duration": 10.0,
"size": "1280*720",
"input_video_duration": 0.0,
"output_video_duration": 10.0,
"SR": "720"
},
"status_code": 200,
"code": "",
"message": ""
}非同期呼び出し
リクエスト例
// 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.HashMap;
import java.util.Map;
public class Text2Video {
static {
// シンガポールリージョンの URL。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference をご参照ください。
Constants.baseHttpApiUrl="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 環境変数が設定されていない場合は、プレースホルダーを Model Studio の API キーに置き換えてください。例:apiKey="sk-xxx"
// API キーはリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/en/model-studio/get-api-key をご参照ください。
public static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void text2Video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
Map<String, Object> parameters = new HashMap<>();
parameters.put("prompt_extend", true);
parameters.put("watermark", false);
parameters.put("seed", 12345);
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-t2v")
.prompt("Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: ''The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them ''.")
.audioUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3")
.negativePrompt("")
.size("1280*720")
.duration(10)
.parameters(parameters)
.build();
// 非同期呼び出しを行います。
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("お待ちください...");
// 結果を取得します。
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
// タスクリストを取得します。
public static void listTask() throws ApiException, NoApiKeyException {
VideoSynthesis is = new VideoSynthesis();
AsyncTaskListParam param = AsyncTaskListParam.builder().build();
param.setApiKey(apiKey);
VideoSynthesisListResult result = is.list(param);
System.out.println(result);
}
// 単一タスクの結果を取得します。
public static void fetchTask(String taskId) throws ApiException, NoApiKeyException {
VideoSynthesis is = new VideoSynthesis();
// DASHSCOPE_API_KEY 環境変数を設定した場合、apiKey は null に設定できます。
VideoSynthesisResult result = is.fetch(taskId, apiKey);
System.out.println(result.getOutput());
System.out.println(result.getUsage());
}
public static void main(String[] args) {
try {
text2Video();
} catch (ApiException | NoApiKeyException | InputRequiredException 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": "c1209113-8437-424f-a386-xxxxxx", "output": { "task_id": "966cebcd-dedc-4962-af88-xxxxxx", "task_status": "SUCCEEDED", "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx", "orig_prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: ''The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them ''", "submit_time": "2026-01-22 23:13:40.553", "scheduled_time": "2026-01-22 23:13:49.415", "end_time": "2026-01-22 23:17:56.380" }, "usage": { "video_count": 1, "duration": 10.0, "size": "1280*720", "input_video_duration": 0.0, "output_video_duration": 10.0, "SR": "720" }, "status_code": 200, "code": "", "message": "" }
制限事項
-
データ保持:タスク ID (
task_id) と動画 URL (video_url) は 24 時間後に期限切れになります。期限切れ後は、クエリやダウンロードはできません。 -
コンテンツモデレーション:入力と出力はコンテンツモデレーションの対象となります。禁止されたコンテンツは、「IPInfringementSuspect」または「DataInspectionFailed」エラーをトリガーします。「エラーコード」をご参照ください。
エラーコード
モデルの呼び出しが失敗し、エラーメッセージが返された場合は、「エラーコード」を参照して解決してください。
よくある質問
Q:wan2.6 から wan2.7 にアップグレードするには、どのようなコード変更が必要ですか?
A:2 つの変更が必要です:
-
解像度制御:wan2.7 は
sizeフィールドを置き換えます。代わりに、resolution(解像度レベル) とratio(アスペクト比) の組み合わせを使用して出力解像度を定義します。以前のモデルではsizeフィールドが使用されていました。 -
ショットタイプの削除:wan2.7 は
shot_typeフィールドを廃止しました。代わりに、プロンプトで直接ショット構造を記述します。
Q:一時的な動画リンクを永続的なリンクに変換するにはどうすればよいですか?
A:直接の変換はできません。URL から動画をダウンロードし、永続ストレージ (Alibaba Cloud OSS など) にアップロードして永続的なリンクを生成してください。
Q:返された動画リンクはブラウザで直接再生できますか?
A:いいえ。リンクは 24 時間後に期限切れになります。動画をダウンロードして永続的に保存し、再生には永続的なリンクを使用してください。