API-Referenz

Musik

Modelle für diesen Endpunkt (1)

In der Workbench ausprobieren
POST/v1/music/generations
GET/v1/music/tasks/{task_id}
GET/v1/music/tasks/{task_id}/content

Suno-Songs, Texte und 32 Werkzeuge über einen Endpunkt. Jeder Aufruf liefert sofort eine task_id; frage die Aufgabe ab oder nutze einen Webhook, bis sie fertig ist, und lies dann ihre Dateien.

#Anfrageparameter

  • modelstringerforderlich

    Die Musikmodell-ID von der Modellseite: suno.

  • operationstringoptional

    Was zu tun ist: music (Standard) erstellt einen Song, lyrics schreibt Texte, und die Werkzeuge unten bearbeiten, verlängern, analysieren oder exportieren einen Song.

  • promptstringoptional

    Inspirationsmodus: worum es im Song geht, bis zu 3000 Zeichen. Eigener Modus: der Text, bis zu 5000. Für ein Instrumental im eigenen Modus nicht nötig. Für lyrics: die Vorgabe.

  • custombooleanoptional

    false (Standard): Inspirationsmodus, prompt beschreibt den Song. true: eigener Modus, prompt ist der Text, und title, style, negative_tags, auto_lyrics, persona_id, duration und max_mode gelten.

  • instrumentalbooleanoptional

    true: ohne Gesang.

  • versionstringoptional

    v6 (Standard), v6-wild oder v6-mini. Weglassen, wenn custom_model_id gesetzt ist.

  • titlestringoptional

    Songtitel, bis zu 80 Zeichen. Eigener Modus.

  • stylestringoptional

    Stil-Tags wie Genre, Stimmung und Instrumente, bis zu 1000 Zeichen. Eigener Modus. tags wird ebenfalls akzeptiert.

  • negative_tagsstringoptional

    Zu vermeidende Stile. Eigener Modus.

  • vocal_genderstringoptional

    Male oder Female.

  • auto_lyricsbooleanoptional

    true: den Text kreativ umschreiben. Eigener Modus.

  • style_weightnumberoptional

    0 bis 1: wie eng der Song dem Stil folgt. 0 ist ein gültiger Wert.

  • weirdness_constraintnumberoptional

    0 bis 1: wie experimentierfreudig der Song ist.

  • audio_weightnumberoptional

    0 bis 1: wie stark eine Referenzaufnahme zählt.

  • varietystringoptional

    off, normal, high, extra oder max: wie stark die Ergebnisse variieren.

  • max_modebooleanoptional

    true: Max-Modus, höhere Qualität zum doppelten Preis. Eigener Modus.

  • audio_formatstringoptional

    mp3, m4a or wav.

  • durationintegeroptional

    Ziellänge in Sekunden, 10 bis 360. Eigener Modus; der fertige Song kann abweichen.

  • persona_idstringoptional

    Eine mit dem persona-Werkzeug erstellte Sänger-Persona. Eigener Modus; nicht zusammen mit custom_model_id.

  • custom_model_idstringoptional

    Ein mit create-model trainiertes Modell. Ersetzt version; nicht zusammen mit persona_id.

  • parametersobjectoptional

    Die eigenen Felder eines Werkzeugs (siehe Werkzeuge unten), z. B. task_id und audio_index des bearbeiteten Songs.

  • webhook_urlstringoptional

    HTTPS-URL, die aufgerufen wird, sobald der Task einen Endzustand erreicht.

  • webhook_secretstringoptional

    Wenn gesetzt, enthalten Zustellungen X-Xiaoxiang-Signature: sha256=hex(HMAC-SHA256(body, secret)).

Zwei Wege zu einem Song

Inspirationsmodus (custom false): Beschreibe den Song in prompt, der Text wird für dich geschrieben. Eigener Modus (custom true): prompt enthält deinen Text, style, title und die übrigen Felder formen den Song. Beginne nur mit prompt.

#Mit einem eigenen Song arbeiten

Ein Werkzeug für einen Song nimmt task_id, die Aufgabe, die ihn erstellt hat (wie diese API sie zurückgab), und audio_index, die Position des Songs darin: 1 für den ersten, 2 für den zweiten. Nur eigene abgeschlossene Suno-Aufgaben sind möglich.

Um mit einer eigenen Aufnahme zu beginnen, importiere sie mit upload oder nutze upload-cover und upload-extend, die direkt eine audio_url nehmen. add-vocals, add-instrumental und sample nehmen nur importierte Aufnahmen.

#Werkzeuge

Sende das Werkzeug als operation und seine Felder in parameters. Pflichtfelder sind markiert; der Preis ist ein Vielfaches eines Songs.

