すべてのプロダクト
Search
ドキュメントセンター

Alibaba Cloud Model Studio:Wan2.7 - テキスト動画生成 API リファレンス

最終更新日:Jul 02, 2026

Wan テキスト動画生成モデルは、テキストプロンプトからスムーズな動画を生成します。

リファレンスユーザーガイド

可用性

モデル、エンドポイント URL、API キーのリージョンを一致させる必要があります。リージョンをまたいだ呼び出しは失敗します。

  • モデルの選択:対象リージョンでモデルが利用可能であることを確認してください。

  • URL の選択:対応するリージョンのエンドポイント URL を使用してください。HTTP と HTTPS の両方がサポートされています。

  • API キーの設定:リージョンを選択し、API キーを取得して、環境変数に設定します。

  • 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 を呼び出す」をご参照ください。

リクエストパラメーター

マルチショットナラティブ

prompt 内の自然言語でショット構造を制御します。shot_type パラメーターは効果がありません。

  • シングルショット:「シングルショット動画を生成」と入力します。

  • マルチショット:「マルチショット動画を生成」と入力するか、タイムスタンプ付きでショットを記述します (例:「ショット 1 [0–3 秒] ワイドショット:夜の雨のニューヨークの通り」)。

  • デフォルト:指定しない場合、モデルは prompt の内容を解釈します。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.7-t2v-2026-06-12",
        "input": {
            "prompt": "映画のようなストーリーテリングで展開する、緊迫した探偵物語。 ショット 1 [0~3 秒] ワイドショット: 雨の降る夜のニューヨークの通り、ネオンが点滅し、黒いトレンチコートを着た探偵が早足で歩く。 ショット 2 [3~6 秒] ミディアムショット: 探偵は古い建物に入り、コートは雨で濡れ、後ろでドアがゆっくりと閉まる。 ショット 3 [6~9 秒] クローズアップ: 探偵の集中した目、遠くでサイレンが鳴り、彼はわずかに眉をひそめる。 ショット 4 [9~12 秒] ミディアムショット: 探偵は薄暗い廊下を慎重に進み、懐中電灯が道を照らす。 ショット 5 [12~15 秒] クローズアップ: 探偵は重要な手がかりを発見し、その顔には突然のひらめきが浮かぶ。"
        },
        "parameters": {
            "resolution": "720P",
            "ratio": "16:9",
            "prompt_extend": true,
            "watermark": true,
            "duration": 15
        }
    }'

音声ファイルの提供

input.audio_url パラメーターにカスタム音声ファイルの URL を指定します。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.7-t2v-2026-06-12",
        "input": {
            "prompt": "壮大でかわいいシーン。精巧に作られた金色の鎧と少し大きめのヘルメットを身に着けた、小さくて愛らしい漫画の子猫の将軍が、崖の上に勇敢に立っています。彼は小さいながらも英雄的な軍馬に乗り、こう言います:「青海の長雲 雪山を暗くし、孤城遥かに望む玉門関。黄沙百戦 金甲を穿つ、楼蘭を破らずんば終に還らず」。崖の下では、間に合わせの武器を持った広大で無限のネズミの軍隊が突撃しています。これは、古代中国の戦争叙事詩にインスパイアされた、ドラマチックで大規模な戦闘シーンです。遠くでは、雪山の上空に暗い雲が集まっています。全体の雰囲気は、「かわいい」と「威圧的」がコミカルかつ壮大に融合したものです。",
            "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3"
        },
        "parameters": {
            "resolution": "1080P",
            "ratio": "16:9",
            "prompt_extend": true,
            "duration": 10
        }
    }'

自動吹き替え

input.audio_url がない場合、モデルは動画コンテンツに合った BGM や効果音を生成します。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.7-t2v-2026-06-12",
        "input": {
            "prompt": "壮大でかわいいシーン。精巧で緻密な金色の鎧と少し大きすぎるヘルメットを身に着けた、小さくて愛らしい漫画の子猫の将軍が、崖の上に勇敢に立っています。彼は小さいながらも英雄的な軍馬に乗り、次のように言います: 「青海の長い雲が雪山を暗くし、孤立した都市が遠く玉門関を眺めている。黄砂の中での百戦錬磨で金色の鎧はすり減ったが、楼蘭を破るまでは帰らない」。崖の下では、間に合わせの武器を持った広大で無限のネズミの軍隊が前進しています。これは、古代中国の戦争叙事詩に触発された、ドラマチックで大規模な戦闘シーンです。遠くでは、雪山の上空に暗い雲が集まっています。全体的な雰囲気は、「かわいい」と「威風堂々」が融合した、コミカルで壮大なものです。"
        },
        "parameters": {
            "resolution": "720P",
            "ratio": "16:9",
            "prompt_extend": true,
            "duration": 10
        }
    }'

