Seedance 2.5 Flash
Generate 480p or 720p video with model doubao-seedance-2.5-flash using text, reference media, or first and last frames. Try it in the Playground.
Create a video
curl https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2.5-flash",
"input": {
"prompt": "A happy pony gallops across a meadow",
"generate_audio": true,
"aspect_ratio": "16:9",
"duration": 5,
"resolution": "480p",
"watermark": false,
"return_last_frame": true
},
"callback_url": "https://example.com/webhooks/video"
}'
An accepted request returns HTTP 200. Save data.taskId to query the task or match a callback to this request.
{
"code": 200,
"msg": "success",
"data": { "taskId": "7d89c51e-9430-410e-909e-df347131ebaa" }
}
Inputs
| Field | Accepted values |
|---|---|
prompt | Text description. Supply a prompt or at least one reference. Audio-only input is supported. |
generation_type | omni_reference (default) or first_and_last_frames. Frame mode takes one or two images, uses adaptive ratio and excludes video and audio references. |
image_urls, video_urls, audio_urls | Up to 10 images, 5 videos and 5 audio clips. Videos can total up to 30 seconds, and audio clips can total up to 30 seconds. Use accessible media URLs or your platform asset references. |
omni_reference_task_type | In reference mode, choose auto, reference, edit or extend. Editing and extending require a video and the adaptive ratio. Editing uses duration: -1 and a 4–30 second source video. |
duration | 4–30 whole seconds, or -1 for automatic output length. Defaults to 5 seconds for generation. |
resolution | 480p or 720p (default). |
aspect_ratio | adaptive (default), 16:9, 4:3, 1:1, 3:4, 9:16 or 21:9. |
generate_audio, watermark | Synchronized audio defaults to true, watermark defaults to false. |
seed | Optional JSON integer from -1 through 2147483647. Use -1 for a random seed or a fixed value such as 0 to reuse the seed. Omit the field to use the model default. Strings, fractions and null are invalid. The seed does not affect pricing. |
output_format | Choose mp4 (default) or mov. |
return_last_frame | Boolean, defaults to false. Set input.return_last_frame to true to request an image of the generated video's final frame. |
web_search | Boolean, defaults to false. |
priority, execution_expires_after | Queue priority from 0 through 9 (default 0). Task expiry from 3600 through 259200 seconds (default 172800). |
safety_identifier | Optional stable end-user identifier, 1–64 printable ASCII characters. |
Draft previews and finalization from a Draft ID are available on Seedance 2.5 only.
Pricing
| Resolution | Without video input (credits/s) | With video input (credits/s) |
|---|---|---|
| 480p | 17.37 | 11.58 |
| 720p | 39.05 | 26.03 |
Without a reference video, multiply output seconds by the rate. With video input, add the detected duration of all input videos to the output seconds, then multiply by the video-input rate. Images, input audio, and generated audio do not change the pricing tier. Charges are rounded to two decimal places.
The 480p example above costs 86.85 credits at standard pricing. Adding a 5-second reference video brings the 480p total to 115.80 credits. At 720p, 5 seconds of output costs 195.25 credits without a reference video, 260.30 credits with a 5-second reference video, or 408.67 credits with a 10.7-second reference video.
To get an account-adjusted quote before submitting, send the same model and input to POST /v1/estimate. Automatic duration reserves up to 30 output seconds plus any input video seconds. On success, the final charge uses the actual output length and releases the unused reservation. If the output duration cannot be determined, the reservation is retained. The platform refunds the reservation for confirmed failures or expirations. If the submission outcome is unknown, the task keeps its reservation while the platform reconciles it.
Query a task
Call GET /v1/tasks/{taskId} with a bearer API key for the account that created the task. Timestamps are Unix seconds.
curl https://api.aivideoapi.ai/v1/tasks/7d89c51e-9430-410e-909e-df347131ebaa \
-H "Authorization: Bearer $API_KEY"
Processing (HTTP 200)
Continue polling while status is pending or processing. A pending task includes estimated_seconds. Once processing starts, progress can be null. In this example, credits_consumed is zero because the charge has yet to settle. The reservation may still be held.
{
"id": "7d89c51e-9430-410e-909e-df347131ebaa",
"status": "processing",
"model": "doubao-seedance-2.5-flash",
"credits_consumed": 0,
"created_at": 1794819600,
"progress": null
}
Completed (HTTP 200)
Read the generated video URL from output.urls[0]. If you requested the last frame and an image is available, its URL is in output.last_frame_url. The image is a watermark-free JPEG with the same dimensions as the video. You can use it as the first frame of your next video. If that field is absent, use the completed video on its own.
Both media URLs point directly to the original source and can expire. Download any files you need to keep promptly, as the API does not guarantee a fixed lifetime for either URL.
credits_consumed is the final charge. This five-second 480p video cost 86.85 credits. The response can also include usage when available.
{
"id": "7d89c51e-9430-410e-909e-df347131ebaa",
"status": "completed",
"model": "doubao-seedance-2.5-flash",
"credits_consumed": 86.85,
"created_at": 1794819600,
"completed_at": 1794819660,
"output": {
"urls": ["https://media.example.com/outputs/pony.mp4"],
"last_frame_url": "https://media.example.com/outputs/pony-last-frame.jpg",
"metadata": {
"duration": 5,
"ratio": "16:9",
"resolution": "480p",
"generate_audio": true,
"output_format": "mp4"
}
}
}
For an archived or cleared task, status can remain completed with output: null. A cleared task can also include payload_cleared_at.
Failed generation (HTTP 200)
A successful lookup can return status: "failed". Stop polling and read error.message for the public failure reason. This separate task failed with zero credits consumed.
{
"id": "57c8772c-f834-46f3-9b7d-81f92e104050",
"status": "failed",
"model": "doubao-seedance-2.5-flash",
"credits_consumed": 0,
"created_at": 1794819600,
"error": { "code": "upstream_error", "message": "Video generation failed" }
}
Task not found (HTTP 404)
An unknown ID or an ID owned by another account returns HTTP 404. Check the saved task ID and the account associated with your key.
{
"error": {
"code": "task_not_found",
"message": "Task not found.",
"type": "invalid_request_error"
}
}
A missing, invalid or inactive bearer key returns HTTP 401 (invalid_api_key). An IP address outside the key's allowlist returns HTTP 403 (ip_not_allowed). For HTTP 503 (service_unavailable), retry the same task ID later.
Receive a callback
Set the optional top-level callback_url in the creation request to a public HTTP or HTTPS endpoint you control. The platform sends an unsigned JSON POST when the task reaches a terminal state. To verify the result, query the task using the ID you saved at creation and your own API key.
Successful callback request
Read the video URL from output.urls[0] in the callback body. When the requested last frame is available, output.last_frame_url contains its image URL, just as in the task query.
POST /webhooks/video HTTP/1.1
Host: example.com
Content-Type: application/json
X-Timestamp: 1794819661
X-Task-Id: 7d89c51e-9430-410e-909e-df347131ebaa
X-Event: task.completed
X-Event-ID: 7d89c51e-9430-410e-909e-df347131ebaa:task.completed
{
"id": "7d89c51e-9430-410e-909e-df347131ebaa",
"status": "completed",
"model": "doubao-seedance-2.5-flash",
"credits_consumed": 86.85,
"created_at": 1794819600,
"completed_at": 1794819660,
"output": {
"urls": ["https://media.example.com/outputs/pony.mp4"],
"last_frame_url": "https://media.example.com/outputs/pony-last-frame.jpg",
"metadata": {
"duration": 5,
"ratio": "16:9",
"resolution": "480p",
"generate_audio": true,
"output_format": "mp4"
}
}
}
Failed callback request
POST /webhooks/video HTTP/1.1
Host: example.com
Content-Type: application/json
X-Timestamp: 1794819630
X-Task-Id: 57c8772c-f834-46f3-9b7d-81f92e104050
X-Event: task.failed
X-Event-ID: 57c8772c-f834-46f3-9b7d-81f92e104050:task.failed
{
"id": "57c8772c-f834-46f3-9b7d-81f92e104050",
"status": "failed",
"model": "doubao-seedance-2.5-flash",
"credits_consumed": 0,
"created_at": 1794819600,
"error": { "code": "upstream_error", "message": "Video generation failed" }
}
If a queued task is successfully cancelled, the event is also task.failed, with status: "cancelled" and no error field.
Use X-Event-ID to process each event once across retries. Return an HTTP 2xx response within 10 seconds to acknowledge delivery. A timeout or unsuccessful delivery can trigger up to two retries, scheduled 3 minutes after the first failure and 10 minutes after the second. There are at most three attempts in total.
Error Codes
When a request fails, the API returns a JSON error response:
{
"error": {
"code": "insufficient_credits",
"message": "Your credit balance is too low. Please top up.",
"type": "billing_error"
}
}
Error Reference
| HTTP Status | Code | Type | Description |
|---|---|---|---|
| 400 | invalid_request | invalid_request_error | Missing or invalid parameters |
| 401 | invalid_api_key | authentication_error | API key is invalid, disabled, or deleted |
| 402 | insufficient_credits | billing_error | Credit balance too low, please top up |
| 403 | ip_not_allowed | permission_error | Request IP not in the key's allowlist |
| 404 | model_not_found | invalid_request_error | Model does not exist or is inactive |
| 404 | task_not_found | invalid_request_error | Task ID does not exist |
| 429 | rate_limit_exceeded | rate_limit_error | Too many requests, please slow down |
| 429 | spend_limit_exceeded | billing_error | Key spend limit reached (hourly/daily/total) |
| 500 | internal_error | api_error | Unexpected server error |
| 503 | upstream_error | upstream_error | Upstream AI provider returned an error |
Common Scenarios
invalid_request (400)
Returned when required fields are missing or invalid.
{
"error": {
"code": "invalid_request",
"message": "'model' is required.",
"type": "invalid_request_error"
}
}
insufficient_credits (402)
Your balance is too low. Check your balance with GET /v1/credits and top up in Dashboard > Billing.
invalid_api_key (401)
Possible causes:
- The key does not start with
sk- - The key has been disabled or deleted
- The user account has been banned
upstream_error (503)
The upstream AI provider returned an error. This may happen when:
- The input contains sensitive or prohibited content
- The provider is temporarily unavailable
- The request parameters are not supported by the provider
Credits are automatically refunded when a task fails due to upstream errors.