Audio Projects

AI Music Generator

Changed on

Generate music from a description, with optional custom lyrics or instrumental-only output. Costs 1 credits per requested second. Returns a project ID; poll GET /v1/audio-projects/{id} for status and downloads.

post/v1/ai-music-generator

Request

  • Base URL
    https://api.magichour.ai
  • URL
    https://api.magichour.ai/v1/ai-music-generator
  • Auth
    HTTP bearer

Request body

namestring

Give your audio a custom name for easy identification.

durationinteger required

Requested track duration in seconds, from 15 to 300. Determines credits charged.

Example request

{
  "name": "My Music Generator audio",
  "duration": 120,
  "style": {
    "prompt": "Dreamy synthwave with warm bass and soft vocals",
    "lyrics": "City lights are fading..."
  }
}

Response

Success

idstring required

Unique ID of the audio. Use it with the Get audio Project API to fetch status and downloads.

credits_chargedinteger required

The amount of credits deducted from your account to generate the audio. We charge credits right when the request is made.

If an error occurred while generating the audio, credits will be refunded and this field will be updated to include the refund.

Example response

{
  "id": "cuid-example",
  "credits_charged": 120
}

Changes