API エンドポイント

音楽を拡張

POST/v2/extend

音楽 API を拡張する

新しいコンテンツを最後に追加して、既存の音楽トラックを拡張します。

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

tips

2 つのモード: 元のパラメータを継承するか、カスタム パラメータを使用します。

返された workId でフィード API を使用して、進行状況を確認します。

requestHeaders

namerequireddescription
Authorizationyes認証用ベアラートークン
Content-Typeyesapplication/json

requestBody

リクエスト本文は継承モードまたはカスタム モードをサポートします

継承モード

オリジナルのトラックパラメータを使用して拡張する

noAdditionalParams

カスタムモード

カスタムパラメータで拡張する

paramNameparamTyperequireddescriptionexample
promptstringyes新しい歌詞または説明Change the music style to be calm and lyrical.
stylestringno音楽スタイルlyrical
titlestringnoトラックタイトルlyrical song
extensionStartTimenumberno延長開始時間(秒)150
tagsstringno追加のタグwar

commonParams

paramNameparamTyperequireddescriptionexample
origin_task_idstringyesオリジナルの音楽生成からのタスク IDgen20e094aeaadfe494ea33a5c80ee596083bksv
extend_audio_indexnumberyes0 は最初のオーディオ、1 は 2 番目のオーディオ0
custom_modebooleanno継承モードの場合は false、カスタム モードの場合は truefalse
callback_urlstringnoリアルタイム結果用のオプションの Webhook URLhttps://your-domain.com/webhook

responses

json
{
  "code": 200,
  "message": "success",
  "workId": "ext2e31202d4f629447fa75f603ae2470565bksv"
}
json
{
  "code": 400,
  "message": "Please specify which audio to extend. Add \"extend_audio_index\" to your request, using 0 for the first audio or 1 for the second."
}
json
{
  "code": 400,
  "message": "The provided \"origin_task_id\" is invalid or could not be found. Please ensure it corresponds to a successfully completed task associated with your API key."
}
json
{
  "code": 400,
  "message": "The requested audio is not yet completed. Please wait for the task to complete and try again."
}
json
{
  "code": 401,
  "message": "No API key provided in Authorization header"
}
json
{
  "code": 500,
  "message": "Internal Server Error"
}

codeExamples

curl
curl -X POST "https://udioapi.pro/api/v2/extend" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": false
  }'
curl
curl -X POST "https://udioapi.pro/api/v2/extend" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": true,
    "prompt": "Change the music style to be calm and lyrical.",
    "style": "lyrical",
    "title": "lyrical song",
    "extensionStartTime": 150,
    "tags": "war"
  }'
javascript
const response = await fetch('https://udioapi.pro/api/v2/extend', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    origin_task_id: 'gen20e094aeaadfe494ea33a5c80ee596083bksv',
    extend_audio_index: 0,
    custom_mode: false
  })
});

const data = await response.json();
console.log(data);
javascript
const response = await fetch('https://udioapi.pro/api/v2/extend', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    origin_task_id: 'gen20e094aeaadfe494ea33a5c80ee596083bksv',
    extend_audio_index: 0,
    custom_mode: true,
    prompt: 'Change the music style to be calm and lyrical.',
    style: 'lyrical',
    title: 'lyrical song',
    extensionStartTime: 150,
    tags: 'war'
  })
});

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

url = "https://udioapi.pro/api/v2/extend"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": False
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
python
import requests

url = "https://udioapi.pro/api/v2/extend"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": True,
    "prompt": "Change the music style to be calm and lyrical.",
    "style": "lyrical",
    "title": "lyrical song",
    "extensionStartTime": 150,
    "tags": "war"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())