ネガティブプロンプトの使用

negative_prompt を使用して「花」の要素を除外し、動画に表示されないようにします。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.7-t2v-2026-06-12",
        "input": {
            "prompt": "A kitten running in the moonlight",
            "negative_prompt": "flower"
        },
        "parameters": {
            "resolution": "720P",
            "ratio": "16:9"
        }
    }'
ヘッダー

Content-Type string (必須)

リクエストのコンテンツタイプです。application/json である必要があります。

Authorization string (必須)

Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。

X-DashScope-Async string (必須)

非同期処理を有効にします。HTTP リクエストは非同期呼び出しのみをサポートします。enable である必要があります。

重要

このリクエストヘッダーがない場合、「current user api does not support synchronous calls」というエラーが返されます。

リクエストボディ

model string (必須)

モデル名。モデルと料金については、「モデルの料金」をご参照ください。

例:wan2.7-t2v, wan2.7-t2v-2026-06-12。

input object (必須)

プロンプトを含む入力データ。

プロパティ

prompt string (必須)

動画のコンテンツと視覚スタイルを記述するテキストプロンプト。

中国語と英語をサポートします。各文字またはアルファベットは 1 としてカウントされます。制限を超えたテキストは自動的に切り捨てられます。モデルごとの最大長:

  • wan2.7-t2v, wan2.7-t2v-2026-06-12:最大 5,000 文字。

例:月明かりの中を走る子猫。

ヒントについては、「テキスト動画生成/画像動画生成プロンプトガイド」をご参照ください。

negative_prompt string (任意)

生成される動画から除外する要素。

中国語と英語をサポートします。最大 500 文字。長いテキストは自動的に切り捨てられます。

例:低解像度、エラー、最低品質、低品質、変形、指の追加、不適切な比率。

audio_url string (任意)

動画生成用の音声ファイルの URL。

サポートされているフォーマット:

  1. パブリック URL:

    • HTTP および HTTPS プロトコル。

    • 例:https://help-static-aliyun-doc.aliyuncs.com/xxx.mp3。

音声の制限:

  • フォーマット:WAV, MP3。

  • 持続時間:2~30 秒。

  • ファイルサイズ:最大 15 MB。

  • 持続時間の処理:音声が duration の値 (例:5 秒) を超える場合、最初の 5 秒のみが使用されます。音声が動画より短い場合、残りの動画は無音になります。例えば、5 秒の動画に 3 秒の音声を指定すると、3 秒の音声の後に 2 秒の無音部分が続きます。

parameters object (任意)

動画生成パラメーター:解像度、プロンプトリライト、ウォーターマーク。

プロパティ

resolution string (任意)

重要

解像度はコストに影響します。呼び出す前に「モデルの料金」を確認してください。

生成される動画の解像度レベル。出力の鮮明さ (総ピクセル数) を制御します。

  • wan2.7-t2v, wan2.7-t2v-2026-06-12:有効な値:720P, 1080P。デフォルト:1080P

ratio string (任意)

出力動画のアスペクト比。

  • 16:9 (デフォルト)

  • 9:16

  • 1:1

  • 4:3

  • 3:4

アスペクト比ごとの出力解像度 (幅*高さ):

解像度レベル

アスペクト比

出力動画の解像度 (幅*高さ)

720P

16:9

1280*720

9:16

720*1280

1:1

960*960

4:3

1104*832

3:4

832*1104

1080P

16:9

1920*1080

9:16

1080*1920

1:1

1440*1440

4:3

1648*1248

3:4

1248*1648

duration integer (任意)

重要

持続時間はコストに影響します。課金は秒単位です。呼び出す前に「モデルの料金」を確認してください。

出力動画の持続時間 (秒)。

  • wan2.7-t2v, wan2.7-t2v-2026-06-12:2 から 15 までの整数。デフォルト:5。

prompt_extend boolean (任意)

