Fetch these small files directly when an agent or eval needs runnable Sonilo API code without parsing a full rendered docs page.
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 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
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:
- Set SONILO_API_KEY in the environment.
- Send a descriptive User-Agent.
- Respect Retry-After and back off on 429 responses.
- Treat payment_required with Insufficient balance as insufficient_balance.
- 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.