Suno Örnek Ekleme
Eş zamansız bir Görev oluşturmak için örnek ekleme uç noktasını kullanın.
Genel Bakış
Desteklenen bir modelle örnek ekleme uç noktasını kullanın. Durumunu almak için döndürülen Görev Kimliğini kullanın ya da aşağıda belgelenen teslimatlar için callback_url sağlayın.
Hızlı başlangıç
- Bir API anahtarı oluşturun ve RUNAPI_API_KEY olarak ayarlayın.
- Desteklenen bir model seçin ve gövdesi o modelin şemasıyla eşleşen bir POST isteği gönderin.
- Döndürülen görev kimliğini saklayın, ardından bir terminal durumuna ulaşana kadar yoklama yapın ya da aşağıda belgelenen geri çağırmaları işleyin.
Uç Nokta
- Temel URL
https://runapi.ai- API sürümü
v1- Kimlik doğrulama
Authorization: Bearer YOUR_API_TOKEN
Desteklenen modeller
Güncel fiyatlandırma, hız sınırları ve ticari kullanım ayrıntıları için bir model sayfası açın.
İstek şeması
Alanlar ve izin verilen değerler seçili modele göre değişir. Sağlandığında, callback_url aşağıda belgelenen Görev teslimatlarını alır.
suno-v46 alan
audio_urlstringÖrnek alınacak ses dosyasının URL'si.
callback_urlstringAsenkron bildirimler için webhook URL'si.
end_secondsnumberÖrnek aralığının saniye cinsinden bitiş noktası; start_seconds değerini aşmalıdır.
Sınır:0
modelstringModel tanımlayıcısı.
promptstringEklenecek örneğe ait isteğe bağlı açıklama.
start_secondsnumberSaniye cinsinden örnek aralığının başlangıcı.
Sınır:0
suno-v4.56 alan
audio_urlstringÖrnek alınacak ses dosyasının URL'si.
callback_urlstringAsenkron bildirimler için webhook URL'si.
end_secondsnumberÖrnek aralığının saniye cinsinden bitiş noktası; start_seconds değerini aşmalıdır.
Sınır:0
modelstringModel tanımlayıcısı.
promptstringEklenecek örneğe ait isteğe bağlı açıklama.
start_secondsnumberSaniye cinsinden örnek aralığının başlangıcı.
Sınır:0
suno-v4.5-plus6 alan
audio_urlstringÖrnek alınacak ses dosyasının URL'si.
callback_urlstringAsenkron bildirimler için webhook URL'si.
end_secondsnumberÖrnek aralığının saniye cinsinden bitiş noktası; start_seconds değerini aşmalıdır.
Sınır:0
modelstringModel tanımlayıcısı.
promptstringEklenecek örneğe ait isteğe bağlı açıklama.
start_secondsnumberSaniye cinsinden örnek aralığının başlangıcı.
Sınır:0
suno-v56 alan
audio_urlstringÖrnek alınacak ses dosyasının URL'si.
callback_urlstringAsenkron bildirimler için webhook URL'si.
end_secondsnumberÖrnek aralığının saniye cinsinden bitiş noktası; start_seconds değerini aşmalıdır.
Sınır:0
modelstringModel tanımlayıcısı.
promptstringEklenecek örneğe ait isteğe bağlı açıklama.
start_secondsnumberSaniye cinsinden örnek aralığının başlangıcı.
Sınır:0
suno-v5.56 alan
audio_urlstringÖrnek alınacak ses dosyasının URL'si.
callback_urlstringAsenkron bildirimler için webhook URL'si.
end_secondsnumberÖrnek aralığının saniye cinsinden bitiş noktası; start_seconds değerini aşmalıdır.
Sınır:0
modelstringModel tanımlayıcısı.
promptstringEklenecek örneğe ait isteğe bağlı açıklama.
start_secondsnumberSaniye cinsinden örnek aralığının başlangıcı.
Sınır:0
Kabul oluştur
POST /api/v1/suno/add_samples
Yanıt şeması
{
"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
}
Yanıt örneği
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
Yoklama işleniyor
GET /api/v1/suno/add_samples/:id
Yanıt şeması
{
"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
}
Yanıt örneği
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"generation_stage": "text_generated",
"id": "tsk_reference_demo",
"status": "processing"
}
Yoklama tamamlandı
GET /api/v1/suno/add_samples/:id
Yanıt şeması
{
"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
}
Yanıt örneği
{
"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"
}
Yoklama başarısız oldu
GET /api/v1/suno/add_samples/:id
Yanıt şeması
{
"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
}
Yanıt örneği
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": "Task processing failed.",
"id": "tsk_reference_demo",
"status": "failed"
}
Müşteri geri çağırması: işleniyor
POST callback_url
Yanıt şeması
{
"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
}
Yanıt örneği
{
"generation_stage": "text_generated",
"id": "tsk_reference_demo",
"status": "processing"
}
Müşteri geri çağırması: tamamlandı
POST callback_url
Yanıt şeması
{
"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
}
Yanıt örneği
{
"audios": [
{
"audio_url": "https://file.runapi.ai/reference-audio.mp3",
"id": "audio_reference"
}
],
"id": "tsk_reference_demo",
"status": "completed"
}
Müşteri geri çağırması: başarısız oldu
POST callback_url
Yanıt şeması
{
"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
}
Yanıt örneği
{
"error": {
"code": "generation_failed",
"message": "Task processing failed."
},
"id": "tsk_reference_demo",
"status": "failed"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "Authentication required"
}
Hatalar
GET /api/v1/suno/add_samples/:id
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "Authentication required"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"oneOf": [
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir doğrulama özeti.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Herkese açık istek alanına göre anahtarlanan doğrulama mesajları; her alan için insan tarafından okunabilir dizelerden oluşan bir dizi içerir.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Yanıt örneği
{
"error": "model must be one of: suno-v4, suno-v4.5, suno-v4.5-plus, suno-v5, suno-v5.5"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "Insufficient balance"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "API key credit limit exceeded"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "The request uses features that are not supported for the selected model"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "Rate limit reached. Please retry later."
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "Service under maintenance, please try again later"
}
Hatalar
POST /api/v1/suno/add_samples
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "The request timed out"
}
Hatalar
GET /api/v1/suno/add_samples/:id
Yanıt şeması
{
"properties": {
"error": {
"description": "İnsan tarafından okunabilir hata mesajı.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Yanıt örneği
{
"error": "Task with id 'tsk_reference_demo' not found"
}
Oluşturulan Kod Örnekleri
Doğrudan cURL kullanın veya diliniz için bir SDK yükleyin. Her örnek, bu başvuruda gösterilen doğrulanmış isteği gönderir.
Yükle
pip install runapi-suno
import os
from runapi.suno import SunoClient
client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.add_samples.create(
model="suno-v5",
audio_url="https://cdn.runapi.ai/public/samples/music.mp3",
prompt="Add a crisp handclap sample to the chorus.",
start_seconds=10,
end_seconds=30
)