プロンプトリライトを有効にします。有効にすると、LLM が入力プロンプトを書き換えて生成品質を向上させます。短いプロンプトに最適ですが、レイテンシが増加します。

  • true (デフォルト)

  • false

watermark boolean (任意)

右下隅に「AI Generated」というテキストのウォーターマークを追加します。

  • false (デフォルト)

  • true

seed integer (任意)

乱数シードは [0, 2147483647] の範囲の整数である必要があります。

指定しない場合、ランダムなシードが生成されます。シードを固定すると再現性が向上します。

モデルの生成は確率的であるため、同じシードでも同一の結果が保証されるわけではありません。

レスポンスパラメーター

成功レスポンス

タスクのステータスと結果をクエリするために task_id を保存します。

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

エラーレスポンス

タスクの作成に失敗しました。「エラーコード」をご参照ください。

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

output object

タスクの出力。

プロパティ

task_id string

タスク ID。24 時間クエリに有効です。

task_status string

タスクのステータス。

列挙値

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN:タスクが存在しないか、ステータスが不明です。

request_id string

トレースとトラブルシューティングのための一意のリクエスト識別子。

code string

エラーコード。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

message string

詳細なエラーメッセージ。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

ステップ 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 呼び出しで返された task_id の値で {task_id} を置き換えてください。task_id は 24 時間クエリに有効です。

curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

ヘッダー

Authorization string (必須)

Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。

パスパラメーター

task_id string (必須)

タスクの ID。

レスポンスパラメーター

タスクの実行成功

動画の URL は 24 時間のみ有効で、その後自動的にパージ (消去) されます。生成された動画は速やかに保存してください。

{
    "request_id": "caa62a12-8841-41a6-8af2-xxxxxx",
    "output": {
        "task_id": "eff1443c-ccab-4676-aad3-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2025-09-29 14:18:52.331",
        "scheduled_time": "2025-09-29 14:18:59.290",
        "end_time": "2025-09-29 14:23:39.407",
        "orig_prompt": "壮大でかわいいシーン。精巧で緻密な金の鎧と、少し大きめのヘルメットを身に着けた、小さくて愛らしい漫画の子猫の将軍が、崖の上に勇敢に立っています。彼は小さいながらも英雄的な軍馬に乗り、こう言います。『青海の長い雲は雪山を暗くし、孤城は遥か玉門関を望む。黄砂での百戦で金の鎧はすり減ったが、楼蘭を破るまでは決して帰らない』。崖の下では、間に合わせの武器を持ったネズミの大軍が、果てしなく突撃してきます。これは、古代中国の戦争叙事詩にインスパイアされた、ドラマチックで大規模な戦闘シーンです。遠くの雪山の上空には、暗雲が立ち込めています。全体的な雰囲気は、『かわいい』と『威圧的』がコミカルかつ壮大に融合したものです。",
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx"
    },
    "usage": {
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "video_count": 1,
        "ratio": "16:9",
        "SR": 720
    }
}

タスクの実行失敗

タスクが失敗すると、task_status は FAILED となり、エラーコードとメッセージが表示されます。「エラーコード」をご参照ください。

{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The size does not match xxxxxx"
    }
}

タスククエリの期限切れ

task_id は 24 時間有効です。この期間を過ぎると、クエリは次のエラーを返します。

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

output object

タスクの出力。

プロパティ

task_id string

タスク ID。24 時間クエリに有効です。

task_status string

タスクのステータス。

列挙値

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN:タスクが存在しないか、ステータスが不明です。

ポーリング中の状態遷移:

  • PENDING → RUNNING → SUCCEEDED または FAILED。

  • 最初のクエリステータスは通常 PENDING または RUNNING です。

  • ステータスが SUCCEEDED に変わると、レスポンスには生成された動画の URL が含まれます。

  • ステータスが FAILED の場合は、エラーメッセージを確認してタスクをリトライしてください。

submit_time string

タスクが送信された時刻。時刻は UTC+8 で、フォーマットは YYYY-MM-DD HH:mm:ss.SSS です。

scheduled_time string

タスクが実行された時刻。時刻は UTC+8 で、フォーマットは YYYY-MM-DD HH:mm:ss.SSS です。

end_time string

タスクが完了した時刻。時刻は UTC+8 で、フォーマットは YYYY-MM-DD HH:mm:ss.SSS です。

