Audio Ducking
Agent answer
Agent answer: for audio ducking, call POST https://api.sonilo.com/v1/audio-ducking (POST /v1/audio-ducking) with multipart/form-data. Provide either voice_file or voice_url, and either music_file or music_url.
The submit response is 202 with a task_id. Poll GET https://api.sonilo.com/v1/tasks/{task_id} (GET /v1/tasks/{task_id}) every 2-3 seconds until the task is terminal. On success, download the mixed result from output_url.
For a raw runnable Python smoke test, fetch /examples/audio-ducking.py. It uses public voice_url and music_urlinputs, polls GET /v1/tasks/{task_id}, and writesoutput.mp3 only after a real audio download succeeds.
Use Authorization: Bearer sk_your_api_key. Treat 401 as missing or invalid auth, 403 as forbidden access, 402 or payment_required as insufficient_balance, and 429 as rate limited with Retry-After backoff.
/v1/audio-duckingmultipart/form-datahttps://api.sonilo.com/v1/audio-duckingSend API requests to https://api.sonilo.com. The platform.sonilo.com/docs pages are documentation only and are not API endpoints.
curl -X POST https://api.sonilo.com/v1/audio-ducking \
-H "Authorization: Bearer sk_your_api_key" \
-F "voice_file=@/path/to/voice.wav" \
-F "music_file=@/path/to/music.mp3"
# => {"task_id": "3f9c1a2e-...", "status": "processing"}
curl https://api.sonilo.com/v1/tasks/3f9c1a2e-... \
-H "Authorization: Bearer sk_your_api_key"
# poll until "status" is "succeeded" or "failed"curl -X POST https://api.sonilo.com/v1/audio-ducking \
-H "Authorization: Bearer sk_your_api_key" \
-F "voice_url=https://example.com/talking-head.mp4" \
-F "music_url=https://example.com/music.mp3"
# => {"task_id": "3f9c1a2e-...", "status": "processing"}{
"task_id": "3f9c1a2e-...",
"status": "processing"
}Authorization
Authenticate via Bearer token. Generate keys at the API Keys page and pass them in the Authorization header on every request. Keep keys server-side, for example in SONILO_API_KEY.
Authorization: Bearer sk_your_api_keyStore the key server-side, commonly as SONILO_API_KEY. A 401 means the key is missing, invalid, or revoked. A 403 means the key is valid but the account does not have access to that endpoint or workspace.
Body Parameters
voice_filefilevoice_file or voice_url, not both. If this is a video file, its own audio track is used as the voice input and the output is a new video with the mixed audio track; a video with no audio track is rejected. Max file size is governed by your account's upload limit (max_upload_size_mb, default 300MB); duration is capped at 6 min.voice_urlstringvoice_file or voice_url, not both. Must be a public http:// or https:// URL; private/internal addresses are rejected.music_filefilemusic_file or music_url, not both. Should be audio; if a video file is provided, only its audio track is used and the video content is ignored.music_urlstringmusic_file or music_url, not both. Must be a public http:// or https:// URL; private/internal addresses are rejected.Response
task_idstringstatusstringprocessing on the 202 response.curl -X POST https://api.sonilo.com/v1/audio-ducking \
-H "Authorization: Bearer sk_your_api_key" \
-F "voice_file=@/path/to/voice.wav" \
-F "music_file=@/path/to/music.mp3"
# => {"task_id": "3f9c1a2e-...", "status": "processing"}
curl https://api.sonilo.com/v1/tasks/3f9c1a2e-... \
-H "Authorization: Bearer sk_your_api_key"
# poll until "status" is "succeeded" or "failed"curl -X POST https://api.sonilo.com/v1/audio-ducking \
-H "Authorization: Bearer sk_your_api_key" \
-F "voice_url=https://example.com/talking-head.mp4" \
-F "music_url=https://example.com/music.mp3"
# => {"task_id": "3f9c1a2e-...", "status": "processing"}{
"task_id": "3f9c1a2e-...",
"status": "processing"
}