トレーニング済みモデルをオンライン API サービスとして公開します。
前提条件
- サポート対象リージョン:現在、モデルデプロイ API はシンガポールリージョンでのみ利用可能です。他のリージョンをご利用の場合は、そのリージョンの Model Studio コンソールからモデルをデプロイしてください。
- アカウント権限:Alibaba Cloud のサブアカウント (RAM ユーザー) を使用する場合、サブアカウントにモデルの呼び出し、トレーニング、デプロイの権限を付与する必要があります。
- 環境変数の設定:API キーを取得し、環境変数として設定済みであること。
- 前提:モデルのファインチューニングが完了していること。デプロイを進める前に、まず ファインチューニングジョブの照会 API を呼び出して、ジョブステータス
status が SUCCEEDED であることを確認してください。
モデルデプロイ
シンガポール
POST https://dashscope-intl.aliyuncs.com/api/v1/deployments
Windows の CMD を使用する場合は、$DASHSCOPE_API_KEY を %DASHSCOPE_API_KEY% に置き換えてください。PowerShell を使用する場合は、$env:DASHSCOPE_API_KEY に置き換えてください。
リクエストパラメーター ヘッダー Content-Type 文字列 (必須) 固定値: application/json Authorization 文字列 (必須) API キー認証です。フォーマットは Bearer sk-xxxx です。 リクエストボディ model_name 文字列 (必須) デプロイするモデルの ID (ベースモデル名ではなく、ファインチューニングまたはエクスポート後に生成されたモデル識別子) です。取得方法: capacity 整数 (必須) デプロイするモデルインスタンスの数。推奨値:1。 plan 文字列 (必須) デプロイ方式。LoRA による効率的なファインチューニングの場合、推奨値は lora です。 aigc_config オブジェクト (必須) プロンプト設定。 aigc_config のプロパティ use_input_prompt ブール値 (必須) デプロイされたモデルを呼び出して動画を生成する際のプロンプトソースを制御します。
false (デフォルト):自動生成モード。動画生成 API を呼び出す際、システムは入力プロンプトを無視し、aigc_config.prompt と aigc_config.lora_prompt_default に設定されたテンプレートを使用してプロンプトを自動生成します。
true:手動入力モード。動画生成 API を呼び出す際、システムは入力プロンプトを直接使用し、上記の 2 つのパラメーターは無効になります。
prompt 文字列 (必須) プリセットのプロンプトテンプレート。use_input_prompt=false が設定されている場合にのみ有効です。 デプロイされたモデルを呼び出して動画を生成する際、システムは入力画像を分析し、画像の内容をこのテンプレートに埋め込み、エフェクト指示を含む完全な説明を自動生成します。 注意:このパラメーターは、動画生成 API で渡される prompt パラメーターを 上書き します。 lora_prompt_default 文字列 (必須) フォールバックのプロンプトテンプレート。use_input_prompt=false が設定されている場合にのみ有効です。 aigc_config.prompt が生成に失敗した場合、システムはこのパラメーターをフォールバックプロンプトとして使用して動画を生成します。
| イメージツービデオ (最初のフレーム)次の例では、マネーレインエフェクトを使用します。人物画像をアップロードすると、システムが自動的にエフェクト付きの動画を生成します。 curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/deployments' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model_name": "<model_name に置き換えてください>",
"aigc_config": {
"use_input_prompt": false,
"prompt": "Based on the content of the image, provide a description for a video. The description must include the phrase \"Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, densely falling on and surrounding the subject. As the bills continue to fall, the subject spreads their arms upwards, tilts their head back slightly, with a surprised expression, completely immersed in this wild money rain.\"\nOutput template:\nThe video begins with a shot of [Subject Description]. [Environment Description]. Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, densely falling on and surrounding the subject. As the bills continue to fall, the subject spreads their arms upwards, tilts their head back slightly, with a surprised expression, completely immersed in this wild money rain.\nExample:\nThe video begins with a scene of a young woman standing in front of an ivy-covered brick wall. She has long, smooth, reddish-brown hair, is wearing a white sleeveless dress and a shiny silver necklace, and has a smile on her face. The brick wall in the background is covered with green ivy, creating a rustic and natural atmosphere. Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, surrounding her. As the bills continue to fall, she spreads her arms upwards, tilts her head back slightly, with a surprised expression, completely immersed in this wild money rain.",
"lora_prompt_default": "Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, densely falling on and surrounding the subject. As the bills continue to fall, the subject spreads their arms upwards, tilts their head back slightly, with a surprised expression, completely immersed in this wild money rain."
},
"capacity": 1,
"plan": "lora"
}'
イメージツービデオ (最初と最後のフレーム)次の例では、ファッション雑誌の着せ替えエフェクトを使用します。最初と最後のフレーム画像をアップロードすると、システムが自動的に着せ替えのトランジション動画を生成します。 curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/deployments' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model_name": "<model_name に置き換えてください>",
"aigc_config": {
"use_input_prompt": false,
"prompt": "Based on the content of the image, provide a description for a video. The description must include the phrase \"Then, the subject begins the s86b5p transformation.\"\nOutput template:\nThe video begins with a shot of [Subject Description]. [Environment Description]. Then, the subject begins the s86b5p transformation.\nExample:\nThe video begins with a scene of a young woman outdoors. She has short, curly dark brown hair and a friendly smile. She is wearing a black polo shirt with colorful floral embroidery. In the background, there is green vegetation and distant mountains. Then, she begins the s86b5p transformation.",
"lora_prompt_default": "Then, the subject begins the s86b5p transformation."
},
"capacity": 1,
"plan": "lora"
}'
|
レスポンスパラメーター request_id 文字列 リクエストの一意の識別子。 output オブジェクト ジョブの詳細。 プロパティ deployed_model 文字列 デプロイされたモデルの一意の識別子。モデルのデプロイステータスの照会やモデルの呼び出しに使用します。 model_name 文字列 モデルの識別子名。 status 文字列 デプロイステータス:
PENDING:デプロイ中。
RUNNING:実行中。
FAILED:デプロイ失敗。
base_model 文字列 使用したベースモデルです。 gmt_create 文字列 デプロイジョブの作成時刻。 gmt_modified 文字列 デプロイジョブの更新時刻。 workspace_id 文字列 Alibaba Cloud Model Studio の API キーに関連付けられたワークスペース ID です。詳細は、「ワークスペース ID の取得」をご参照ください。 charge_type 文字列 課金モードです。 post_paid は従量課金を示します。 creator 文字列 作成者の Alibaba Cloud アカウント ID です。 modifier 文字列 更新者の Alibaba Cloud アカウント ID です。 plan 文字列 デプロイ方式です。 code 文字列 エラーコードです。呼び出しが失敗した場合に返されます。詳細は、以下のエラーコード表をご参照ください。 message 文字列 詳細なエラーメッセージです。呼び出しが失敗した場合に返されます。 | 成功レスポンスの例主要なフィールド:output.deployed_model (デプロイされたモデルの一意の識別子)、output.status (デプロイステータス)。 {
"request_id": "96020b2e-9072-4c8a-9981-xxxxxxxxx",
"output": {
"deployed_model": "wan2.5-i2v-preview-ft-202511111122-xxxx",
"gmt_create": "2025-11-11T17:46:53.294",
"gmt_modified": "2025-11-11T17:46:53.294",
"status": "PENDING",
"model_name": "wan2.5-i2v-preview-ft-202511111122-xxxx",
"base_model": "wan2.5-i2v-preview",
"workspace_id": "llm-xxxxxxxxx",
"charge_type": "post_paid",
"creator": "12xxxxxxx",
"modifier": "12xxxxxxx",
"plan": "lora"
}
}
エラーレスポンスの例{
"code": "InvalidParameter",
"request_id": "BE213CDD-8A5C-59EE-9A67-055EAB0CB59B",
"message": "The model xxx does not exist or is not deployable"
}
|
プロンプトテンプレートの設定
aigc_config.prompt パラメーターの設定方法について説明します。
Based on the content of the image, provide a description for a video. The description must include the phrase "Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, densely falling on and surrounding the subject. As the bills continue to fall, the camera slowly zooms in, and the subject spreads their arms upwards, tilts their head back slightly, with a surprised expression, completely immersed in this wild money rain."
Output template:
The video begins with a shot of [Subject Description]. [Environment Description]. Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, densely falling on and surrounding the subject. As the bills continue to fall, the camera slowly zooms in, and the subject spreads their arms upwards, tilts their head back slightly, with a surprised expression, completely immersed in this wild money rain.
Example:
The video begins with a scene of a young woman on a beach. Her hair is wet, dark brown, curly, and slightly messy. She has a big smile on her face. In the background, there are crashing waves and distant mountains. Then, the s86b5p money rain effect begins, with giant US dollar bills (beige with dark green patterns) showering down like a torrential rain, surrounding her. As the bills continue to fall, the camera slowly zooms in, and she spreads her arms upwards, tilts her head back slightly, with a surprised expression, completely immersed in this wild money rain.
「出力テンプレート」の説明については、「動画のアノテーション:動画のプロンプトを作成する」をご参照ください。
次のステップ
デプロイは非同期操作です。この API を呼び出した後、デプロイの照会と管理 API を使用してデプロイステータスを照会できます。