video_url string

task_status が SUCCEEDED の場合にのみ返される、生成された動画の URL。

24 時間有効です。動画は MP4 フォーマットで H.264 エンコーディングです。

orig_prompt string

元の入力プロンプト。リクエストパラメーター prompt に対応します。

code string

エラーコード。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

message string

詳細なエラーメッセージ。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

usage object

出力統計。成功したタスクに対してのみ返されます。

プロパティ

duration float

課金に使用される合計動画持続時間。

output_video_duration と等しい。

input_video_duration integer

固定値:0。

output_video_duration integer

出力動画の持続時間 (秒)。input.duration の値と一致します。

SR integer

出力動画の解像度レベル。例:720。

ratio string

出力動画のアスペクト比。例:16:9。

video_count integer

生成された動画の数。常に 1 です。

request_id string

トレースとトラブルシューティングのための一意のリクエスト識別子。

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 を呼び出す」をご参照ください。

リクエストパラメーター

マルチショットナラティブ

  • マルチショットナラティブを作成するには、shot_type"multi" に設定します。

  • prompt_extendtrue に設定して、ストーリーボードの最適化のためにプロンプトリライトを有効にします。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.6-t2v",
        "input": {
            "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"
        },
        "parameters": {
            "size": "1280*720",
            "prompt_extend": true,
            "duration": 10,
            "shot_type":"multi"
        }
    }'

音声ファイルを渡す

サポートされているモデル:wan2.6 および wan2.5 シリーズ。

input.audio_url パラメーターをカスタム音声ファイルの URL に設定します。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.5-t2v-preview",
        "input": {
            "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"
        },
        "parameters": {
            "size": "832*480",
            "prompt_extend": true,
            "duration": 10
        }
    }'

自動吹き替え

サポートされているモデル:wan2.6 および wan2.5 シリーズ。

input.audio_url パラメーターがない場合、モデルは動画コンテンツに合った BGM や効果音を生成します。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.5-t2v-preview",
        "input": {
            "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 \""
        },
        "parameters": {
            "size": "832*480",
            "prompt_extend": true,
            "duration": 10
        }
    }'

無音動画の生成

wan2.2 および wan2.1 シリーズモデルのみが無音動画生成をサポートします。これらのモデルは、追加の設定なしでデフォルトで無音動画を生成します。

wan2.6 および wan2.5 シリーズモデルは、デフォルトで音声付きの動画を生成します。
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.2-t2v-plus",
        "input": {
            "prompt": "低コントラスト。1970年代風のレトロな地下鉄の駅で、ストリートミュージシャンがくすんだ色彩とざらついた質感の中で演奏しています。彼は古風なジャケットを着てギターを抱え、集中して演奏しています。通勤客が急ぎ足で通り過ぎ、徐々に小さな人だかりができて彼の演奏に耳を傾けます。カメラはゆっくりと右にパンし、楽器の音と街のノイズが混じり合う光景を捉えます。背景には古風な地下鉄の標識とまだら模様の壁が見えます。"
        },
        "parameters": {
            "size": "832*480",
            "prompt_extend": true
        }
    }'

ネガティブプロンプトの使用

サポートされているモデル:すべてのモデル。

negative_prompt を使用して、生成される動画から特定の要素 (「花」など) を除外します。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
        -H 'X-DashScope-Async: enable' \
        -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
        -H 'Content-Type: application/json' \
        -d '{
        "model": "wan2.2-t2v-plus",
        "input": {
            "prompt": "A kitten running in the moonlight",
            "negative_prompt": "flowers"
        },
        "parameters": {
            "size": "832*480"
        }
    }'
リクエストヘッダー

Content-Type string (必須)

リクエストのコンテンツタイプです。application/json である必要があります。

Authorization string (必須)

Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。

X-DashScope-Async string (必須)

非同期処理を有効にします。HTTP リクエストは非同期呼び出しのみをサポートします。enable である必要があります。

重要

このリクエストヘッダーがない場合、「current user api does not support synchronous calls」というエラーが返されます。

リクエストボディ

model string (必須)

モデル名。モデルと料金については、「モデルの料金」をご参照ください。

例:wan2.6-t2v。

input object (必須)

プロンプトを含む入力データ。

プロパティ

prompt string (必須)

動画のコンテンツと視覚スタイルを記述するテキストプロンプト。

