Music Video Generator
Music Video Generator is an AI music video (MV) generation model. Provide a song and up to 3 reference photos to generate a complete music video with precise lip sync, cinematic camera movement, and natural transitions. The AI handles vocal analysis, scene planning, multi-angle shot generation, and final assembly — up to 10 minutes long.
Models
| Model Name | Mode |
|---|---|
music-video-generator | Audio + reference images to music video |
Pricing
Billed per second of output video (= audio length) × resolution:
| Resolution | Credits/sec |
|---|---|
480p | 9 |
720p | 18 |
The audio duration is probed automatically on the server. Minimum billed duration is 5 seconds; maximum is 600 seconds (10 minutes).
Create Task
POST https://api.aivideoapi.ai/v1/videos/generations
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | music-video-generator |
input | object | Yes | Generation parameters |
callback_url | string | No | URL to receive task completion/failure notifications |
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
audio_urls | string[] | Yes | Exactly 1 audio URL |
image_urls | string[] | No | 0-3 reference image URLs; the person in the images appears throughout the video |
prompt | string | No | Scene/style description, max 2500 characters, e.g. "A female singer performing with a guitar on a neon-lit stage" |
aspect_ratio | string | No | 16:9 or 9:16; auto-detected from reference images if omitted |
resolution | string | No | 480p (default) or 720p |
The duration parameter is not supported: the output video length equals the audio length.
Audio constraints: public HTTP(S) URL only; supported formats are MP3, WAV, and M4A (raw ADTS .aac streams are not supported); max length 600 seconds (10 minutes). The server probes the audio duration automatically for billing — if probing fails (URL unreachable or unsupported format), task creation returns a 400 error and no credits are charged.
Reference image tips: clear, front-facing portraits with a visible face work best. If image_urls is omitted, the AI generates a performer based on the detected voice (male/female).
Processing time: a 1-minute song typically takes 3-6 minutes; longer audio scales proportionally.
Examples
Audio only
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "music-video-generator",
"callback_url": "https://your-server.com/webhook",
"input": {
"audio_urls": ["https://example.com/song.mp3"]
}
}'
Audio + reference images + scene description
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "music-video-generator",
"callback_url": "https://your-server.com/webhook",
"input": {
"audio_urls": ["https://example.com/song.mp3"],
"image_urls": [
"https://example.com/singer-front.jpg",
"https://example.com/singer-side.jpg"
],
"prompt": "A rock singer performing passionately on a neon-lit stage",
"aspect_ratio": "9:16",
"resolution": "720p"
}
}'
Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24"
}
}
Query Task
curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
-H "Authorization: Bearer sk-your-api-key"
Status transitions: pending -> processing -> completed or failed.
If the task fails, pre-charged credits are refunded automatically.
Callback
Pass callback_url when creating the task and the system will POST to your URL when the task completes or fails. See Callback Guide for request headers and the retry strategy.
On completion
{
"id": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24",
"status": "completed",
"model": "music-video-generator",
"created_at": 1781136227,
"completed_at": 1781136589,
"output": {
"urls": [
"https://file.aivideoapi.ai/videos/2026/06/11/abc.mp4"
],
"metadata": {
"model": "music-video-generator",
"has_nsfw_contents": [false]
}
}
}
On failure
{
"id": "57c8772c-f834-46f3-9b7d-81f92e104050",
"status": "failed",
"model": "music-video-generator",
"created_at": 1781136227,
"error": {
"code": "upstream_error",
"message": "Video generation failed"
}
}
Important Notes
- Return a 2xx status code as soon as possible after receiving the callback (within 3 seconds recommended). Non-2xx responses or timeouts (10 seconds) trigger retries — up to 3 attempts, spaced 3 and 10 minutes apart.
- Use
X-Task-Idfor idempotent handling on your side to avoid duplicate records for the same task. - The authoritative task state is always
GET /v1/tasks/{taskId}; if all 3 callbacks fail you can still poll as a fallback.
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.