API Endpoints

Generate Music

POST/v2/generate

Generate Music API

Default Music Generate endpoint for AI music creation. Supports both inspiration mode and custom mode.

POSThttps://udioapi.pro/api/v2/generate

tips

Default Music Generate endpoint: Use this route for the standard music generation flow. MiniMax is an integrated provider with its own endpoint, not the default model for this API.

Two Generation Modes:

  • Inspiration Mode: Use gpt_description_prompt to generate music from a text description
  • Custom Mode: Use prompt, style, and title for detailed control

Model Selection: Choose from chirp-v4-0, chirp-v4-5, chirp-v4-5-plus, chirp-v5, or chirp-v5-5 for different quality levels. See Credit Consumption by Model for model details and credit costs.

Next step: After calling this endpoint, use the Music Generate Task Status API to poll task progress and retrieve audio URLs.

requestHeaders

namerequireddescription
AuthorizationyesBearer token for authentication
Content-Typeyesapplication/json

requestBody

Request body supports Inspiration Mode or Custom Mode

Inspiration Mode

Generate music from a text description

paramNameparamTyperequireddescriptionexample
gpt_description_promptstringyesText description of the music you want to generateA upbeat pop song about summer vacation with catchy melody

Custom Mode

Generate music with custom lyrics, style, and title

paramNameparamTyperequireddescriptionexample
promptstringyesCustom lyrics or detailed promptVerse 1: Walking down the street, feeling so free...
stylestringnoMusical style or genrepop, upbeat, electronic, 120 bpm
titlestringnoSong titleSummer Dreams
tagsstringnoNegative tags to avoidsad, slow

commonParams

paramNameparamTyperequireddescriptionexample
modelstringnoAI model to use.chirp-v5-5
make_instrumentalbooleannoGenerate instrumental music without vocalsfalse
genderstringnoVocal gender preferencefemale
style_weightnumbernoStrength of adherence to style0.65
weirdness_constraintnumbernoControls creative deviation0.65
audio_weightnumbernoBalance weight for audio features0.65

responses

json
{
  "code": 200,
  "message": "success",
  "workId": "gen2abc123def456bksv",
  "data": {
    "task_id": "gen2abc123def456bksv"
  }
}
json
{
  "code": 400,
  "message": "No body provided"
}
json
{
  "code": 401,
  "message": "No API key provided in Authorization header"
}
json
{
  "code": 500,
  "message": "Internal Server Error",
  "data": {
    "task_id": "gen2abc123def456bksv"
  },
  "workId": "gen2abc123def456bksv"
}

codeExamples

curl
curl -X POST "https://udioapi.pro/api/v2/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chirp-v4-5",
    "prompt": "Verse 1: Walking down the street, feeling so free\nChorus: Summer dreams are calling me",
    "style": "pop, upbeat, electronic, 120 bpm",
    "title": "Summer Dreams",
    "make_instrumental": false,
    "gender": "female",
    "style_weight": 0.65,
    "weirdness_constraint": 0.65,
    "audio_weight": 0.65
  }'
javascript
const response = await fetch('https://udioapi.pro/api/v2/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'chirp-v4-5',
    gpt_description_prompt: 'A upbeat pop song about summer vacation with catchy melody',
    make_instrumental: false,
    gender: 'female',
    style_weight: 0.65,
    weirdness_constraint: 0.65,
    audio_weight: 0.65
  })
});

const data = await response.json();
console.log(data);
javascript
const response = await fetch('https://udioapi.pro/api/v2/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'chirp-v4-5',
    prompt: 'Verse 1: Walking down the street, feeling so free\nChorus: Summer dreams are calling me',
    style: 'pop, upbeat, electronic, 120 bpm',
    title: 'Summer Dreams',
    make_instrumental: false,
    gender: 'female',
    style_weight: 0.65,
    weirdness_constraint: 0.65,
    audio_weight: 0.65
  })
});

const data = await response.json();
console.log(data);