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
nameAuthorizationrequiredyesdescriptionBearer token for authentication
nameContent-Typerequiredyesdescriptionapplication/json

requestBody

Request body supports Inspiration Mode or Custom Mode

Inspiration Mode

Generate music from a text description

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

Custom Mode

Generate music with custom lyrics, style, and title

paramNameparamTyperequireddescriptionexample
paramNamepromptparamTypestringrequiredyesdescriptionCustom lyrics or detailed promptexampleVerse 1: Walking down the street, feeling so free...
paramNamestyleparamTypestringrequirednodescriptionMusical style or genreexamplepop, upbeat, electronic, 120 bpm
paramNametitleparamTypestringrequirednodescriptionSong titleexampleSummer Dreams
paramNametagsparamTypestringrequirednodescriptionNegative tags to avoidexamplesad, slow

commonParams

paramNameparamTyperequireddescriptionexample
paramNamemodelparamTypestringrequirednodescriptionAI model to use.examplechirp-v5-5
paramNamemake_instrumentalparamTypebooleanrequirednodescriptionGenerate instrumental music without vocalsexamplefalse
paramNamegenderparamTypestringrequirednodescriptionVocal gender preferenceexamplefemale
paramNamestyle_weightparamTypenumberrequirednodescriptionStrength of adherence to styleexample0.65
paramNameweirdness_constraintparamTypenumberrequirednodescriptionControls creative deviationexample0.65
paramNameaudio_weightparamTypenumberrequirednodescriptionBalance weight for audio featuresexample0.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);