> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.beatapi.io/audio-api/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server. # Audio API > Generate songs and work on them with Suno v6 and Google Lyria through one asynchronous endpoint; every call is billed at a fixed price whatever the song length. Create one asynchronous music task with a stable BeatAPI model ID. One endpoint carries every music model: write a song, then work on it by naming the task that made it. A call is billed at one fixed price, whatever the song's length. `POST https://api.beatapi.io/v1/audios/tasks` `POST /v1/audios/generations` is the same route under a second name, so a client written for another gateway's `/v1/audios/generations` only needs its base URL and API key changed. The reply is `201` with `{"data": task}`; save `data.id` and poll `GET /v1/tasks/{task_id}` until `status` is `succeeded` or `failed`, as for [images and videos](/quick-guide#get-task-status). `GET /v1/media/models?media_type=audio` lists the models. > **Warning** > > **Beta.** The music models are served through third-party routes, not the model makers' own APIs. A model may be briefly unavailable or queue longer than usual, and its options may change. A task that fails is not billed. ## Models | Model | Family | What it is | Page | | -------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------- | | `suno-v6` | Suno | The default Suno model: natural vocals and rich detail. Eighteen actions, from songs to stems, WAV, MIDI and personas. | [Suno v6](/audio-api/suno-v6) | | `suno-v6-mini` | Suno | Lighter and faster. | [Suno v6](/audio-api/suno-v6) | | `suno-v6-wild` | Suno | Bolder, more distinctive styles. | [Suno v6](/audio-api/suno-v6) | | `lyria-3.5` | Google Lyria | Google's flagship music model: full songs with vocals up to four minutes, with length and tempo you set. | [Lyria](/audio-api/lyria) | | `lyria-3-pro` | Google Lyria | The previous Lyria generation, at the same price. | [Lyria](/audio-api/lyria) | Every model takes `model` and `action` (default `generate`); each family has its own actions and fields, listed on its page. A field the model and action do not read is refused with `400 bad_request`, never ignored, so a call is not billed for a song that is not the one you asked for. ## Make a song ```bash curl https://api.beatapi.io/v1/audios/tasks \ -H "Authorization: Bearer $BEATAPI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: song-001" \ -d '{ "model": "suno-v6", "prompt": "A warm acoustic folk song about driving home at dusk" }' ``` ```json { "data": { "id": "task_9Fh2Lq", "object": "task", "task_kind": "audio", "media_type": "audio", "model": "suno-v6", "status": "queued", "created_at": 1782210000, "output": null } } ``` (The task object also carries `usage`, `request_id`, `poll_after_seconds` and the other fields every task has; they are left out here.) ## Work on a song you made A follow-up names the task that made the song in `source_task_id` and, when the task made more than one song, the song in `audio_id`. `audio_id` is one of `output.tracks[].id`; leave it out for the first song. `source_task_id` must be one of your own tasks, otherwise the call returns `400 bad_request` (`source_task_id does not name a task of yours`). Do not send `audio_id` without `source_task_id`. A follow-up uses a model of the same family as the song: a Suno song is extended with a Suno model and a Lyria song with a Lyria model. Naming a song of the other family returns `400 bad_request` with `source_task_id was made by suno-v6, which lyria-3.5 cannot work on; use a suno model for this follow-up`. Each follow-up is a new task with its own `id`, its own price and its own result. ## The result When the task succeeds, `output` carries the files in `media`, the primary file in `url`, and two audio-only fields: ```json { "data": { "id": "task_9Fh2Lq", "status": "succeeded", "task_kind": "audio", "media_type": "audio", "model": "suno-v6", "output": { "media": [ { "type": "audio", "url": "https://media.beatapi.io/outputs/task_9Fh2Lq/0.mp3", "mime_type": "audio/mpeg" } ], "url": "https://media.beatapi.io/outputs/task_9Fh2Lq/0.mp3", "r2_url": "https://media.beatapi.io/outputs/task_9Fh2Lq/0.mp3", "tracks": [ { "id": "6b0f8f4e-2c1a-4f52-9a53-1d8d3f0c7a11", "title": "Driving Home", "tags": "warm acoustic folk, male vocal", "lyrics": "[Verse]\nThe road is gold and the dashboard hums\n...", "duration": 148.4, "audio_url": "https://media.beatapi.io/outputs/task_9Fh2Lq/0.mp3", "image_url": "" } ] } } } ``` The ids and URLs above are illustrative; read the ids from your own task. `tracks` and `data` appear only on audio tasks. | Field | Meaning | | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `output.tracks[]` | One entry per song or stem the call made. Suno's song actions return one or two songs, Lyria's one, for the one price. | | `tracks[].id` | The id a follow-up sends as `audio_id`. | | `tracks[].title`, `tags`, `lyrics`, `duration` | The song's title, style tags, lyrics and length in seconds. Present when the action produces them. | | `tracks[].name` | The stem's name, on Suno `separate` results. | | `tracks[].audio_url`, `image_url` | The song's file and its cover art. | | `output.data` | What an action returns that is not a file, such as the lyrics from `lyrics`. Absent on the others. | | `output.media[]` | The files of the result, each with its `type` and `mime_type`; songs, stems and WAV files are `audio`. | ## Completion callback Any request may carry `callback_url`, the same optional field the image and video endpoints take. It is not part of the action tables on the model pages because every action accepts it. It is not available in the web playground. **`callback_url`** `string` An address to notify when this task succeeds or fails: a public HTTPS URL on the same scheme, host and port as one of your enabled [webhook endpoints](/webhooks), which signs the delivery with its `secret`. **Length**: ≤ 2048 characters * Register the endpoint first with `POST /v1/webhooks`. BeatAPI sends `task.succeeded` or `task.failed` with the same body, headers and retries as an account webhook; an account endpoint subscribed to the event receives it too, and an address identical to that endpoint’s is notified once. * The callback stops when the signing endpoint is deleted, disabled or moved to another host. **If the value is wrong** * The value is not a string: `"callback_url" must be a string.` * The address is longer than 2048 characters: `"callback_url" must be at most 2048 characters.` * It is not a URL, or has no host or no `http` or `https` scheme: `"callback_url" must be a valid https URL.` * It uses `http`, or points to a private or otherwise non-public address: `"callback_url" must be a public HTTPS URL.` * No enabled webhook endpoint has the same scheme, host and port: `"callback_url" must be on the host of one of your active webhook endpoints, whose secret signs it; register one with POST /v1/webhooks.` --- ## Errors A request the gateway refuses returns an [error envelope](/errors) and is not billed: ```json { "error": { "code": "bad_request", "message": "style is read only in custom mode; send custom_mode true with it", "retryable": false, "request_id": "202611260307541272151438268d9d6mNDNwzi9" } } ``` Each model page lists the messages you will meet most often. Terminal task failures follow the [error codes](/errors) of every other task; a failed task is refunded. ## Files and expiry Songs, stems and WAV files are hosted on BeatAPI's media storage and stay available for at least 72 hours after the task finishes. Download and keep what you need within that time; the link stops working afterwards. Your [webhook](/webhooks) endpoints receive the same output when a task finishes; `callback_url` adds a one-off address for a single task. ## Prices Every call costs one fixed price per action, the same for a 30-second and a four-minute song. Each model page has its price list; `GET /v1/pricing` shows one row per action. ## Docs - [Suno v6](https://docs.beatapi.io/audio-api/suno-v6.md): Suno v6, v6 Mini and v6 Wild on BeatAPI — songs from a description or your lyrics, then extend, cover, stems, WAV, MIDI, lyrics and personas through one action field; a fixed price per call. - [Lyria 3.5 and Lyria 3 Pro](https://docs.beatapi.io/audio-api/lyria.md): Google Lyria 3.5 and Lyria 3 Pro on BeatAPI — full songs with vocals from a description or your lyrics, with the length and tempo you set, then extend a song or rewrite a section; $0.07 a song.