Create

  • inspoInspiration references×1.36Max-Modus verfügbar

    Generate a new song from 1–4 public audio references.

    audio_urls*tags

  • soundsSound effects×0.192

    Generate a sound effect from a text description.

    prompt*type

  • upsample-tagsEnhance style tags×0.08

    Expand and refine music style tags.

    tags*

  • mashupMashup×1Max-Modus verfügbar

    Create a mashup from exactly two platform tasks.

    task_ids*audio_indexestags

Start from your own audio

  • uploadImport audio×0.08

    Import external audio for use in later studio operations.

    audioFilePath*

  • upload-coverCover your audio×1Max-Modus verfügbar

    Upload audio and remake it in a new style in one step.

    audio_url*customtagspromptinstrumental

  • upload-extendExtend your audio×1Max-Modus verfügbar

    Upload audio and continue it from a chosen second.

    audio_url*continue_at*prompttags

  • add-vocalsAdd vocals×1Max-Modus verfügbar

    Layer vocals onto your uploaded instrumental or song.

    task_id*audio_indexcustomprompttags

  • add-instrumentalAdd instrumental×1Max-Modus verfügbar

    Layer an instrumental onto your uploaded vocals or song.

    task_id*audio_indextags

  • sampleSample to song×1Max-Modus verfügbar

    Generate a new song from an existing song or sample.

    task_id*audio_indexstart_s*end_s*instrumentaltags

Edit a song

  • extendExtend song×1Max-Modus verfügbar

    Continue and extend an existing song from a specified time.

    task_id*audio_indexcontinue_at*prompttags

  • concatAssemble full song×0.08

    Assemble existing segments into a complete song.

    task_id*audio_index

  • coverStyle cover×1Max-Modus verfügbar

    Rearrange an existing song in a new musical style.

    task_id*audio_indextags

  • replaceReplace section×1Max-Modus verfügbar

    Regenerate the music within a specified time range.

    task_id*audio_indexstart_s*end_s*infill_lyrics

  • remove-sectionRemove section×0.16

    Remove a specified time range from a song.

    task_id*audio_indexstart_s*end_s*

  • cropCrop audio×0.16

    Keep only the specified time range.

    task_id*audio_indexstart_s*end_s*

  • fade-inFade in×0.16

    Add a fade-in effect to the beginning of a song.

    task_id*audio_indexduration_s*

  • fade-outFade out×0.16

    Add a fade-out effect to the end of a song.

    task_id*audio_indexduration_s*

  • adjust-speedAdjust speed×0.48

    Change playback speed without changing pitch.

    task_id*audio_indexspeed*keep_pitch

  • remasterRemaster×1

    Improve the clarity, loudness, and overall texture of a song.

    task_id*audio_indexvariation_category

  • add-stemAdd a stem×1Max-Modus verfügbar

    Layer a new stem onto an existing song.

    task_id*audio_indextags

Stems, voices and models

  • stemsExtract a stem×2

    Extract a selected stem from a song.

    task_id*audio_indexstem_type

  • stems-allSeparate all stems×4.8

    Separate every available stem in a song.

    task_id*audio_index

  • personaCreate Persona×0.08

    Create a singer Persona from a song or Vox result.

    task_id*audio_indexname*describestyles

  • create-voiceCreate voice×0.32

    Create a reusable voice from a public audio URL.

    audio_url*

  • create-modelTrain a custom model×19.2

    Train a model on 6–24 of your own tracks, then use it as custom_model_id. Training can take about 20 minutes.

    name*audio_urls*

  • voxExtract Vox×0.08Veraltet

    Deprecated: make a Persona straight from a song instead.

    task_id*audio_indexvocal_start_svocal_end_s

Export and analyse

  • downloadDownload audio×0.032

    Get a song as MP3, M4A or WAV files.

    task_id*audio_indexformats

  • generate-mp4Generate music video×0.08

    Render a song as an MP4 music video.

    task_id*audio_index

  • midiGenerate MIDI×1

    Convert a song into a MIDI result.

    task_id*audio_index

  • aligned-lyricsLyrics timeline×0.016

    Generate a line-aligned lyrics timeline.

    task_id*audio_index

  • bpmAnalyze BPM×0.016

    Analyze the tempo of a song.

    task_id*audio_index

* Pflichtfeld. Der Werkzeuge-Tab der Workbench füllt diese für einen eigenen Song aus.

#Preis

