Suno Dodaj wokale
Użyj punktu końcowego add vocals, aby utworzyć asynchroniczne Zadanie (Task).
Omówienie
Użyj punktu końcowego add vocals z obsługiwanym modelem. Użyj zwróconego identyfikatora Zadania (Task ID), aby pobrać jego stan, lub podaj callback_url dla dostarczeń opisanych poniżej.
Szybki start
- Utwórz klucz API i ustaw go jako RUNAPI_API_KEY.
- Wybierz obsługiwany model i wyślij żądanie POST, którego treść odpowiada schematowi tego modelu.
- Zapisz zwrócony identyfikator zadania, a następnie odpytuj do momentu osiągnięcia stanu końcowego lub obsłuż wywołania zwrotne opisane poniżej.
Punkt końcowy
- Bazowy URL
https://runapi.ai- Wersja API
v1- Uwierzytelnianie
Authorization: Bearer YOUR_API_TOKEN
Obsługiwane modele
Otwórz stronę modelu, aby zapoznać się z aktualnymi cenami, limitami żądań i szczegółami dotyczącymi użytku komercyjnego.
Schemat żądania
Pola i dozwolone wartości zależą od wybranego modelu. Jeśli zostanie podany, callback_url będzie odbierać dostarczenia zadań (Task) opisane poniżej.
suno-v4.5-plus11 pola
audio_weightnumberWaga audio (0–1).
Zakres:0 - 1
callback_urlstringURL webhooka dla powiadomień asynchronicznych.
lyricsstringTekst wokalny do zaśpiewania.
Zakres:5000
modelstringIdentyfikator modelu.
negative_tagsstringStyle do unikania.
stylestringPreset stylu.
Zakres:1000
style_weightnumberWaga zgodności ze stylem (0–1).
Zakres:0 - 1
titlestringTytuł piosenki.
Zakres:80
upload_urlstringURL pliku audio, do którego należy dodać wokal.
vocal_genderstringPłeć wokalna.
Dozwolone wartości:male, female
weirdness_constraintnumberOgraniczenie dziwności (0–1).
Zakres:0 - 1
suno-v511 pola
audio_weightnumberWaga audio (0–1).
Zakres:0 - 1
callback_urlstringURL webhooka dla powiadomień asynchronicznych.
lyricsstringTekst wokalny do zaśpiewania.
Zakres:5000
modelstringIdentyfikator modelu.
negative_tagsstringStyle do unikania.
stylestringPreset stylu.
Zakres:1000
style_weightnumberWaga zgodności ze stylem (0–1).
Zakres:0 - 1
titlestringTytuł piosenki.
Zakres:80
upload_urlstringURL pliku audio, do którego należy dodać wokal.
vocal_genderstringPłeć wokalna.
Dozwolone wartości:male, female
weirdness_constraintnumberOgraniczenie dziwności (0–1).
Zakres:0 - 1
Tworzenie akceptacji
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
},
"task_replayed": {
"type": "boolean"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
Odpytywanie w toku
GET /api/v1/suno/add_vocals/:id
Schemat odpowiedzi
{
"properties": {
"audios": {
"items": {
"properties": {
"audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"duration": {
"type": "number"
},
"id": {
"type": "string"
},
"image_url": {
"type": "string",
"x-runapi-generated-media": true
},
"lyrics": {
"type": "string"
},
"model_name": {
"type": "string"
},
"stream_audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"generation_stage": {
"enum": [
"text_generated",
"first_audio_ready"
],
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"generation_stage": "text_generated",
"id": "tsk_reference_demo",
"status": "processing"
}
Odpytywanie zakończone
GET /api/v1/suno/add_vocals/:id
Schemat odpowiedzi
{
"properties": {
"audios": {
"items": {
"properties": {
"audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"duration": {
"type": "number"
},
"id": {
"type": "string"
},
"image_url": {
"type": "string",
"x-runapi-generated-media": true
},
"lyrics": {
"type": "string"
},
"model_name": {
"type": "string"
},
"stream_audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"generation_stage": {
"enum": [
"text_generated",
"first_audio_ready",
"all_audios_ready",
"failed"
],
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"audios",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"audios": [
{
"audio_url": "https://file.runapi.ai/reference-audio.mp3",
"id": "audio_reference"
}
],
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "completed"
}
Odpytywanie nie powiodło się
GET /api/v1/suno/add_vocals/:id
Schemat odpowiedzi
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": "Task processing failed.",
"id": "tsk_reference_demo",
"status": "failed"
}
Wywołanie zwrotne klienta: przetwarzanie
POST callback_url
Schemat odpowiedzi
{
"properties": {
"audios": {
"items": {
"properties": {
"audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"duration": {
"type": "number"
},
"id": {
"type": "string"
},
"image_url": {
"type": "string",
"x-runapi-generated-media": true
},
"lyrics": {
"type": "string"
},
"model_name": {
"type": "string"
},
"stream_audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"generation_stage": {
"enum": [
"text_generated",
"first_audio_ready"
],
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
}
},
"required": [
"id",
"status"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"generation_stage": "text_generated",
"id": "tsk_reference_demo",
"status": "processing"
}
Wywołanie zwrotne klienta: ukończono
POST callback_url
Schemat odpowiedzi
{
"properties": {
"audios": {
"items": {
"properties": {
"audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"duration": {
"type": "number"
},
"id": {
"type": "string"
},
"image_url": {
"type": "string",
"x-runapi-generated-media": true
},
"lyrics": {
"type": "string"
},
"model_name": {
"type": "string"
},
"stream_audio_url": {
"type": "string",
"x-runapi-generated-media": true
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"generation_stage": {
"enum": [
"text_generated",
"first_audio_ready",
"all_audios_ready",
"failed"
],
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"audios"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"audios": [
{
"audio_url": "https://file.runapi.ai/reference-audio.mp3",
"id": "audio_reference"
}
],
"id": "tsk_reference_demo",
"status": "completed"
}
Wywołanie zwrotne klienta: niepowodzenie
POST callback_url
Schemat odpowiedzi
{
"properties": {
"error": {
"oneOf": [
{
"type": "string"
},
{
"properties": {
"code": {
"type": "string"
},
"limit_cents": {
"type": "integer"
},
"message": {
"type": "string"
},
"reset_at": {
"format": "date-time",
"type": [
"string",
"null"
]
},
"used_cents": {
"type": "integer"
},
"window": {
"enum": [
"1h",
"1d",
"7d",
"daily",
"weekly",
"monthly",
"lifetime"
],
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
]
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": {
"code": "generation_failed",
"message": "Task processing failed."
},
"id": "tsk_reference_demo",
"status": "failed"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Authentication required"
}
Błędy
GET /api/v1/suno/add_vocals/:id
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Authentication required"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"oneOf": [
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "Czytelne dla człowieka podsumowanie walidacji.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Komunikaty walidacyjne identyfikowane przez publiczne pole żądania, z tablicą czytelnych dla człowieka ciągów znaków dla każdego pola.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Przykład odpowiedzi
{
"error": "model must be one of: suno-v4.5-plus, suno-v5"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Insufficient balance"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "API key credit limit exceeded"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "The request uses features that are not supported for the selected model"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Rate limit reached. Please retry later."
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Service under maintenance, please try again later"
}
Błędy
POST /api/v1/suno/add_vocals
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "The request timed out"
}
Błędy
GET /api/v1/suno/add_vocals/:id
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Task with id 'tsk_reference_demo' not found"
}
Wygenerowane przykłady kodu
Używaj bezpośrednio cURL lub zainstaluj SDK dla swojego języka. Każdy przykład przesyła zwalidowane żądanie pokazane w tej dokumentacji.
Instalacja
pip install runapi-suno
import os
from runapi.suno import SunoClient
client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.add_vocals.create(
model="suno-v5",
upload_url="https://file.runapi.ai/source-instrumental.mp3",
lyrics="City lights reflect in the rain.",
title="City Lights",
style="acoustic pop",
negative_tags="heavy metal"
)