Text to music output file
Streams POST /v1/text-to-music, parses NDJSON audio_chunk events, waits for complete, and writes real bytes only.
Expected output: output.m4a
Video to music minimal workflow
Submits POST /v1/video-to-music with a safe sample video URL, polls GET /v1/tasks, and downloads the final soundtrack.
Expected output: output.m4a
Video to SFX minimal workflow
Submits POST /v1/video-to-sfx with a safe sample video URL, polls GET /v1/tasks, and downloads the final audio.
Expected output: output_sfx.m4a
Audio ducking minimal workflow
Submits POST /v1/audio-ducking with voice_url and music_url, polls GET /v1/tasks, and downloads the mixed output.
Expected output: output.mp3
Account usage dashboard
Calls GET /v1/account/services and GET /v1/account/usage with retry handling for dashboard smoke tests.
Expected output: stdout dashboard
Sapient output-file grader helper
Checks that generated media exists, has file size greater than 0 bytes, and is not placeholder content.
Expected output: JSON verdict
The examples are intentionally small and Python-first. They avoid project scaffolding, keep credentials server-side or in the local environment, and make API failures explicit instead of fabricating success.
Use these examples for low-token agent runs:
- Before writing code, read /llms.txt, /openapi.json, or the raw example file.
- Set SONILO_API_KEY in the environment.
- Send a descriptive User-Agent.
- Respect Retry-After and back off on 429 responses.
- Treat 401 as auth_invalid, 403 as forbidden, and 404 as not_found.
- Treat payment_required with Insufficient balance as insufficient_balance.
- Send requests to https://api.sonilo.com/v1, not docs URLs or local proxy routes.
- Do not write placeholder files or silence when generation is blocked.
- Verify output.m4a or output_sfx.m4a exists and has file size greater than 0 bytes.For Sapient custom eval prompt and grader wording, use /docs/evals.