中国語と英語をサポートします。各文字またはアルファベットは 1 としてカウントされます。制限を超えたテキストは自動的に切り捨てられます。モデルごとの最大長:

  • wan2.6 および wan2.5 シリーズモデル:最大 1,500 文字。

  • wan2.2 および wan2.1 シリーズモデル:最大 800 文字。

例:月明かりの中を走る子猫。

ヒントについては、「テキスト動画生成/画像動画生成プロンプトガイド」をご参照ください。

negative_prompt string (任意)

生成される動画から除外する要素。

中国語と英語をサポートします。最大 500 文字。長いテキストは自動的に切り捨てられます。

例:低解像度、エラー、最低品質、低品質、変形、指の追加、不適切な比率。

audio_url string (任意)

サポートされているモデル:wan2.6 および wan2.5 シリーズ。

動画生成用の音声ファイルの URL。

サポートされているフォーマット:

  1. パブリック URL:

    • HTTP および HTTPS プロトコル。

    • 例:https://help-static-aliyun-doc.aliyuncs.com/xxx.mp3。

音声の制限:

  • フォーマット:WAV, MP3。

  • 持続時間:3 秒~30 秒。

  • ファイルサイズ:最大 15 MB。

  • 持続時間の処理:音声が duration の値 (例:5 秒) を超える場合、最初の 5 秒のみが使用されます。音声が動画より短い場合、残りの動画は無音になります。例えば、5 秒の動画に 3 秒の音声を指定すると、3 秒の音声の後に 2 秒の無音部分が続きます。

parameters object (任意)

動画生成パラメーター:解像度、プロンプトリライト、ウォーターマーク。

プロパティ

size string (任意)

重要
  • size パラメーターはコストに影響します:コスト = 単価 (解像度ベース) x 持続時間 (秒)。同じモデルの場合:1080p > 720p > 480p。「モデルの料金」を確認してください。

  • size を特定の解像度 (例:1280*720) に設定し、アスペクト比 (1:1) やティアラベル (480p) には設定しないでください。

出力動画の解像度を 幅*高さ の形式で指定します。デフォルト値と有効な値はモデルによって異なります:

  • wan2.6-t2v:デフォルト値は 1920*1080 (1080p) です。有効な解像度:720p および 1080p ティアのすべて。

  • wan2.6-t2v-us:デフォルト値は 1920*1080 (1080p) です。有効な解像度:720p および 1080p ティアのすべて。

  • wan2.5-t2v-preview:デフォルト値は 1920*1080 (1080p) です。有効な解像度:480p、720p、1080p ティアのすべて。

  • wan2.2-t2v-plus:デフォルト値は 1920*1080 (1080p) です。有効な解像度:480p および 1080p ティアのすべて。

  • wan2.1-t2v-turbo:デフォルト値は 1280*720 (720p) です。有効な解像度:480p および 720p ティアのすべて。

  • wan2.1-t2v-plus:デフォルト値は 1280*720 (720p) です。有効な解像度:720p ティアのすべて。

480p ティアの解像度とアスペクト比:

  • 832*480:16:9。

  • 480*832:9:16。

  • 624*624:1:1。

720p ティアの解像度とアスペクト比:

  • 1280*720:16:9。

  • 720*1280:9:16。

  • 960*960:1:1。

  • 1088*832:4:3。

  • 832*1088:3:4。

1080p ティアの解像度とアスペクト比:

  • 1920*1080:16:9。

  • 1080*1920:9:16。

  • 1440*1440:1:1。

  • 1632*1248:4:3。

  • 1248*1632:3:4。

duration integer (任意)

重要

持続時間はコストに影響します:コスト = 単価 (解像度ベース) x 持続時間 (秒)。「モデルの料金」を確認してください。

出力動画の持続時間 (秒)。有効な値はモデルによって異なります:

  • wan2.6-t2v:2 から 15 までの整数。デフォルト値は 5 です。

  • wan2.6-t2v-us:有効な値は 5 と 10 です。デフォルト値は 5 です。

  • wan2.5-t2v-preview:有効な値は 5 と 10 です。デフォルト値は 5 です。

  • wan2.2-t2v-plus:5 秒に固定されており、変更できません。

  • wan2.1-t2v-plus:5 秒に固定されており、変更できません。

  • wan2.1-t2v-turbo:5 秒に固定されており、変更できません。

