curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": true,
"nsfw_check": true,
"return_last_frame": true
}'
import requests
payload = {
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": True,
"nsfw_check": True,
"return_last_frame": True
}
response = requests.post(
"https://api.apimart.ai/v1/videos/generations",
headers={"Authorization": "Bearer <token>"},
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.json())
const payload = {
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": true,
"nsfw_check": true,
"return_last_frame": true
};
const response = await fetch("https://api.apimart.ai/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example_seedance25flash"
}
]
}
seedance-2-5-flash
Seedance 2.5 Flash 動画生成
テキスト、多様な参照素材、動画編集・延長、開始・終了フレームから、最大30秒の480p / 720p動画を生成します。
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": true,
"nsfw_check": true,
"return_last_frame": true
}'
import requests
payload = {
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": True,
"nsfw_check": True,
"return_last_frame": True
}
response = requests.post(
"https://api.apimart.ai/v1/videos/generations",
headers={"Authorization": "Bearer <token>"},
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.json())
const payload = {
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": true,
"nsfw_check": true,
"return_last_frame": true
};
const response = await fetch("https://api.apimart.ai/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example_seedance25flash"
}
]
}
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": true,
"nsfw_check": true,
"return_last_frame": true
}'
import requests
payload = {
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": True,
"nsfw_check": True,
"return_last_frame": True
}
response = requests.post(
"https://api.apimart.ai/v1/videos/generations",
headers={"Authorization": "Bearer <token>"},
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.json())
const payload = {
"model": "seedance-2-5-flash",
"prompt": "A cinematic shot of a fox walking through a sunlit forest, with a slow tracking camera",
"resolution": "720p",
"size": "16:9",
"duration": 8,
"generate_audio": true,
"nsfw_check": true,
"return_last_frame": true
};
const response = await fetch("https://api.apimart.ai/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_example_seedance25flash"
}
]
}
POST /v1/videos/generations で送信し、data[0].task_id を取得して GET /v1/tasks/{task_id} で結果を確認します。
リクエストパラメータ
seedance-2-5-flash を使用します。別名 doubao-seedance-2-5-flash も利用できます。ドットを含む seedance-2.5-flash は非対応です。動画タスクを送信する前にコンテンツモデレーションを実行するかどうかを指定します。
true:omni-moderation-latestでプロンプトと入力画像を審査falseまたは省略:審査リクエストを行わず、審査コストや遅延を追加しない(デフォルト)
nsfw_content_detected)となり、タスク作成や生成料金の課金は行いません。参照動画と音声は審査対象外です。審査サービスの異常時は送信が続行される場合があります。16:9、4:3、1:1、3:4、9:16、21:9、adaptive(既定値)に対応。別名は aspect_ratio。開始・終了フレーム、編集、延長では adaptive のみ使用できます。整数の秒数
4–30。通常は省略時 5、-1 は自動です。明示的な edit は -1 または省略のみで、省略は -1 として扱い、出力時間は元動画に従います。自動時間では30秒分を仮引き落としし、実際のトークン使用量で精算します。参照画像配列。すべて
reference_image として扱います。image_with_roles と合計で最大10枚。開始・終了フレームには image_with_roles を使用します。各要素は
url と role を含みます。役割は reference_image、first_frame(最大1枚)、last_frame(最大1枚、開始フレームと併用)。image_urls と合計で最大10枚。矛盾する役割を混在させないでください。video_urls / audio_urls がある場合、開始・終了フレームは参照画像として扱われます。draft / draft_task_id は非対応です。リクエストから削除してください。送信すると HTTP 400 になります。ドラフト機能には Seedance 2.5 を使用します。素材の要件
公開アクセス可能なhttp(s) URL、または承認済みの asset:// ID を使用します。出力解像度と入力動画の画素制限は別々に検証されます。
| 素材 | 制限 |
|---|---|
| 画像 | 2つの画像フィールドで合計10枚以下。JPEG / PNG / WebP / BMP / TIFF / GIF / HEIC / HEIF。幅・高さは各300–6000 px、比率0.4–2.5、各30 MB未満。 |
| 動画 | 最大5本。MP4 / MOV、映像 H.264 / H.265、音声 AAC / MP3。各2–30秒、合計30秒以下、各200 MB以下。幅・高さは各300–6000 px、比率0.4–2.5、幅 × 高さ409,600–8,295,044画素、24–60 FPS。 |
| 音声 | 最大5件。WAV / MP3。各2–30秒、合計30秒以下、各15 MB以下。 |
タスクの種類と制約
| モード | 使用方法と制約 |
|---|---|
| テキストから動画 | prompt のみを指定し、参照素材と omni_reference_task_type は省略。 |
| 参照素材から動画 | 参照素材を指定。reference は任意。通常の時間・比率制限は適用されます。 |
| 開始・終了フレーム | image_with_roles を使用。size / aspect_ratio は adaptive のみ。 |
| 動画編集 | edit。4–30秒の元動画が1本以上必要。比率は adaptive、duration は -1 または省略。 |
| 動画延長 | extend。参照動画が1本以上必要。比率は adaptive。 |
auto では素材とプロンプトから種類を判断するため、生成中に制約違反で失敗する場合があります。明示した種類とプロンプトの意図が異なる場合も InvalidParameter.TaskTypeMismatch が発生し得ます。
リクエスト例
マルチモーダル参照
{
"model": "seedance-2-5-flash",
"prompt": "Use the composition of @视频1, the subject in @图片1, and @音频1 as background music",
"image_urls": [
"https://example.com/reference.jpg"
],
"video_urls": [
"https://example.com/reference_8s.mp4"
],
"audio_urls": [
"https://example.com/music_5s.mp3"
],
"omni_reference_task_type": "reference",
"duration": 8,
"size": "16:9"
}
開始・終了フレーム
{
"model": "seedance-2-5-flash",
"prompt": "Smoothly transition from the first frame to the last frame",
"image_with_roles": [
{
"url": "https://example.com/first.jpg",
"role": "first_frame"
},
{
"url": "https://example.com/last.jpg",
"role": "last_frame"
}
],
"size": "adaptive",
"duration": 5
}
動画編集
{
"model": "seedance-2-5-flash",
"prompt": "Edit @视频1: replace the cloudy sky with a clear sunset while preserving the camera movement",
"video_urls": [
"https://example.com/source_10s.mp4"
],
"omni_reference_task_type": "edit",
"size": "adaptive",
"duration": -1,
"output_format": "mov"
}
動画延長
{
"model": "seedance-2-5-flash",
"prompt": "Extend @视频1 forward: continue the camera movement as the subject walks into the forest",
"video_urls": [
"https://example.com/source_10s.mp4"
],
"omni_reference_task_type": "extend",
"size": "adaptive",
"duration": 5
}
非公開素材の利用
実在人物の顔を含む画像・動画は、素材ライブラリで承認後にasset:// を使用します。アップロード時の model も seedance-2-5-flash にします。素材ライブラリ API を参照し、以下の Flash モデル名を使用してください。
curl --request POST \
--url https://api.apimart.ai/v1/seedance2/private-avatar/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "seedance-2-5-flash",
"group": {
"name": "flash-assets"
},
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/reference.jpg",
"name": "reference"
}
]
}'
asset:// ID を取得し、image_urls、image_with_roles[].url、video_urls、audio_urls に指定します。
タスク状態と結果
タスク状態 API をポーリングします。pending / processing は処理中、completed は成功、failed は失敗。動画は data.result.videos[0].url[0] から取得します。url は配列です。
curl --request GET \
--url 'https://api.apimart.ai/v1/tasks/task_example_seedance25flash' \
--header 'Authorization: Bearer <token>'
{
"code": 200,
"data": {
"id": "task_example_seedance25flash",
"status": "completed",
"progress": 100,
"cost": 0.3104,
"credits_cost": 3.104,
"usage": {
"completion_tokens": 38800
},
"result": {
"videos": [
{
"url": [
"https://example.com/generated-video.mp4"
],
"last_frame_url": "https://example.com/generated-last-frame.png"
}
]
}
}
}
| フィールド | 説明 |
|---|---|
data.usage.completion_tokens | 最終精算のトークン数。完了直後の数秒間は未反映の場合があるため、再度取得してください。 |
data.cost | アカウント割引適用後の実請求額(USD)。返却値を使用してください。 |
data.credits_cost | 実際に消費したクレジット。 |
data.result.videos[].url | 動画 URL 配列。速やかにダウンロードして保存してください。 |
data.result.videos[].last_frame_url | return_last_frame: true を指定した成功タスクの終了フレーム URL。 |
data.error.message | 失敗理由。失敗時は data.cost が0となり、仮引き落とし分は返金されます。 |
料金の計算
- 送信時は解像度別の秒単価で仮引き落としします。参照動画がある場合は入力ありの料金区分を使用し、出力時間と参照動画の合計時間を加算します。
- 通常の
duration省略時は出力5秒分、duration: -1またはeditで時間を省略した場合は出力30秒分です。 - 成功後は
data.usage.completion_tokens÷ 1,000,000 × 該当する100万トークン単価にアカウント割引を適用し、差額を返金または追加請求します。参照動画の有無でtoken/token-inputを選択します。最終額はdata.costを確認してください。 - 送信拒否には生成料金がかからず、生成失敗時は仮引き落とし分を返金します。単価と割引は料金ページを参照してください。
よくあるエラー
| 状況 | 対処 |
|---|---|
| HTTP 400:解像度非対応 | 480p / 720p のみ使用し、1080p は指定しないでください。 |
| HTTP 400:素材数超過 | 画像合計10枚、動画5本、音声5件以内にし、時間制限も確認してください。 |
| HTTP 400:ドラフト非対応 | draft / draft_task_id を削除します。 |
| HTTP 400:種類・時間・比率 | omni_reference_task_type、duration、size / aspect_ratio の組み合わせを確認します。 |
HTTP 400:nsfw_content_detected | 審査拒否として処理し、error.message に従って内容を修正します。 |
| モデルが見つからない | seedance-2-5-flash を使用し、seedance-2.5-flash は使用しません。 |
タスク failed | data.error.message を確認し、素材とプロンプトをタスクの種類に合わせます。仮引き落とし分は返金されます。 |