Endpoints de la API

Generar música

POST/v2/generate

POST /v2/generate

Generate music using AI. Supports both inspiration mode (text description) and custom mode (lyrics, style, title).

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

tips

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

Image to Music (Inspiration Mode only): Pass up to 5 publicly accessible image URLs in image_urls; the music reads the mood of the pictures and can be combined with gpt_description_prompt. Image input adds 1 credit per request and is silently ignored in Custom Mode.

Model Selection: Current models are chirp-v6 (12 credits), chirp-v6-mini (10 credits) and chirp-v6-wild (12 credits). Legacy identifiers are still accepted and billed at their historical price: chirp-v5 / chirp-v5-5 are served by chirp-v6, while chirp-v3-5, chirp-v4-0, chirp-v4-5 and chirp-v4-5-plus are served by chirp-v6-mini. Results always report the model that actually produced the audio in model_name.

Rejected requests are refunded: if a request is rejected during validation you receive 422 (fix the parameters) or 500 (temporary, retry later) with data.refunded; tasks that fail after being accepted are marked FAILED and refunded automatically.

requestHeaders

namerequireddescription
nameAuthorizationrequiredyesdescriptionBearer token for authentication
nameContent-Typerequiredyesdescriptionapplication/json

requestBody

Request body supports two modes: Inspiration Mode or Custom Mode

Inspiration Mode

Generate music from a text description

paramNameparamTyperequireddescriptionexample
paramNamegpt_description_promptparamTypestringrequiredyesdescriptionText description of the music you want to generate. Max length: 3000 characters (longer input is truncated). Optional when image_urls is provided.exampleA upbeat pop song about summer vacation with catchy melody

Custom Mode

Generate music with custom lyrics, style, and title

paramNameparamTyperequireddescriptionexample
paramNamepromptparamTypestringrequiredyesdescriptionCustom lyrics or detailed prompt. Max length: 5000 characters for every model (longer input is truncated).exampleVerse 1: Walking down the street, feeling so free...
paramNamestyleparamTypestringrequirednodescriptionMusical style/genre. Max length: 1000 characters for every model (longer input is truncated).examplepop, upbeat, electronic, 120 bpm
paramNametitleparamTypestringrequirednodescriptionSong title. Max length: 80 characters (longer input is truncated).exampleSummer Dreams
paramNametagsparamTypestringrequirednodescriptionNegative tags to avoid in generationexamplesad, slow
paramNamedurationparamTypenumberrequirednodescriptionDuración objetivo en segundos, solo para el modo personalizado de chirp-v5-5. Se aceptan valores de 10 a 360; si falta el valor o no es válido, se usa 20 de forma predeterminada. Se ignora en otros modelos y en el modo Inspiración.example20

commonParams

paramNameparamTyperequireddescriptionexample
paramNamemodelparamTypestringrequirednodescriptionModel to use. Current options: 'chirp-v6' (12 credits), 'chirp-v6-mini' (10 credits), 'chirp-v6-wild' (12 credits). Legacy identifiers 'chirp-v3-5' (5), 'chirp-v4-0' (8), 'chirp-v4-5' (10), 'chirp-v4-5-plus' (10), 'chirp-v5' (12) and 'chirp-v5-5' (12) keep their historical price and are served by chirp-v6 (chirp-v5 / chirp-v5-5) or chirp-v6-mini (all others). When omitted the request is billed at the 5-credit base tier and served by chirp-v6-mini.examplechirp-v6
paramNameimage_urlsparamTypestring[]requirednodescriptionImage to Music. Up to 5 publicly accessible image URLs (JPEG, JPG, PNG or WEBP, max 10MB each). The generated track reflects the mood of the images and can be steered with gpt_description_prompt. Adds 1 credit per request. Only applies to Inspiration Mode; silently ignored in Custom Mode.example["https://cdn.example.com/sunset-beach.jpg"]
paramNamemake_instrumentalparamTypebooleanrequirednodescriptionGenerate instrumental music without vocalsexamplefalse
paramNamegenderparamTypestringrequirednodescriptionVocal gender preference. Use 'male' or 'female'examplefemale
paramNamestyle_weightparamTypenumberrequirednodescriptionStrength of adherence to style. Range 0–1, up to 2 decimalsexample0.65
paramNameweirdness_constraintparamTypenumberrequirednodescriptionControls creative deviation. Range 0–1, up to 2 decimalsexample0.65
paramNameaudio_weightparamTypenumberrequirednodescriptionBalance weight for audio features. Range 0–1, up to 2 decimalsexample0.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": 422,
  "message": "Request rejected: title must be 80 characters or fewer. Your credits have been refunded.",
  "data": {
    "task_id": "gen2abc123def456bksv",
    "refunded": true
  },
  "workId": "gen2abc123def456bksv"
}
json
{
  "code": 500,
  "message": "The generation request could not be processed right now. Your credits have been refunded. Please retry later.",
  "data": {
    "task_id": "gen2abc123def456bksv",
    "refunded": true
  },
  "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-v6",
    "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",
    "duration": 20,
    "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-v6-mini',
    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);
curl
curl -X POST "https://udioapi.pro/api/v2/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chirp-v6",
    "image_urls": [
      "https://cdn.example.com/sunset-beach.jpg",
      "https://cdn.example.com/city-lights.png"
    ],
    "gpt_description_prompt": "Warm lo-fi track that matches the mood of these photos",
    "make_instrumental": true
  }'
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-v6',
    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',
    duration: 20,
    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);