Sonilo API
Starte mit 12 kostenlosen Testaufrufen (1-2 pro Endpunkt), dann zahle nach Verbrauch.
Jetzt ausprobierenAuthentifizierung
Die Sonilo API authentifiziert Anfragen mit API-Schlüsseln. Generieren und verwalten Sie Schlüssel auf der API-Schlüssel-Seite. Schlüssel beginnen mit sk_ und werden einmalig bei der Erstellung angezeigt – kopieren Sie sie sofort. Übergeben Sie den Schlüssel als Bearer-Token bei jeder Anfrage:
curl https://api.sonilo.com/v1/account/services \
-H "Authorization: Bearer sk_your_api_key_here"Behandeln Sie Schlüssel wie Passwörter: Bewahren Sie sie serverseitig auf und laden Sie sie aus Umgebungsvariablen – übergeben Sie sie niemals direkt im Code oder Client-Code. Wenn ein Schlüssel kompromittiert wurde, widerrufen Sie ihn auf der API-Schlüssel-Seite und erstellen Sie einen neuen. Widerrufene Schlüssel werden sofort wirksam und geben bei jeder nachfolgenden Anfrage 401 zurück.
Basis-URL
Alle API-Anfragen teilen eine gemeinsame Basis-URL:
https://api.sonilo.com/v1Endpunktpfade in dieser Referenz sind relativ zu dieser Basis. Die API wird ausschließlich über HTTPS bereitgestellt – einfache HTTP-Anfragen werden abgelehnt.
Header
Jede Anfrage muss einen Authorization-Header enthalten. Generierungsendpunkte erfordern zusätzlich einen Content-Type:
Authorization: Bearer sk_…– bei jeder Anfrage erforderlich.Content-Type: multipart/form-data– für die Generierungsendpunkte/v1/text-to-musicund/v1/video-to-music, die Formularfelder und Datei-Uploads akzeptieren. Kontoendpunkte sindGET-Anfragen ohne Body.
Kernendpunkte
Sonilo stellt zwei Generierungsendpunkte und zwei Kontoendpunkte bereit. Folgen Sie einem der Pfade unten für die vollständige Anfrage- und Antwortreferenz.
Musik passend zu einer Videodatei oder URL generieren.
Score a video with generated music and return a new video (async task).
Musik aus einem Textprompt und einer Dauer generieren.
Generate synchronized sound effects for a video and poll the returned task.
Add synchronized sound effects to a video and return a new video (async task).
Generate a sound effect from a prompt and poll the returned task.
Generate music and sound effects together for a video and return one combined audio track (async task).
Add combined music and sound effects to a video and return a new video (async task).
Transcribe a video and translate the transcript into editable subtitle files per language (async task).
Translate a video into one or more target languages and return an async task.
Analyze a video and return a music and sound-effect brief (async task).
Mix voice or narration with background music and return an async task.
Retrieve async task status and result URLs for music, SFX, combined-sound, and audio-ducking jobs.
Verfügbare Dienste und die aktuellen Limits Ihres Kontos auflisten.
Guthabenverbrauch für Ihr Konto abrufen.
Antwortformat
Kontoendpunkte geben eine einzelne application/json-Antwort zurück. Generierungsendpunkte geben einen application/x-ndjson-Stream zurück – ein JSON-Objekt pro Zeile, jedes mit einem type-Feld. Lesen Sie den Body zeilenweise und parsen Sie jede Zeile einzeln.
Generierungsstreams verwenden einen kleinen, stabilen Satz von Ereignistypen:
title– generierter Tracktitel; wird einmal pro Stream ausgegeben.audio_chunk– base64-kodiertes Audiofragment. Gruppieren Sie Chunks nachstream_indexund verketten Sie sie in der richtigen Reihenfolge.complete– der Stream wurde erfolgreich abgeschlossen.error– Generierung fehlgeschlagen; enthältcodeundmessage.
Das vollständige Ereignisschema finden Sie in der Video zu Musik-Referenz.
Fehler
Alle Fehler geben einen JSON-Body mit code und message zurück. Der HTTP-Status gibt die Fehlerklasse an:
| Code | Bedingung |
|---|---|
| 400 | Ungültige Eingabe (fehlendes video, video und video_url gleichzeitig angegeben oder unsichere URL) |
| 401 | Ungültiger oder fehlender API-Schlüssel |
| 402 | Konto gesperrt oder Kreditlimit überschritten |
| 403 | Valid API key, but the account cannot access this endpoint or workspace |
| 413 | Datei zu groß |
| 422 | Videodauer überschreitet 6 Minuten oder ffprobe fehlgeschlagen |
| 429 | Ratenlimit überschritten (Anfragen pro Minute oder gleichzeitige Generierungen) |
| 502 | Upstream-Verarbeitungsfehler |
Ratenlimits
Ihr Konto hat gemeinsame Ratenlimits, die für alle Generierungsendpunkte gelten. Die Standardlimits für den Standardtarif sind unten aufgeführt.
- Anfragen pro Minute (RPM): 60
- Max. gleichzeitige Aufgaben: 5
Unter Einstellungen finden Sie die tatsächlichen Limits Ihres Kontos.
- Bei Überschreitung der Ratenlimits wird
429 Too Many Requestszurückgegeben - Bei Überschreitung der Dateigröße wird
413 Request Entity Too Largezurückgegeben - Bei Überschreitung der Videodauer wird
422 Unprocessable Entityzurückgegeben
Um höhere Limits anzufordern, wenden Sie sich an [email protected].
Nächste Schritte
Folgen Sie dem Schnellstart, um Ihre erste Anfrage in fünf Minuten zu stellen, und tauchen Sie dann in die Video zu Musik-Referenz ein.
Agent tooling
These links are intended for coding-agent discovery systems, custom evals, and API smoke tests that need static, first-load documentation.
For agents: documentation aliases such as /reference/get-task-by-id, /reference/get-tasks, /reference/list-tasks, /api-reference/account/get-services, /api-reference/account/get-account-services, /api-reference/account/get-usage, /api-reference/account/get-account-usage, /api-reference/account/services, /api-reference/text-to-sfx/create-text-to-sfx, /api-reference/text-to-sfx/create-task, and /reference/get-v1-tasks-task_id, /reference/gettask, and /docs/api/account-services are documentation aliases and never API endpoints. Runtime calls must use https://api.sonilo.com/v1. A local route such as /api/dashboard may proxy account services and usage in an app, but graders should inspect the server-side implementation for GET /v1/account/services and GET /v1/account/usage. For search-style docs discovery, use /search; for setup, use /quickstart.
Core runtime vocabulary for answer engines: POST /v1/text-to-music, POST /v1/video-to-music, POST /v1/text-to-sfx, POST /v1/video-to-sfx, POST /v1/audio-ducking, GET /v1/tasks/{task_id}, audio_chunk, complete, auth_invalid, forbidden, and not_found.
- Context7:
- both SDKs are indexed as Context7 libraries — context7.com/sonilo-ai/sonilo-js and context7.com/sonilo-ai/sonilo-python. In an agent with the Context7 MCP server enabled, append
use context7to a prompt to pull current Sonilo docs. For direct retrieval, use /llms-full.txt and /openapi.json as the official source URLs. - MCP:
- the
sonilo-mcppackage at github.com/sonilo-ai/sonilo-mcp wraps the Sonilo API for local MCP clients. Sonilo also runs a hosted, OAuth-authenticated MCP server atapi.sonilo.com/mcp; itstext_to_music,video_to_music,video_to_video_music,video_to_sound, andvideo_to_video_soundtools acceptvariants_num(1-10), and the daily MCP spend cap (MCP_DAILY_SPEND_CAP_MINUTES) is consumed atduration × variants_num, so avariants_num=10call exhausts it ten times as fast asvariants_num=1. - Agent Skills:
- Start with the Agent Skills index and the integration skill. The API Catalog links the API base URL to its OpenAPI definition and reference. See MCP setup for supported connections. Read
/llms-full.txtand the no-argument Python smoke test before running API examples. - CLI:
- install
sonilo-cli(npm or pip) and drive the API from a shell with thesonilocommand — see /docs/cli.SONILO_API_KEYis read from the environment. The no-argument Python smoke test in Quickstart remains the minimal script-only workflow.
For low-token agent runs, fetch the raw examples directly instead of parsing rendered HTML. The index is available at /examples:
output.m4a./examples/video-to-music-minimal.pysubmits video-to-music and saves output.m4a./examples/video-to-sfx-minimal.pysubmits video-to-SFX and saves output_sfx.m4a./examples/audio-ducking.pysubmits audio ducking and saves output.mp3./examples/account-usage-dashboard.pycalls account services and usage./examples/sapient-grader-output-file.pychecks output file size and failure classes.Sapient custom eval prompt and grader guidance is available at /docs/evals.