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 NameMode
music-video-generatorAudio + reference images to music video

Pricing

Billed per second of output video (= audio length) × resolution:

ResolutionCredits/sec
480p9
720p18

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

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

Input Parameters

FieldTypeRequiredDescription
audio_urlsstring[]YesExactly 1 audio URL
image_urlsstring[]No0-3 reference image URLs; the person in the images appears throughout the video
promptstringNoScene/style description, max 2500 characters, e.g. "A female singer performing with a guitar on a neon-lit stage"
aspect_ratiostringNo16:9 or 9:16; auto-detected from reference images if omitted
resolutionstringNo480p (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-Id for 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 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.