> ## 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 Video Generation

> Generate up to 30 seconds of 480p / 720p video from text, multimodal references, editing, extension, or first and last frames.

```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"
    }
  ]
}
```

Submit with `POST /v1/videos/generations`, read `data[0].task_id`, then poll `GET /v1/tasks/{task_id}`.

**Authorization** `string` *required*

Use `Authorization: Bearer <token>`, where `<token>` is your APIMart API key.

## Request parameters

**model** `string` *required*

Use `seedance-2-5-flash`. The alias `doubao-seedance-2-5-flash` is also accepted. The dotted name `seedance-2.5-flash` is not supported.

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

Whether to run content moderation before submitting the video task.

* `true`: use `omni-moderation-latest` to review prompts and input images
* `false` or omitted: do not send a moderation request, adding no moderation cost or latency (default)

A match returns HTTP 400 (`nsfw_content_detected`) without creating a task or charging for generation. Reference video/audio are not reviewed. Requests may proceed if the moderation service fails.

**prompt** `string` *required*

Required prompt. Refer to media with `@图片1` / `@视频1` / `@音频1`; indices start at 1 and follow the order within each media array.

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

Only `480p` / `720p`; default `720p`. Values such as `1080p`, `2k`, or `4k` return HTTP 400 at submission.

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

Accepts `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `21:9`, and `adaptive` (default). Alias: `aspect_ratio`. First/last-frame, edit, and extend tasks require `adaptive`.

**duration** `integer`

Integer seconds `4`–`30`; ordinary requests default to `5`. Use `-1` for automatic duration. Explicit `edit` only accepts `-1` or omission; omission becomes `-1` and output duration follows the source. Automatic duration reserves 30 seconds, then settles on actual token usage.

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

Generate audio; defaults to `true`. Alias: `audio`. This controls output sound, separately from reference input `audio_urls`.

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

Add an AI-generated watermark; default `false`.

**seed** `integer`

Optional random seed. Reusing a seed does not guarantee identical output.

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

Output container: `mp4` (default) or `mov`.

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

Accepts `auto` (default), `reference`, `edit`, or `extend`; only for requests with reference media. Explicit types trigger submission-time checks described below.

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

Reference image array, all treated as `reference_image`. At most 10 images combined with `image_with_roles`. Use `image_with_roles` for first and last frames.

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

Each item has `url` and `role`. Roles: `reference_image`, `first_frame` (at most 1), or `last_frame` (at most 1, paired with a first frame). At most 10 images combined with `image_urls`; avoid conflicting roles. When `video_urls` / `audio_urls` are present, first/last frames become reference images for the multimodal task.

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

At most 5 reference videos, 2–30 seconds each and at most 30 seconds combined. Source videos for editing must be 4–30 seconds.

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

At most 5 audio references, 2–30 seconds each and at most 30 seconds combined. Audio-only reference is supported; images or videos are not required.

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

Set `true` to return a last-frame image after success at `data.result.videos[].last_frame_url`.

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

Allow the model to search the web as needed; default `false`.

**tools** `object[]`

Optional tools, for example `[{"type":"web_search"}]` for web search.

> [!WARNING]
>
> `draft` / `draft_task_id` are not supported; remove them from the request. Draft fields return HTTP 400 at submission. Use [Seedance 2.5](https://docs.apimart.ai/en/api-reference/videos/seedance-2-5/generation.md) for draft mode.

## Media requirements

Use publicly accessible `http(s)` URLs or approved `asset://` IDs. Output resolution and input video pixel limits are validated separately.

| Media | Limits |
| - | - |
| Images | ≤10 across both image fields; JPEG / PNG / WebP / BMP / TIFF / GIF / HEIC / HEIF; width and height each 300–6000 px; aspect ratio 0.4–2.5; `<30 MB` each. |
| Videos | ≤5; MP4 / MOV with H.264 / H.265 video and AAC / MP3 audio; 2–30 seconds each, ≤30 seconds combined; ≤200 MB each; width and height each 300–6000 px, aspect ratio 0.4–2.5, width × height 409,600–8,295,044 pixels, 24–60 FPS. |
| Audio | ≤5; WAV / MP3; 2–30 seconds each, ≤30 seconds combined; ≤15 MB each. |