Ein Song kostet den Katalogpreis; jede Anfrage liefert zwei Songs. Ein Werkzeug kostet diesen Preis mal seinem Faktor, und max_mode verdoppelt die Werkzeuge, die ihn bieten. Angebot und Reservierung nutzen diese Faktoren, abgerechnet wird nach den tatsächlichen Kosten, und fehlgeschlagene Aufgaben werden erstattet.

#Ergebnis

GET /v1/music/tasks/{task_id} antwortet jederzeit; GET /v1/music/tasks/{task_id}/content liefert die Audiodatei des ersten Songs, sobald die Aufgabe fertig ist (vorher 400). Eine fertige Aufgabe enthält:

  • url

    Das Audio des ersten Songs.

  • assets

    Jede Datei der Aufgabe: type (audio, video, image, midi, archive oder file) und url.

  • data.music

    Die audio_url der Songs, der Reihe nach.

  • data.lyrics

    Der Text: text und title.

  • data.result

    Das eigene Ergebnis des Werkzeugs: music[] (audio_id, title, lyrics, tags, duration, audio_url, image_url), persona_id, model_id, upsampled_tags, avg_bpm, files, videoUrl, alignment usw.

  • billing

    Was die Aufgabe nach der Abrechnung kostet.

Lade die benötigten Dateien herunter: Sie werden 3 Tage aufbewahrt.

#Zugehörige Fehler

  • 400 invalid_requestEin benötigtes Feld fehlt (task_id_required, continue_at_required …) oder liegt außerhalb des Bereichs (style_weight_out_of_range, duration_out_of_range, max_mode_requires_custom …). Es wird nichts berechnet.
  • 400 source_task_not_foundtask_id ist keine deiner abgeschlossenen Suno-Aufgaben; source_task_not_ready, solange sie noch läuft.
  • 410 media_expiredDie Dateien der Aufgabe wurden nach 3 Tagen gelöscht. /content vor dem Ende der Aufgabe antwortet mit 400: frage stattdessen die Aufgabe ab.
  • 404 not_foundUnbekannter Pfad, unbekannter Modellname oder eine abgelaufene bzw. fremde task_id.
  • 401Ungültiges oder fehlendes Bearer-Token. Auf diesem Pfad gibt es kein error.code — werten Sie den Status aus.
  • 402 insufficient_user_quotaDas Wallet-Guthaben deckt die vorab reservierte Schätzung nicht.
  • 429Anfragelimit des Kontos (standardmäßig 500 Modellanfragen pro Minute). Warte und versuche es erneut; wenn Retry-After gesendet wird, warte so lange. Ein 429 mit insufficient_user_quota ist dagegen das tägliche Ausgabenlimit.
  • 503 model_not_foundUnbekanntes Modell, oder derzeit bedient es kein funktionsfähiger Kanal.

Vollständige Fehlercode-Tabelle →

#Beispielanfrage

# a song: describe it
curl https://apiking.ai/v1/music/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "suno", "prompt": "a warm cinematic piano theme", "instrumental": true}'

# or write the lyrics yourself
curl https://apiking.ai/v1/music/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "suno", "custom": true, "title": "Neon Rain",
       "prompt": "[Verse]\nCity lights in the rain\n[Chorus]\nWe run till dawn",
       "style": "synthwave, female vocal"}'

# poll every 5s until completed
curl https://apiking.ai/v1/music/tasks/$TASK_ID -H "Authorization: Bearer sk-YOUR_KEY"

# a tool on the second song: extend it from 0:60
curl https://apiking.ai/v1/music/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "suno", "operation": "extend",
       "parameters": {"task_id": "'$TASK_ID'", "audio_index": 2, "continue_at": 60}}'

#Antwort

response.json
// POST — submit accepted
{"id": "task_xxx", "task_id": "task_xxx", "object": "music.task", "model": "suno", "status": "queued"}

// GET /v1/music/tasks/{task_id}
{
  "task_id": "task_xxx",
  "object": "music.task",
  "operation": "music",
  "status": "completed",
  "progress": "100%",
  "url": "https://…/audio/task_xxx",
  "assets": [
    {"type": "audio", "url": "https://…"},
    {"type": "audio", "url": "https://…"},
    {"type": "image", "url": "https://…"}
  ],
  "data": {
    "music": [{"audio_url": "https://…"}],
    "lyrics": {"title": "Neon Rain", "text": "[Verse] …"},
    "result": {"music": [{"audio_id": "…", "title": "Neon Rain", "duration": 182.4, "audio_url": "https://…", "image_url": "https://…"}]}
  },
  "billing": {"…": "…"}
}

Immer noch nicht gelöst?

Senden Sie uns die Anfrage-ID oder die Fehlermeldung, und wir sehen uns das an.