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 NameMode
music-to-video-proMusic 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

FieldTypeRequiredDescription
modelstringYesmusic-to-video-pro
inputobjectYesGeneration parameters
callback_urlstringNoURL to receive task completion/failure notifications

Input Parameters

FieldTypeRequiredDescription
audio_urlsstring[]YesExactly 1 source URL. Public audio/video files, YouTube links, or Spotify links may be used depending on source availability.
image_urlsstring[]No0-4 reference image URLs used as visual references.
promptstringNoOptional creative brief for the visual storyline, max 2500 characters.
aspect_ratiostringNo9:16 default, or 16:9, 1:1, 4:5, auto.
resolutionstringNo720p default, or 1080p, 4k.
subtitle_enabledbooleanNoWhether to burn subtitles/captions into the video. Default true.
subtitle_colorstringNoHex color such as #ffffff. Applied as a best-effort custom subtitle color.
subtitle_positionstringNobottom default, or top, middle.
lipsync_enabledbooleanNoEnable lyrics lip sync. Default false.
lipsync_frequencynumberNoFraction 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 StatusCodeTypeDescription
400invalid_requestinvalid_request_errorMissing or invalid parameters
401invalid_api_keyauthentication_errorAPI key is invalid, disabled, or deleted
402insufficient_creditsbilling_errorCredit balance too low, please top up
403ip_not_allowedpermission_errorRequest IP not in the key's allowlist
404model_not_foundinvalid_request_errorModel does not exist or is inactive
404task_not_foundinvalid_request_errorTask ID does not exist
429rate_limit_exceededrate_limit_errorToo many requests, please slow down
429spend_limit_exceededbilling_errorKey spend limit reached (hourly/daily/total)
500internal_errorapi_errorUnexpected server error
503upstream_errorupstream_errorUpstream 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.