UniRouteUniRoute

Music generation API

Create Suno music tasks, confirm the charge, and download every generated track.

This generates music tracks using a Suno provider model. It uses a different interface from speech synthesis or TTS. Prepare your key and client using the quickstart:

python3 uniroute-media.py --key-file ~/.config/uniroute/api-key \
  --budget-usd 0.15 --kind music --verify-idempotency \
  --state ./music-run.json --output ./music-output

The example model is ai-music-api/generate, with catalog mediaKind: "music", the Suno provider, and option acoustic, folk, warm. This is a style option; the commas and spaces are part of the complete value. The example quote per task is 0.084 USD, with catalog unit per_request. Use the current quote for the actual amount. A task may return two tracks. Do not create additional tasks or multiply the price yourself based on the number of outputs.

POST /v1/media/quote:

{
  "model": "ai-music-api/generate",
  "option": "acoustic, folk, warm"
}

POST /v1/media/tasks, with Idempotency-Key and the exact quoted amount you just received:

{
  "media_type": "music",
  "model": "ai-music-api/generate",
  "option": "acoustic, folk, warm",
  "prompt": "An instrumental acoustic folk melody, warm and peaceful, no vocals.",
  "max_cost_usd": "0.084"
}

Save data.task_id. Poll until both status: "success" and billing.state: "charged", then iterate through the urls object array and download every urls[].url. Do not add a Bearer token to music CDN requests. The client saves all outputs automatically and reports the task's actual charge.

Audio generation and settlement can take longer than images. Keep the state file while waiting and do not create another task. For released_unknown, stop, keep the original ID, and query or contact support. This state does not establish that a failure was free. See billing and recovery.