Generate music
Generate a song from a prompt: `custom=false` is inspiration mode (`prompt` used as an inspiration prompt), `=true` is custom mode (`prompt` used as lyrics).
← Вся документация/v1/music/generations- Async task: submitting returns a
task_id; pollGET /v1/music/tasks/:task_idfor the result
Warning
customcontrols how text fields are interpreted. Withcustom=true(custom mode),promptcontains lyrics, andtitle,style,negative_tags,auto_lyrics, andpersona_idapply. Withcustom=false(inspiration mode),promptcontains an inspiration description and those custom-mode fields are ignored.style_weight,weirdness_constraint,audio_weight, andvocal_genderare validated and applied in both modes.
Note
This endpoint has slightly different field names:
styleis used, instead oftags.
curl -X POST https://api.apisea.ai/v1/music/generations \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data '{
"model": "suno",
"version": "v6",
"custom": true,
"instrumental": false,
"prompt": "[Verse]\nNeon-lit streets on a rainy night",
"title": "Midnight Drive",
"style": "synthwave, female vocal, cinematic",
"negative_tags": "metal, screaming",
"auto_lyrics": false,
"vocal_gender": "Female",
"style_weight": 0.6,
"weirdness_constraint": 0.3,
"audio_weight": 0.5
}'Примеры запросов
curl -X POST https://api.apisea.ai/v1/music/generations \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data '{
"model": "suno",
"custom": false,
"version": "v6",
"prompt": "Late-night city lo-fi piano with the sound of rain"
}'Authorizations
AuthorizationstringrequiredAll 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:
Authorization: Bearer YOUR_API_KEYBody
modelstringdefault: sunoAudio model. Currently pass suno (defaults to suno if omitted).
custombooleandefault: falsefalse=inspiration mode; true=custom mode (prompt used as lyrics). Defaults to false.
instrumentalbooleandefault: falsetrue=instrumental only, no vocals. Defaults to false.
versionstringPublic version: v6 / v6-wild / v6-mini. At least one must be provided with custom_model_id; omit this field when using a custom model.
custom_model_idstringThe complete UUID of the created custom model task. Mutually exclusive with version and persona_id; this field is provided to be charged based on the price tier of the custom model.
promptstringinspiration prompt / lyrics. custom=false must be filled and no more than 3000 characters; custom=true and instrumental=false must be filled and no more than 5000 characters; custom pure music can be omitted.
titlestringTitle for custom mode, up to 80 characters. Ignored when custom=false (inspiration mode).
stylestringStyle tag (custom mode), no more than 1000 characters. Ignored when custom=false (inspiration mode).
negative_tagsstringNegative style tags (styles you don't want). Only takes effect when custom=true.
auto_lyricsbooleantrue=rewrite the provided lyrics creatively. Only takes effect when custom=true.
persona_idstringPersona Style ID. Only applies when custom=true is used and mutually exclusive with custom_model_id.
vocal_genderstringVocal gender: Male / Female (m / f / male / female are also accepted and normalized by the backend). Works in both modes.
style_weightnumberStyle weight, 0.00–1.00. Validated and effective in both modes.
weirdness_constraintnumbercreative score, 0.00–1.00. Both modes will validate and take effect.
audio_weightnumberAudio weight, 0.00–1.00. Validated and effective in both modes.
varietystringStyle variation: off / normal / high / extra / max. Optional; there is no fixed default.
max_modebooleandefault: falseWhether to enable Max mode. Enable it requires custom=true and charges at twice the normal price.
audio_formatstringOutput audio format: mp3 / m4a / wav. If omitted, the service chooses the default.
durationintegertarget generation duration, range 10-360 seconds. Only available when set as custom=true; actual finished product duration will be based on task results.
Note
Get Result: This is an asynchronous task. After submission, you will receive
task_idand then pollGET /v1/music/tasks/{task_id}every 3–5 seconds untilstatusbecomescompletedorfailed(music generation usually takes 30–120 seconds; while generation is in progress,statusmay bependingorprocessing, andprogressis an integer from 0 to 100 and is not guaranteed to change at fixed intervals). Once completed, readaudio_urlfromdata.result.music[](there are alsoimage_url/video_url/title/durationetc.). In case of failure,data.error.messageprovides the reason and the deducted amount will be automatically refunded.
Response
codeintegerResponse status code
dataarrayReturned data array
Attributes
statusstringTask status
submitted- Submitted
task_idstringUnique 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.