## Task types and constraints

| Mode | Usage and constraints |
| - | - |
| Text to video | Provide `prompt` without reference media; omit `omni_reference_task_type`. |
| Reference to video | Provide reference media; `reference` is optional. Normal duration and aspect-ratio limits still apply. |
| First / last frame | Use `image_with_roles`; `size` / `aspect_ratio` must be `adaptive`. |
| Video editing | `edit`; at least 1 source video of 4–30 seconds; aspect ratio must be `adaptive`, and `duration` must be `-1` or omitted. |
| Video extension | `extend`; at least 1 reference video; aspect ratio must be `adaptive`. |

Invalid explicit types or constraints return HTTP 400 before task creation or charging. With `auto`, the model infers the task from media and prompt, so type constraints may fail asynchronously. Even an explicit type can fail with `InvalidParameter.TaskTypeMismatch` if it conflicts with the prompt.

## Request examples

### Multimodal reference

```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"
}
```

### First and last frames

```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
}
```

### Video editing

```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"
}
```

### Video extension

```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
}
```

## Private media assets

Submit reference images or videos containing real human faces to the asset library for approval before using `asset://`. Set the upload `model` to `seedance-2-5-flash` as well. See the [asset library API](https://docs.apimart.ai/en/api-reference/videos/seedance-2-0/private-avatar.md) and use the Flash model name below.

```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"
    }
  ]
}'
```

Poll the asset review task through the unified task API. Once approved, obtain the `asset://` ID from the asset list and use it in `image_urls`, `image_with_roles[].url`, `video_urls`, or `audio_urls`.

## Task status and results

Poll the [task status API](https://docs.apimart.ai/en/api-reference/tasks/status.md). `pending` / `processing` are in progress, `completed` means success, and `failed` means failure. Read the video at `data.result.videos[0].url[0]`; `url` is an array.

```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"
        }
      ]
    }
  }
}
```

| Field | Meaning |
| - | - |
| `data.usage.completion_tokens` | Tokens used for final settlement. This may be absent for a few seconds after completion; poll again. |
| `data.cost` | Actual charge in USD after account discounts; use the returned value. |
| `data.credits_cost` | Credits actually charged. |
| `data.result.videos[].url` | Video URL array; download and save promptly. |
| `data.result.videos[].last_frame_url` | Last-frame URL, present only after success when `return_last_frame: true` was requested. |
| `data.error.message` | Failure reason. Failed tasks have `data.cost: 0` and the reserved amount is refunded. |

## Billing

* Submission reserves an amount using the per-second rate for the resolution. Reference-video requests use the input tier, with output duration plus total reference-video duration.
* Ordinary requests without `duration` reserve 5 seconds of output. `duration: -1`, or `edit` with omitted duration, reserves 30 seconds of output.
* Successful tasks settle using `data.usage.completion_tokens`: tokens ÷ 1,000,000 × the applicable rate per million tokens, with account discounts. The difference from the reservation is refunded or charged. Reference-video presence selects `token` or `token-input`; `data.cost` is the final charge.
* Rejected submissions incur no generation charge. Failed generation refunds the reserved amount. See the [pricing page](https://apimart.ai/pricing) for rates and account discounts.

## Common errors

| Scenario | Action |
| - | - |
| HTTP 400: unsupported resolution | Use only `480p` / `720p`, not `1080p`. |
| HTTP 400: too many references | At most 10 images combined, 5 videos, and 5 audio clips; also check duration limits. |
| HTTP 400: draft unsupported | Remove `draft` / `draft_task_id`. |
| HTTP 400: task type, duration, or ratio | Check the combination of `omni_reference_task_type`, `duration`, and `size` / `aspect_ratio`. |
| HTTP 400: `nsfw_content_detected` | Treat as a moderation rejection, read `error.message`, and adjust the content. |
| Model not found | Use `seedance-2-5-flash`, not the dotted `seedance-2.5-flash`. |
| Task `failed` | Read `data.error.message`; check media and prompt against the task type. The reservation is refunded. |


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