Skip to main content

Complete Workflow

This guide walks through the full flow of generating music with sunor: authenticate, create a task, poll until it completes, and use the audio output.

Prerequisites

  • A sunor account with an API key
  • Credits in your account (music costs 10 credits)

Step 1: Create a task

Submit a music generation request:
The example below uses Suno’s input shape (gpt_description_prompt, make_instrumental). Udio uses a different shape (prompt, lyrics_type) — see /models/udio before adapting this snippet to "model": "udio".
The response returns a task_id with status "pending". Credits are frozen immediately.

Step 2: Poll for results

Tasks take 30 seconds to 5 minutes to complete. Poll every 5-10 seconds until the status is terminal (success, failure, or timeout).

Step 3: Use the output

On success, the output.result contains an array of generated clips:

Downloading the audio

Audio URLs point to MP3 files hosted on Suno’s CDN. You can download them directly:

Full example

Putting it all together:

Next steps

Music generation modes

Learn about inspiration, custom, and continuation modes.

Error handling

Handle errors and implement retries.

Rate limits

Stay within rate limits with smart polling.

API Reference

Full endpoint documentation.