POST
/
api
/
v1
/
generate
/
extend
Extend Music
curl --request POST \
  --url https://api.kie.ai/api/v1/generate/extend \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "defaultParamFlag": true,
  "audioId": "e231****-****-****-****-****8cadc7dc",
  "prompt": "Extend the music with more relaxing notes and a gentle bridge section",
  "style": "Classical",
  "title": "Peaceful Piano Extended",
  "continueAt": 60,
  "model": "V3_5",
  "callBackUrl": "https://api.example.com/callback",
  "negativeTags": "Heavy Metal, Upbeat Drums",
  "vocalGender": "m",
  "styleWeight": 0.65,
  "weirdnessConstraint": 0.65,
  "audioWeight": 0.65
}'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "5c79****be8e"
  }
}

Usage Guide

  • This endpoint allows you to extend existing music tracks
  • You can choose to use original parameters or set new custom parameters
  • Extended music will maintain style consistency with the source track

Parameter Details

  • With Custom Parameters (defaultParamFlag: true):
    • prompt, style, title and continueAt are required
    • prompt length limit: 3000 characters
    • style length limit: 200 characters
    • title length limit: 80 characters
  • With Original Parameters (defaultParamFlag: false):
    • Only audioId is required
    • Other parameters will be inherited from the source audio

Developer Notes

  • Generated files are retained for 14 days
  • Model version must match the source audio’s model version
  • Callback process follows the same pattern as the music generation endpoint

Optional parameters

  • vocalGender (string): Vocal gender preference. Use m for male, f for female.
  • styleWeight (number): Strength of adherence to style. Range 0–1, up to 2 decimals. Example: 0.65.
  • weirdnessConstraint (number): Controls creative deviation. Range 0–1, up to 2 decimals. Example: 0.65.
  • audioWeight (number): Balance weight for audio features. Range 0–1, up to 2 decimals. Example: 0.65.

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
defaultParamFlag
boolean
required

Controls parameter source for extension.

  • If true: Use custom parameters specified in this request. Requires continueAt, prompt, style, and title.
  • If false: Use original audio parameters. Only audioId is required, other parameters are inherited.
Example:

true

audioId
string
required

Unique identifier of the audio track to extend. Required for all extension requests.

Example:

"e231****-****-****-****-****8cadc7dc"

prompt
string
required

Description of the desired audio extension content.

  • Required when defaultParamFlag is true.
  • Max length: 3000 characters.
  • Describes how the music should continue or change in the extension.
Example:

"Extend the music with more relaxing notes and a gentle bridge section"

model
enum<string>
required

The AI model version to use for generation.

  • Required for all requests.
  • Available options:
    • V5: Superior musical expression, faster generation.
    • V4_5PLUS: V4.5+ is richer sound, new waysto create, max 8 min.
    • V4_5: V4.5 is smarter prompts, fastergenerations, max 8 min.
    • V4: V4 is improved vocal quality,max 4 min.
    • V3_5: V3.5 is better song structure,max 4 min.
Available options:
V3_5,
V4,
V4_5,
V4_5PLUS,
V5
Example:

"V3_5"

callBackUrl
string<uri>
required

The URL to receive music extension task completion updates. Required for all music extension requests.

  • System will POST task status and results to this URL when extension completes
  • Callback process has three stages: text (text generation), first (first track complete), complete (all tracks complete)
  • Your callback endpoint should accept POST requests with JSON payload containing extended track results and audio URLs
  • For detailed callback format and implementation guide, see Music Extension Callbacks
  • Alternatively, use the Get Music Details endpoint to poll task status
Example:

"https://api.example.com/callback"

style
string

Music style specification for the extended audio.

  • Required when defaultParamFlag is true.
  • Max length: 200 characters.
  • Should typically align with the original audio's style for best results.
Example:

"Classical"

title
string

Title for the extended music track.

  • Required when defaultParamFlag is true.
  • Max length: 80 characters.
  • Will be displayed in player interfaces and filenames.
Example:

"Peaceful Piano Extended"

continueAt
number

The time point (in seconds) from which to start extending the music.

  • Required when defaultParamFlag is true.
  • Value range: greater than 0 and less than the total duration of the generated audio.
  • Specifies the position in the original track where the extension should begin.
Example:

60

negativeTags
string

Music styles or traits to exclude from the extended audio. Optional. Use to avoid specific undesired characteristics.

Example:

"Heavy Metal, Upbeat Drums"

vocalGender
enum<string>

Vocal gender preference for the singing voice. Optional. Use 'm' for male and 'f' for female. Based on practice, this parameter can only increase the probability but cannot guarantee adherence to male/female voice instructions.

Available options:
m,
f
Example:

"m"

styleWeight
number

Strength of adherence to the specified style. Optional. Range 0–1, up to 2 decimal places.

Required range: 0 <= x <= 1Must be a multiple of 0.01
Example:

0.65

weirdnessConstraint
number

Controls experimental/creative deviation. Optional. Range 0–1, up to 2 decimal places.

Required range: 0 <= x <= 1Must be a multiple of 0.01
Example:

0.65

audioWeight
number

Balance weight for audio features vs. other factors. Optional. Range 0–1, up to 2 decimal places.

Required range: 0 <= x <= 1Must be a multiple of 0.01
Example:

0.65

Response

Request successful

code
enum<integer>

Response status code

  • 200: Success - Request has been processed successfully
  • 401: Unauthorized - Authentication credentials are missing or invalid
  • 402: Insufficient Credits - Account does not have enough credits to perform the operation
  • 404: Not Found - The requested resource or endpoint does not exist
  • 409: Conflict - WAV record already exists
  • 422: Validation Error - The request parameters failed validation checks
  • 429: Rate Limited - Request limit has been exceeded for this resource
  • 451: Unauthorized - Failed to fetch the image. Kindly verify any access limits set by you or your service provider.
  • 455: Service Unavailable - System is currently undergoing maintenance
  • 500: Server Error - An unexpected error occurred while processing the request
Available options:
200,
401,
402,
404,
409,
422,
429,
451,
455,
500
msg
string

Error message when code != 200

Example:

"success"

data
object