Skip to content

Replace Music Section ​

This page is generated from the upstream official OpenAPI documentation. Endpoints, parameters and examples match the official docs; brand and API domain are replaced with ModelFold.

Endpoint ​

POST /jobs/createTask

Full URL: https://ai.modelfold.online/v1/jobs/createTask

Authentication: every request must include the Authorization: Bearer <API_KEY> header.

Document updated

If you have already completed the integration process previously, you can still access the old version document at: Old version address (https://ai.modelfold.online/docs/en/suno-api/replace-section)

Replace a specific time segment within existing music.

This interface can replace specific time segments in already generated music. It requires providing the original music's task ID and the time range to be replaced. The replaced audio will naturally blend with the original music. This endpoint is always custom mode.

Parameter Details ​

  • Always required: prompt, tags, title, infill_start_s, infill_end_s, full_lyrics
  • lyrics is optional lyrics for the replaced segment. V6 maximum 5000 characters
  • Optional: negative_tags, vocal_gender, style_weight, weirdness_constraint, audio_weight, variety, persona_id, persona_model

Time Range Instructions ​

  • infill_start_s must be less than infill_end_s.
  • Time values are precise to 2 decimal places, e.g., 10.50 seconds.
  • The replacement time must be at least 10 seconds.
  • Replacement duration should not exceed 50% of the original music's total duration.

Developer Notes ​

  • Replacement segments will be regenerated based on the provided prompt and tags.
  • Generated replacement segments will automatically blend with the original music's preceding and following parts.
  • Generated files will be retained for 14 days.

Request Parameters ​

Body (application/json) ​

ParameterTypeRequiredDescription
modelstringYesThe model name used to generate the task. This field is required. This endpoint must use the ai-music-api/replace-section model. Allowed values:ai-music-api/replace-section。 示例:ai-music-api/replace-section。
callBackUrlstringNoThe URL to receive updates when the generation task is completed. Optional, but recommended for production environments.
- When generation is complete, the system will POST the task status and results to this URL
- The callback includes the generated URL and task information
- Your callback endpoint should accept POST requests with a JSON payload containing the results
- Alternatively, poll GET /api/v1/jobs/recordInfo?taskId=... (see Get Task Details). For Suno audio tasks the tracks are in data.response.data[] (audio_url, stream_audio_url, image_url, id, duration).
- To ensure callback security, refer to the Webhook Verification Guide for signature verification implementation 示例:https://api.example.com/callback。
input`objectobject`Yes
  input.promptstringYesThe lyrics after replacement. Required. 示例:A calm and relaxing piano track.。
  input.tagsstringYesStyle tags for the music, such as jazz or electronic. Required. 示例:Jazz。
  input.titlestringYesThe title of the music. Required. 示例:Relaxing Piano。
  input.negative_tagsstringNoMusic styles to exclude, used to prevent specific stylistic elements from appearing in the replacement section. 示例:Rock。
  input.infill_start_snumberYesThe point in time, in seconds, at which replacement starts, rounded to 2 decimal places. Required. Must be less than infill_end_s, and the difference between infill_end_s and infill_start_s must be at least 10 seconds. 示例:10.5。
  input.infill_end_snumberYesThe point in time, in seconds, at which replacement ends, rounded to 2 decimal places. Required. Must be greater than infill_start_s, and the difference between infill_end_s and infill_start_s must be at least 10 seconds. 示例:20.75。
  input.full_lyricsstringYesThe complete modified lyrics, combining the modified and unmodified lyrics. Required. This parameter contains the complete lyrics text that will be used for the entire song after section replacement. 示例:[Verse 1]\nOriginal lyrics content\n[Chorus]\nModified lyrics for this section\n[Verse 2]\nMore original lyrics。
  input.lyricsstringNoLyrics for the replaced segment. Optional.
- V6, V6_MINI, and V6_WILD: Maximum 5000 characters. 示例:[Chorus]\nModified lyrics for this section。
  input.vocal_genderstringNoVocal gender preference. Optional. 'm' for male, 'f' for female. Based on practice, this parameter can only increase the probability but cannot guarantee adherence to male/female voice instructions. Allowed values:m / f。 示例:m。
  input.style_weightnumberNoAdherence strength to specified style. Optional. Range 0–1, up to 2 decimal places. 示例:0.65。
  input.weirdness_constraintnumberNoControls experimental/creative deviation level. Optional. Range 0–1, up to 2 decimal places. 示例:0.65。
  input.audio_weightnumberNoRelative weight of audio elements. Optional. Range 0–1, up to 2 decimal places. 示例:0.65。
  input.varietyintegerNoControls the diversity and stylistic variation of generated results. Optional. Integer range 0–4, default 1.
- 0: off (exact style) — fully off, strictly the same style
- 1: normal (balanced variety) — default, balances stability and diversity
- 2: high (distinct styles) — produces results with clearly different styles
- 3: extra (bold exploration) — higher variation, encourages bold exploration of different styles
- 4: max (unreasonably varied) — maximum diversity; results may differ in style very significantly Default:1。 示例:1。
  input.persona_idstringNoPersona ID or Voice ID to apply to the generated music. Optional. Use this to apply a specific persona style to your music generation.
To generate a Persona ID, use the Generate Persona endpoint to create a personalized music Persona based on generated music.
To generate a Voice ID, use the Generate Voice endpoint. 示例:persona_123。
  input.persona_modelstringNoPersona model. Optional. Use style_persona for Generate Persona IDs, or voice_persona for Suno Voice IDs. Default: style_persona. Available for V5 (Discontinued), V5_5 (Discontinued), V6, V6_MINI, and V6_WILD. Default:"style_persona"。 Allowed values:style_persona / voice_persona。 示例:style_persona。

Request Example ​

bash
curl -X POST "https://ai.modelfold.online/v1/jobs/createTask" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "ai-music-api/replace-section",
  "callBackUrl": "https://example.com/callback",
  "input": {
    "task_id": "2fac****9f72",
    "audio_id": "e231****-****-****-****-****8cadc7dc",
    "prompt": "A calm and relaxing piano track.",
    "tags": "Jazz",
    "title": "Relaxing Piano",
    "negative_tags": "Rock",
    "infill_start_s": 10.5,
    "infill_end_s": 20.75,
    "full_lyrics": "[Verse 1]\nOriginal lyrics here\n[Chorus]\nModified lyrics for this section\n[Verse 2]\nMore original lyrics",
    "lyrics": "[Chorus]\nModified lyrics for this section",
    "variety": 1,
    "vocal_gender": "m",
    "style_weight": 0.65,
    "weirdness_constraint": 0.65,
    "audio_weight": 0.65,
    "persona_id": "persona_123",
    "persona_model": "style_persona"
  }
}'
json
{
  "model": "ai-music-api/replace-section",
  "callBackUrl": "https://example.com/callback",
  "input": {
    "task_id": "2fac****9f72",
    "audio_id": "e231****-****-****-****-****8cadc7dc",
    "prompt": "A calm and relaxing piano track.",
    "tags": "Jazz",
    "title": "Relaxing Piano",
    "negative_tags": "Rock",
    "infill_start_s": 10.5,
    "infill_end_s": 20.75,
    "full_lyrics": "[Verse 1]\nOriginal lyrics here\n[Chorus]\nModified lyrics for this section\n[Verse 2]\nMore original lyrics",
    "lyrics": "[Chorus]\nModified lyrics for this section",
    "variety": 1,
    "vocal_gender": "m",
    "style_weight": 0.65,
    "weirdness_constraint": 0.65,
    "audio_weight": 0.65,
    "persona_id": "persona_123",
    "persona_model": "style_persona"
  }
}

