Skip to content
このページはまだお使いの言語に対応していないため、英語で表示されています。

Sample to song (sample)

Generate a song based on a sample.

← すべてのドキュメント
POST/v1/music/generations/sample
  • Reference the source track: specified by task_id + audio_index, no need to record any extra id
  • Async task: submitting returns a task_id; poll GET /v1/music/tasks/:task_id for the result

Note

Source Audio Reference: No additional IDs are needed for tracks based on existing songs. Just pass task_id (the task ID from the previous run of this task) + audio_index (which result track in the data.result.music[] list, 1-based, default is 1).

Warning

custom determines which fields take effect. All submitted fields must still meet their type, range, and length requirements, even when they do not take effect in the current mode. With custom=true, prompt (lyrics), title, tags, negative_tags, auto_lyrics, style_weight, weirdness, and audio_weight take effect, while gpt_description is ignored. With custom=false, only gpt_description is used; it is required, and omitting it returns 400 during submission. vocal_gender takes effect in both modes. If custom is omitted, the backend infers it in this order: prompt present → true; no prompt but gpt_description present → false; otherwise, tags or title present → true.

リクエスト例

curl -X POST https://api.apisea.ai/v1/music/generations/sample \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  --data '{
    "model": "suno",
    "task_id": "task_01ABC",
    "audio_index": 1,
    "start_s": 0,
    "end_s": 8,
    "instrumental": false,
    "prompt": "along the night continue to sing",
    "version": "v6",
    "tags": "upbeat pop"
  }'

Authorizations

Authorizationstringrequired

All endpoints require authentication using a Bearer Token

Get an API Key:

Visit the API Key management page to get your API Key

Add the following to the request headers when using it:

text
Authorization: Bearer YOUR_API_KEY

Body

modelstringdefault: suno

Audio model. Currently pass suno (defaults to suno if omitted).

task_idstringrequired

The source task's task_id. It must identify an uploadTask upload task; a missing, non-upload, or invalid source returns 400 during submission.

audio_indexintegerdefault: 1

Selects a track from the source task's data.result.music[] array (1-based: 1 is the first track; default 1).

start_snumberrequired

Sampling start point (seconds). If missing, returns 400 immediately.

end_snumberrequired

Sample end time in seconds. It must satisfy 0 ≤ start_s < end_s and cannot exceed the known source duration.

instrumentalbooleandefault: false

Whether purely instrumental (true=no vocals). If omitted, defaults to false (with vocals).

versionstringdefault: v6

Public version: v6 / v6-wild / v6-mini. Defaults to v6; omit this field when using custom_model_id.

custom_model_idstring

The full UUID returned by the model-creation task. Mutually exclusive with version.

customboolean

true=custom mode (prompt used as lyrics); false=inspiration mode (uses gpt_description); if omitted, inferred from the content (see the Warning above).

promptstring

Conditionally required: provide lyrics when custom=true && instrumental=false. The field is inactive in inspiration mode, but any submitted value must still meet the length limit.

gpt_descriptionstring

Inspiration prompt. Required when custom=false — if missing, the request fails with 400 at submission (nothing is charged).

titlestring

Title. Only takes effect when custom=true.

tagsstring

Style tags. Only takes effect when custom=true.

negative_tagsstring

Style tags to exclude. Only takes effect when custom=true.

auto_lyricsboolean

true=rewrite the provided lyrics creatively. Only takes effect when custom=true.

style_weightnumber

Style weight, 0.00–1.00 (out-of-range values return 400 directly at submission time). Only takes effect when custom=true.

weirdnessnumber

Creativity weight, from 0.00 to 1.00. weirdness_constraint is accepted as a legacy alias; use weirdness for new requests.

audio_weightnumber

Audio weight, 0.00–1.00. Only takes effect when custom=true.

vocal_genderstring

Vocal gender: Male / Female. Works in both modes.

varietystring

Style variation: off / normal / high / extra / max. Optional.

max_modebooleandefault: false

Enables Max mode. Requires custom mode and is billed at twice the standard price.

audio_formatstring

Output audio format: mp3 / m4a / wav. This endpoint does not support a target-duration field.

Note

The source task must be an uploadTask upload task. Both start_s and end_s are required; the service does not fill in defaults such as 0 or 60.

Note

Get Result: This is an asynchronous task. After submission, you will receive task_id and then poll GET /v1/music/tasks/{task_id} every 3–5 seconds until status becomes completed or failed (music generation usually takes 30–120 seconds; while generation is in progress, status may be pending or processing, and progress is an integer from 0 to 100 and is not guaranteed to change at fixed intervals). Once completed, read audio_url from data.result.music[]. In case of failure, data.error.message provides the reason and the deducted amount will be automatically refunded.

Response

codeinteger

Response status code

dataarray

Returned data array

Attributes

statusstring

Task status

  • submitted - Submitted
task_idstring

Unique task identifier (used to poll GET /v1/music/tasks/{task_id} for the result)

レスポンス

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}

ドキュメントに問題が見つかりましたか?support@apisea.aiまでメールでお知らせください。