Long Video
Long Video creates a connected 4–180 second video from one prompt. Choose HappyHorse or Seedance as the generation provider and track the asynchronous task through the standard task endpoint or a callback.
This integration supports creating new videos only. Video extension, task listing, manual composition, cancellation, and cost estimation are not available.
Model
| Model | Description |
|---|---|
long-video | Long-form prompt-to-video generation with optional global image references |
Pricing
Completed tasks are billed by requested duration, resolution, and provider.
| Provider | Resolution | Credits per second |
|---|---|---|
| HappyHorse | 720p | 27.5 |
| HappyHorse | 1080p | 47.2 |
| Seedance | 480p | 18 |
| Seedance | 720p | 38 |
| Seedance | 1080p | 95 |
Credits are pre-charged when the task is created and fully refunded if generation fails. Long Video does not support the /v1/estimate endpoint.
Create a task
POST https://api.aivideoapi.ai/v1/videos/generations
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be long-video |
input | object | Yes | Generation parameters |
callback_url | string | No | Receives the standard task completion or failure callback |
Input parameters
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Video description, 1–2500 characters |
duration | integer | Yes | Output duration from 4 to 180 seconds |
provider | string | No | happyhorse (default) or seedance |
resolution | string | No | Default 720p; HappyHorse supports 720p/1080p, Seedance supports 480p/720p/1080p |
aspect_ratio | string | No | Default 16:9; supports 16:9, 9:16, 1:1, 4:3, 3:4 |
continuity_mode | string | No | consistent (default) or seamless |
style | string | No | Optional style direction, up to 500 characters |
image_urls | string[] | No | Up to five global reference images; only valid in consistent mode |
native_audio_continuity | boolean | No | Seedance only; default false |
seed | integer | No | Random seed from 0 to 2147483647; default 42 |
Example
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "long-video",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "A traveler follows a river from the mountains to a coastal city",
"duration": 60,
"provider": "seedance",
"resolution": "720p",
"aspect_ratio": "16:9",
"continuity_mode": "consistent",
"image_urls": ["https://example.com/character.jpg"],
"native_audio_continuity": true
}
}'
Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24"
}
}
Query the task
curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
-H "Authorization: Bearer sk-your-api-key"
The task moves from pending to processing, then to completed or failed. A completed task returns the final video in output.urls.
Long Video tasks cannot be canceled through the task API.
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.