Response ​

200 — Request successful ​

参数类型必填说明
codeinteger否Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). 可选值:200 / 401 / 402 / 404 / 409 / 422 / 429 / 451 / 455 / 500。 示例:200。
msgstring否Error message when code != 200 示例:success。
dataobject否—
  data.taskIdstring否Task ID for tracking task status. Poll GET /api/v1/jobs/recordInfo?taskId=... (see Get Task Details). For Suno audio tasks the tracks are in data.response.data[] (audio_url, stream_audio_url, image_url, id, duration). 示例:5c79****be8e。
json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "5c79****be8e"
  }
}

Callback ​

audioGenerated ​

Callback URL: {request.body#/callBackUrl} (the callBackUrl in the request body).

When audio generation is complete, the system will call this callback to notify the result.

Callback Example ​

json
{
  "code": 200,
  "msg": "All generated successfully.",
  "data": {
    "callbackType": "complete",
    "task_id": "2fac****9f72",
    "data": [
      {
        "id": "e231****-****-****-****-****8cadc7dc",
        "audio_url": "https://example.cn/****.mp3",
        "stream_audio_url": "https://example.cn/****",
        "image_url": "https://example.cn/****.jpeg",
        "prompt": "A calm and relaxing piano track.",
        "model_name": "chirp-v3-5",
        "title": "Relaxing Piano",
        "tags": "Jazz",
        "createTime": 1791200596437,
        "duration": 198.44
      }
    ]
  }
}

Callback body parameters

参数类型必填说明
codeinteger否Status code 示例:200。
msgstring否Return message 示例:All generated successfully。
dataobject否—
  data.callbackTypestring否Callback type: text (text generation complete), first (first song complete), complete (all complete) Allowed values:text / first / complete。 示例:text。
  data.task_idstring否Task ID
  data.dataarray&lt;object&gt;否—
    data.data[].idstring否Audio unique identifier (audioId)
    data.data[].audio_urlstring否Audio file URL
    data.data[].stream_audio_urlstring否Streaming audio URL
    data.data[].image_urlstring否Cover image URL
    data.data[].promptstring否Generation prompt/lyrics
    data.data[].model_namestring否Model name used
    data.data[].titlestring否Music title
    data.data[].tagsstring否Music tags
    data.data[].createTimeinteger否Creation time (Unix timestamp in milliseconds)
    data.data[].durationnumber否Audio duration (seconds)
json
{
  "code": 200,
  "msg": "All generated successfully",
  "data": {
    "callbackType": "text",
    "task_id": "",
    "data": [
      {
        "id": "",
        "audio_url": "https://your-domain.com/input.png",
        "stream_audio_url": "https://your-domain.com/input.png",
        "image_url": "https://your-domain.com/input.png",
        "prompt": "A serene mountain landscape at sunrise",
        "model_name": "model-name",
        "title": "",
        "tags": "",
        "createTime": 0,
        "duration": 0
      }
    ]
  }
}

ModelFold — one API for all the best AI models.