> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Seedance 2.5 Flash 動画生成

> テキスト、多様な参照素材、動画編集・延長、開始・終了フレームから、最大30秒の480p / 720p動画を生成します。

```bash cURL theme={null}
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
}'
```

```python Python theme={null}
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())
```

```javascript JavaScript theme={null}
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());
```

```json 200 theme={null}
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_example_seedance25flash"
    }
  ]
}
```

`POST /v1/videos/generations` で送信し、`data[0].task_id` を取得して `GET /v1/tasks/{task_id}` で結果を確認します。

**Authorization** `string` *required*

`Authorization: Bearer <token>` を使用します。`<token>` は APIMart API キーです。

## リクエストパラメータ

**model** `string` *required*

`seedance-2-5-flash` を使用します。別名 `doubao-seedance-2-5-flash` も利用できます。ドットを含む `seedance-2.5-flash` は非対応です。

**nsfw\_check** `boolean` (default: false)

動画タスクを送信する前にコンテンツモデレーションを実行するかどうかを指定します。

* `true`：`omni-moderation-latest` でプロンプトと入力画像を審査
* `false` または省略：審査リクエストを行わず、審査コストや遅延を追加しない（デフォルト）

検出時は HTTP 400（`nsfw_content_detected`）となり、タスク作成や生成料金の課金は行いません。参照動画と音声は審査対象外です。審査サービスの異常時は送信が続行される場合があります。

**prompt** `string` *required*

必須のプロンプト。参照素材は `@图片1` / `@视频1` / `@音频1` で指定します。番号は1から始まり、各素材配列の順序に対応します。

**resolution** `string` (default: 720p)

`480p` / `720p` のみ。既定値は `720p`。`1080p`、`2k`、`4k` などは送信時に HTTP 400 になります。

**size** `string` (default: adaptive)

`16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9`、`adaptive`（既定値）に対応。別名は `aspect_ratio`。開始・終了フレーム、編集、延長では `adaptive` のみ使用できます。

**duration** `integer`

整数の秒数 `4`–`30`。通常は省略時 `5`、`-1` は自動です。明示的な `edit` は `-1` または省略のみで、省略は `-1` として扱い、出力時間は元動画に従います。自動時間では30秒分を仮引き落としし、実際のトークン使用量で精算します。

**generate\_audio** `boolean` (default: true)

音声を生成するかどうか。既定値は `true`、別名は `audio`。入力の参照音声 `audio_urls` とは別の設定です。

**watermark** `boolean` (default: false)

AI生成の透かしを付けるかどうか。既定値は `false`。

**seed** `integer`

任意の乱数シード。同じ値でも完全に同一の結果は保証されません。

**output\_format** `string` (default: mp4)

出力形式は `mp4`（既定値）または `mov`。

**omni\_reference\_task\_type** `string` (default: auto)

`auto`（既定値）、`reference`、`edit`、`extend` に対応。参照素材があるタスクのみで使用します。種類を明示すると送信時に下表の制約を検証します。

**image\_urls** `string[]`

参照画像配列。すべて `reference_image` として扱います。`image_with_roles` と合計で最大10枚。開始・終了フレームには `image_with_roles` を使用します。

**image\_with\_roles** `object[]`

各要素は `url` と `role` を含みます。役割は `reference_image`、`first_frame`（最大1枚）、`last_frame`（最大1枚、開始フレームと併用）。`image_urls` と合計で最大10枚。矛盾する役割を混在させないでください。`video_urls` / `audio_urls` がある場合、開始・終了フレームは参照画像として扱われます。

**video\_urls** `string[]`

最大5本、各2–30秒、合計30秒以内。編集元の動画は4–30秒である必要があります。

**audio\_urls** `string[]`

最大5件、各2–30秒、合計30秒以内。音声のみの参照に対応し、画像や動画は必須ではありません。

**return\_last\_frame** `boolean` (default: false)

`true` の場合、成功後に終了フレーム画像を `data.result.videos[].last_frame_url` で返します。

**web\_search** `boolean` (default: false)

モデルが必要に応じてウェブ検索することを許可します。既定値は `false`。

**tools** `object[]`

任意のツール一覧。例：ウェブ検索用の `[{"type":"web_search"}]`。

> [!WARNING]
>
> `draft` / `draft_task_id` は非対応です。リクエストから削除してください。送信すると HTTP 400 になります。ドラフト機能には [Seedance 2.5](https://docs.apimart.ai/ja/api-reference/videos/seedance-2-5/generation.md) を使用します。

## 素材の要件

公開アクセス可能な `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`。 |

明示した種類や制約が不正な場合、タスク作成・課金前に HTTP 400 を返します。`auto` では素材とプロンプトから種類を判断するため、生成中に制約違反で失敗する場合があります。明示した種類とプロンプトの意図が異なる場合も `InvalidParameter.TaskTypeMismatch` が発生し得ます。

## リクエスト例

### マルチモーダル参照

```json theme={null}
{
  "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"
}
```

### 開始・終了フレーム

```json theme={null}
{
  "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
}
```

### 動画編集

```json theme={null}
{
  "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"
}
```

### 動画延長

```json theme={null}
{
  "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](https://docs.apimart.ai/ja/api-reference/videos/seedance-2-0/private-avatar.md) を参照し、以下の Flash モデル名を使用してください。

```bash theme={null}
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"
    }
  ]
}'
```

統一タスク API で素材の審査を確認します。承認後、素材一覧から `asset://` ID を取得し、`image_urls`、`image_with_roles[].url`、`video_urls`、`audio_urls` に指定します。

## タスク状態と結果

[タスク状態 API](https://docs.apimart.ai/ja/api-reference/tasks/status.md) をポーリングします。`pending` / `processing` は処理中、`completed` は成功、`failed` は失敗。動画は `data.result.videos[0].url[0]` から取得します。`url` は配列です。

```bash theme={null}
curl --request GET \
  --url 'https://api.apimart.ai/v1/tasks/task_example_seedance25flash' \
  --header 'Authorization: Bearer <token>'
```

```json theme={null}
{
  "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` を確認してください。
* 送信拒否には生成料金がかからず、生成失敗時は仮引き落とし分を返金します。単価と割引は[料金ページ](https://apimart.ai/pricing)を参照してください。

## よくあるエラー

| 状況 | 対処 |
| - | - |
| 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` を確認し、素材とプロンプトをタスクの種類に合わせます。仮引き落とし分は返金されます。 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.