Music to Video Pro
Music to Video Pro generates a music video from a source music URL. You can add reference images, a visual prompt, subtitles, output ratio, resolution, and lyrics lip sync settings.
The existing music-video-generator model remains available separately.
Models
| Model Name | Mode |
|---|---|
music-to-video-pro | Music URL to video with optional references and lip sync |
Pricing
Pricing is fixed for this model.
credits = 2106
Every request costs 2106 credits. Failed tasks are refunded automatically.
Create Task
POST https://api.aivideoapi.ai/v1/videos/generations
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | music-to-video-pro |
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 source URL. Public audio/video files, YouTube links, or Spotify links may be used depending on source availability. |
image_urls | string[] | No | 0-4 reference image URLs used as visual references. |
prompt | string | No | Optional creative brief for the visual storyline, max 2500 characters. |
aspect_ratio | string | No | 9:16 default, or 16:9, 1:1, 4:5, auto. |
resolution | string | No | 720p default, or 1080p, 4k. |
subtitle_enabled | boolean | No | Whether to burn subtitles/captions into the video. Default true. |
subtitle_color | string | No | Hex color such as #ffffff. Applied as a best-effort custom subtitle color. |
subtitle_position | string | No | bottom default, or top, middle. |
lipsync_enabled | boolean | No | Enable lyrics lip sync. Default false. |
lipsync_frequency | number | No | Fraction of video duration with lip-synced shots, 0 to 1, default 0.3. |
output_count is not supported for this model.
Estimate Cost
curl -X POST https://api.aivideoapi.ai/v1/estimate \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "music-to-video-pro",
"input": {
"audio_urls": ["https://www.youtube.com/watch?v=ip30oRP9BP0"],
"resolution": "720p",
"aspect_ratio": "9:16"
}
}'
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-to-video-pro",
"callback_url": "https://your-server.com/webhook",
"input": {
"audio_urls": ["https://www.youtube.com/watch?v=ip30oRP9BP0"]
}
}'
Full Request
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-to-video-pro",
"callback_url": "https://your-server.com/webhook",
"input": {
"audio_urls": ["https://example.com/song.mp3"],
"image_urls": ["https://example.com/singer.jpg"],
"prompt": "A neon rooftop performance during a rainy night",
"aspect_ratio": "16:9",
"resolution": "1080p",
"subtitle_enabled": true,
"subtitle_color": "#ffcc00",
"lipsync_enabled": true,
"lipsync_frequency": 0.3
}
}'
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.
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.