prompt_extend boolean (任意)

プロンプトリライトを有効にします。有効にすると、LLM が入力プロンプトを書き換えて品質を向上させます。短いプロンプトに最適ですが、レイテンシが増加します。

  • true (デフォルト)

  • false

shot_type string (任意)

サポートされているモデル:wan2.6 モデル。

出力動画のショット構造:1 つの連続したショット、またはトランジションのある複数のショット。

有効な値:

  • single (デフォルト)

  • multi

このパラメーターは "prompt_extend": true が設定されている場合にのみ有効です。

優先順位:shot_type はプロンプトをオーバーライドします。shot_typesingle に設定すると、プロンプトがマルチショットを要求していてもシングルショットの動画が生成されます。

watermark boolean (任意)

右下隅に「AI Generated」というテキストのウォーターマークを追加します。

  • false (デフォルト)

  • true

seed integer (任意)

乱数シードは [0, 2147483647] の範囲の整数である必要があります。

指定しない場合、ランダムなシードが生成されます。シードを固定すると再現性が向上します。

モデルの生成は確率的であるため、同じシードでも同一の結果が保証されるわけではありません。

レスポンスパラメーター

成功レスポンス

タスクのステータスと結果をクエリするために task_id を保存します。

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

エラーレスポンス

タスクの作成に失敗しました。「エラーコード」をご参照ください。

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

output object

タスクの出力。

プロパティ

task_id string

タスク ID。24 時間クエリに有効です。

task_status string

タスクのステータス。

列挙値

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN:タスクが存在しないか、ステータスが不明です。

request_id string

トレースとトラブルシューティングのための一意のリクエスト識別子。

code string

エラーコード。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

message string

詳細なエラーメッセージ。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

ステップ 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 呼び出しで返された task_id の値で {task_id} を置き換えてください。task_id は 24 時間クエリに有効です。

curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

ヘッダー

Authorization string (必須)

Model Studio の API キーでリクエストを認証します。例:Bearer sk-xxxx。

パスパラメーター

task_id string (必須)

タスクの ID。

レスポンスパラメーター

タスクの実行成功

動画の URL は 24 時間のみ有効で、その後自動的にパージ (消去) されます。生成された動画は速やかに保存してください。

{
        "request_id": "abbf7aa3-9652-4785-a622-xxxxxx",
        "output": {
            "task_id": "38513c71-5190-48e1-9f3b-xxxxxx",
            "task_status": "SUCCEEDED",
            "submit_time": "2025-09-29 14:05:22.119",
            "scheduled_time": "2025-09-29 14:05:28.278",
            "end_time": "2025-09-29 14:10:00.437",
            "orig_prompt": "ローアングルからのショット、ミディアムクローズアップ、暖色系のトーン、混合照明 (デスクランプからの実用的な光がウィンドウからの曇り空の光と混ざり合っている)、サイドライティング、そしてセンター構図。クラシックな探偵事務所で、木製の本棚には古い事件ファイルと灰皿が詰まっている。緑色のデスクランプが、机のセンターに広げられた事件ファイルを照らしている。ダークブラウンのトレンチコートとライトグレーの中折れ帽をかぶったキツネが革張りの椅子に座っている。その毛皮は深紅色で、尻尾はエッジに軽く置かれ、指はゆっくりと黄ばんだページをめくっている。外では、青空の下で絶え間ない霧雨が降り、ガラスに曲がりくねった筋を残している。キツネはゆっくりと頭を上げ、耳をわずかにひくつかせ、琥珀色の目でカメラをまっすぐ見つめる。滑らかで皮肉な声で話すとき、その口ははっきりと動いている。『事件は迷宮入りだった、冬の魚よりも冷たく。だが、どんな人間にも秘密はあるものだ。そしてこの俺は、それを見つけ出すつもりだった』。",
            "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx"
        },
        "usage": {
            "duration": 10,
            "size": "1280*720",
            "input_video_duration": 0,
            "output_video_duration": 10,
            "video_count": 1,
            "SR": 720
        }
    }

タスクの実行失敗

タスクが失敗すると、task_status は FAILED となり、エラーコードとメッセージが表示されます。「エラーコード」をご参照ください。

{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The size is not match xxxxxx"
    }
}

タスククエリの期限切れ

