Suno · Generate Music

ai-music-api/generate
AudioSunoSuno Musicgenerate

ai-music-api/generate is Suno's core creation endpoint: it turns a description or lyrics into complete songs with vocals or as instrumentals, two different versions per request.

With instrumental: true the songs have no vocals. The songs can then be extended, covered, separated into stems, turned into music videos and more (task_id + audio_id).

Authentication

Base URL
https://api.dreamto.ai
Authorization
Authorization: Bearer YOUR_API_KEY
Content-Type
application/json
Model name (model)
ai-music-api/generate
  • Simple mode (custom_mode: false): write one line describing the song in prompt and the model writes the lyrics; you can also attach a style, lyrics, and images, video, audio or MIDI as references. New users should start here.
  • Custom mode (custom_mode: true): set the title, style, lyrics and the styles to avoid (negative_tags) yourself, and tune the length, vocal gender, style adherence, creativity and variety.

Setup

The Suno endpoints use an asynchronous task protocol: every endpoint creates its task with POST /api/v1/jobs/createTask (model selects the endpoint and the parameters go in input) and is queried with GET /api/v1/jobs/recordInfo?taskId=; with callBackUrl the result is pushed to that URL when the task finishes. See the Suno introduction for the flow, chaining tasks and how long files are kept. The base URL is https://api.dreamto.ai; send the API Key in the Authorization: Bearer header.

Every response has HTTP status 200; the code in the body tells the outcome: 200 is success, anything else an error (see the response examples of each endpoint).

Parameters

model is ai-music-api/generate; the parameters go in input. Requests that break a rule return code: 422; no task is created or charged.

FieldValues
custom_modeRequired: false simple mode / true custom mode
instrumentalRequired: true makes an instrumental (no vocals)
modelRequired: V6 / V6_MINI / V6_WILD
promptOptional; the song description in simple mode, up to 3,000 characters; sung as lyrics in custom mode, up to 5,000 characters
titleRequired in custom mode, up to 80 characters
styleOptional, up to 1,000 characters
lyricsOptional, up to 5,000 characters; in custom mode it takes priority over prompt as the lyrics
negative_tagsOptional styles or traits to avoid
image_urls / video_urls / audio_urls / midi_urlsSimple mode only; up to 5 images, 1 video and 1 MIDI file, at most 10 items together with style and lyrics
durationCustom mode only, 10–360 seconds; the model decides when omitted
vocal_genderCustom mode only, m / f
style_weight / weirdness_constraint / audio_weightCustom mode only, 0–1 with at most 2 decimals; audio_weight cannot be used for instrumentals
varietyCustom mode only, an integer from 0 to 4, default 1
persona_id / persona_modelOptional Persona ID or Voice ID and its type (style_persona / voice_persona)

Pricing

Billed per request: each succeeded task is charged once at the model price shown in the console. The balance is checked for that price when the task is created (code: 402 when insufficient); invalid requests and failed tasks are not charged.

Quick start

Create a task to get data.taskId, poll about every 10 seconds and read response once state is success; or pass callBackUrl to be called back when the task finishes. $DREAMTO_API_KEY is your API Key.

cURLbash
# 1. Create the task
curl -X POST "https://api.dreamto.ai/api/v1/jobs/createTask" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ai-music-api/generate",
    "input": {
      "prompt": "An upbeat acoustic song about a summer road trip",
      "custom_mode": false,
      "instrumental": false,
      "model": "V6"
    }
  }'

# 2. Query the task
curl "https://api.dreamto.ai/api/v1/jobs/recordInfo?taskId=7d3f0a9c41e85b2f6a1c9e04b8d27f53" \
  -H "Authorization: Bearer $DREAMTO_API_KEY"

Callback

Pass callBackUrl (a public http / https URL) when creating the task; when the task succeeds or fails DreamTo POSTs the result there once (callback format): on success code is 200, data.callbackType is complete, data.task_id is the task ID and data.data the result; on failure code is the failure code (not 200), msg the reason, and data has only callbackType and task_id. DreamTo calls back once when the task finishes and sends no intermediate-stage (text / first) callbacks.

The request carries X-DreamTo-Event: task.completed, X-DreamTo-Timestamp (UTC, RFC 3339) and X-DreamTo-Signature:

X-DreamTo-Signature = hex( HMAC-SHA256( secret, X-DreamTo-Timestamp + "." + data.task_id + "." + status ) )

status is success when the task succeeded and failed when it failed. The secret is generated in the DreamTo console; without one no signature header is sent. Answer with any 2xx to acknowledge; otherwise the callback is retried.

Notes

  • Each request makes two songs, listed in response.data; each has its own id (the audio_id of follow-up endpoints), audio_url (MP3), stream_audio_url (streaming), image_url (cover), lyrics in prompt, style tags and duration in seconds.
  • Simple mode rejects the custom-only duration, vocal_gender, style_weight, weirdness_constraint, audio_weight and variety; custom mode rejects image_urls, video_urls, audio_urls and midi_urls.
  • midi_urls is only supported by V6_WILD; with another version V6_WILD is used.
  • vocal_gender only raises the likelihood of that voice and is not guaranteed.
  • taskId is issued by DreamTo (32 hex digits) and can only be queried with an API Key of the same account; an unknown or expired task returns code: 422 with msg: recordInfo is null.
  • The body accepts only model, callBackUrl and input; undeclared input fields, wrong types and values that break a rule return code: 422 with an English reason in msg; no task is created or charged.
  • Every file link in a result (audio, cover image, video and so on) is a DreamTo download link (/v1/tasks/{task_id}/artifacts/...) that works without an API Key and supports Range; files are kept for 14 days after the task is created, so download them promptly.
  • param echoes the create request, with input as a JSON string that needs a second parse; the credits used are not returned, and the charge is shown in the DreamTo console bills.
  • failCode / failMsg of a failed task come from the model service (content moderation, a source audio that cannot be downloaded and so on); internal errors are reported as failCode: "500" with failMsg: "Internal Error, Please try again later.".