Notes for the scripts/music/suno.py adapter. Update this doc (and the
adapter) when Suno ships breaking changes.
Bearer token. Key lives in SUNO_API_KEY (env or .env). Obtain from
Suno account settings. The adapter also honors SUNO_BASE_URL to support
proxied deployments; default is https://api.suno.ai.
-
POST /api/generate/v2— kick off a generation. Body keys used by the adapter:prompt— the song description (natural-language, not lyrics).tags— comma-separated style tags (optional).make_instrumental— boolean.wait_audio—falseso we can poll ourselves. Returns a list of job descriptors; each has anid(a.k.a.song_id).
-
GET /api/feed?ids=<job_id>— poll. Returns a list of items. Look foraudio_urlpopulated (success) orstatus == "error"(failure).
Default interval 4 s, timeout 5 min. Adjust in scripts/music/suno.py:
_POLL_INTERVAL_SECONDS = 4.0
_POLL_TIMEOUT_SECONDS = 300.0Songs typically come back in 60–90 s; longer tracks can push to 3 min.
The adapter sends:
{
"prompt": "<user prompt>",
"tags": "<style>", // optional
"make_instrumental": true,
"wait_audio": false
}If you need lyrics: set make_instrumental: false and put the lyrics into
the prompt, OR use Suno's Custom Mode (requires title + lyrics fields —
not implemented here yet; extend the adapter if needed).
audio_url points to an MP3. The adapter streams it to
build/music/suno_<job_id>_<take_idx>.mp3.
- 401 Unauthorized —
SUNO_API_KEYmissing or wrong. - 429 Too Many Requests — rate limited. Back off and retry.
status: errorin feed — surfaceerror_messageto the user; no retry loop (user decides).- Timeout — increase
_POLL_TIMEOUT_SECONDS, or accept that the job will finish later and abort this take.
If a user wants to specify lyrics/title/structure, extend SunoProvider:
- Add fields to
SongSpec(title,lyrics). - Switch to
POST /api/generate(v1 custom) or send the extra fields in v2 once Suno supports them. - Document the new fields in
song_builder_agent.mdso the sub-agent knows to ask for them.
Keep the existing default path (prompt + tags + instrumental) working — most promo use cases don't need lyrics.