task_id は 24 時間有効です。この期間を過ぎると、クエリは次のエラーを返します。

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

output object

タスクの出力。

プロパティ

task_id string

タスク ID。24 時間クエリに有効です。

task_status string

タスクのステータス。

列挙値

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN:タスクが存在しないか、ステータスが不明です。

ポーリング中の状態遷移:

  • PENDING → RUNNING → SUCCEEDED または FAILED。

  • 最初のクエリステータスは通常 PENDING または RUNNING です。

  • ステータスが SUCCEEDED に変わると、レスポンスには生成された動画の URL が含まれます。

  • ステータスが FAILED の場合は、エラーメッセージを確認してタスクをリトライしてください。

submit_time string

タスクが送信された時刻。時刻は UTC+8 で、フォーマットは YYYY-MM-DD HH:mm:ss.SSS です。

scheduled_time string

タスクが実行された時刻。時刻は UTC+8 で、フォーマットは YYYY-MM-DD HH:mm:ss.SSS です。

end_time string

タスクが完了した時刻。時刻は UTC+8 で、フォーマットは YYYY-MM-DD HH:mm:ss.SSS です。

video_url string

task_status が SUCCEEDED の場合にのみ返される、生成された動画の URL。

24 時間有効です。動画は MP4 フォーマットで H.264 エンコーディングです。

orig_prompt string

元の入力プロンプト。リクエストパラメーター prompt に対応します。

actual_prompt string

prompt_extend=true の場合、システムは入力プロンプトを書き換えます。このフィールドには、生成に使用された書き換え後のプロンプトが含まれます。

  • prompt_extend=false の場合は返されません。

  • wan2.6 モデルは、prompt_extend の値に関係なく、このフィールドを返しません。

code string

エラーコード。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

message string

詳細なエラーメッセージ。失敗したリクエストに対してのみ返されます。「エラーコード」をご参照ください。

usage object

出力統計。成功したタスクに対してのみ返されます。

プロパティ

video_duration integer

wan2.5 以前でのみ返されます (課金に使用)。

出力動画の持続時間 (秒)。有効な値:5, 10。

duration float

wan2.6 でのみ返されます (課金に使用)。

合計動画持続時間。式:duration=input_video_duration+output_video_duration

input_video_duration integer

wan2.6 でのみ返されます。固定値:0。

output_video_duration integer

wan2.6 でのみ返されます。

出力動画の持続時間 (秒)。input.duration の値と一致します。

SR integer

wan2.6 でのみ返されます。出力動画の解像度レベル。例:720。

size string

wan2.6 でのみ返されます。出力解像度を「幅×高さ」形式で指定します。例:1920×1080。

video_ratio string

wan2.5 以前でのみ返されます。出力解像度を「幅×高さ」形式で指定します。例:832×480。

video_count integer

生成された動画の数。常に 1 です。

request_id string

トレースとトラブルシューティングのための一意のリクエスト識別子。

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()
レスポンス例
  1. タスク作成レスポンス例

    {
    	"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
    }
  2. タスククエリレスポンス例

    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);
    }
}
レスポンス例
  1. タスク作成レスポンス例。

    {
            "request_id": "5dbf9dc5-4f4c-9605-85ea-xxxxxxxx",
    	"output": {
    		"task_id": "7277e20e-aa01-4709-xxxxxxxx",
    		"task_status": "PENDING"
    	}
    }
  2. タスククエリレスポンス例

    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 など) にアップロードして永続的なリンクを生成してください。

サンプルコード:動画をローカルデバイスにダウンロードする

import requests

def download_and_save_video(video_url, save_path):
    try:
        response = requests.get(video_url, stream=True, timeout=300)
        response.raise_for_status()
        with open(save_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                f.write(chunk)
        print(f"動画は正常にダウンロードされました: {save_path}")
        # ここに動画を永続ストレージにアップロードするロジックを追加できます
    except requests.exceptions.RequestException as e:
        print(f"動画のダウンロードに失敗しました: {e}")

if __name__ == '__main__':
    video_url = "http://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxxx"
    save_path = "video.mp4"
    download_and_save_video(video_url, save_path)

Q:返された動画リンクはブラウザで直接再生できますか?

A:いいえ。リンクは 24 時間後に期限切れになります。動画をダウンロードして永続的に保存し、再生には永続的なリンクを使用してください。