API guides

Suno Lyrics API: Generate Lyrics Before the Song

How to call the Suno lyrics endpoint on DreamTo: the 200-character prompt, the lyricsData result, passing a draft to custom-mode generate, limits and price.

A wooden mallet and five carved chisels on a scarred workbench among curled wood shavings, lit by warm lamplight against darkness
On this page

The Suno lyrics endpoint writes song lyrics from a short description and returns two or three different drafts per request. You read them, pick one, and pass its text to a custom-mode generate call. The words are settled before any audio is made, and a lyrics request costs a fraction of a song request.

This guide covers ai-music-api/generate-lyrics: the request, the result, the limits, and the hand-off to generate. The create-and-poll flow is shared by every Suno endpoint and is explained in the Suno music API guide, so it only gets a few lines here. All request shapes come from the Suno lyrics docs.

What the endpoint does#

You describe a theme, mood, style or story in one field. The endpoint returns several complete sets of lyrics, each with a title and sections marked [Verse], [Chorus] and so on. The more specific the description, the closer the lyrics, according to the docs.

It does not make audio, and the result has no file links. It is plain text. That is the point: you can show the drafts to a user, edit them, or filter them in your own code before spending on a song.

The request#

model is ai-music-api/generate-lyrics, and the parameters go in input. There is exactly one:

FieldValues
promptRequired. The theme, mood, style or story of the lyrics, up to 200 characters

You can also pass a top-level callBackUrl to have the result posted to your server instead of polling. The body accepts only model, callBackUrl and input. An undeclared field in input, a wrong type or a prompt over 200 characters returns code: 422 with an English reason in msg, and no task is created or charged.

Two rules from the docs are worth building into your own input checks:

  • Keep artist names out of prompt. A description that names an artist, or that moderation flags, makes the task fail.
  • The limit is 200 characters, far shorter than the 3,000 allowed for a simple-mode generate prompt. A long creative brief does not fit here.

Create and poll in three steps#

Every Suno endpoint is created with POST /api/v1/jobs/createTask at https://api.dreamto.ai, authenticated with Authorization: Bearer $DREAMTO_API_KEY (authentication). Every response has HTTP status 200, and the outcome is the code in the body: 200 is success, 422 a rule broken, 402 a balance below the price, 429 a rate limit.

bash
# 1. Create the taskcurl -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-lyrics",    "input": {      "prompt": "A nostalgic song about childhood memories and growing up in a small town"    }  }'# 2. Poll with the data.taskId from step 1, about every 10 secondscurl "https://api.dreamto.ai/api/v1/jobs/recordInfo?taskId=<taskId>" \  -H "Authorization: Bearer $DREAMTO_API_KEY"

data.state moves through waiting, queuing and generating until it is success or fail. On success the lyrics are in data.response. On fail, data.failCode and data.failMsg say why; failed tasks are not charged.

Reading the result#

The drafts are in response.resultObject.lyricsData, a list with usually two or three entries. Each entry has:

FieldMeaning
titleA title for the draft
textThe lyrics, with section markers such as [Verse] and [Chorus]
statuscomplete or failed
error_messageThe reason when a draft did not complete
tagsA list holding a suggested music style description

Check status before using an entry. A request can come back with a mix, and a failed draft carries its reason in error_message instead of usable text. Treat tags as a hint: it is a suggestion, not a setting.

Generated lyrics are kept for 14 days. The taskId is a 32-hex-digit ID that only an API key of the same account can query, and an unknown or expired one returns code: 422 with msg: recordInfo is null. Another detail from the query response: param echoes your create request with input as a JSON string, so it needs a second parse.

From lyrics to a song#

The docs describe the intended flow: pick the lyrics you like and pass them as lyrics to the generate endpoint in custom mode. The script below does the whole chain. It asks for lyrics, takes the first complete draft, and creates a song from it. It needs only requests and the DREAMTO_API_KEY variable.

python
import osimport timeimport requestsBASE_URL = "https://api.dreamto.ai"HEADERS = {"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"}def run_task(endpoint: str, task_input: dict) -> dict:    payload = {"model": f"ai-music-api/{endpoint}", "input": task_input}    created = requests.post(        f"{BASE_URL}/api/v1/jobs/createTask", headers=HEADERS, json=payload, timeout=60    ).json()    if created["code"] != 200:        raise SystemExit(f"{created['code']}: {created['msg']}")    task_id = created["data"]["taskId"]    while True:        record = requests.get(            f"{BASE_URL}/api/v1/jobs/recordInfo",            headers=HEADERS,            params={"taskId": task_id},            timeout=60,        ).json()["data"]        if record["state"] in ("success", "fail"):            break        time.sleep(10)    if record["state"] == "fail":        raise SystemExit(f"{record['failCode']}: {record['failMsg']}")    return recordlyrics_record = run_task(    "generate-lyrics",    {"prompt": "A slow synth-pop song about the last train home, quiet and a little hopeful"},)drafts = [    d    for d in lyrics_record["response"]["resultObject"]["lyricsData"]    if d["status"] == "complete"]if not drafts:    raise SystemExit("no complete draft, try a different prompt")draft = drafts[0]tags = draft.get("tags") or "Slow synth-pop"style = ", ".join(tags) if isinstance(tags, list) else tagssong_record = run_task(    "generate",    {        "custom_mode": True,        "instrumental": False,        "model": "V6",        "title": draft["title"][:80],        "style": style[:1000],        "lyrics": draft["text"][:5000],    },)for song in song_record["response"]["data"]:    print(song["id"], song["duration"], song["audio_url"])

A few notes on the hand-off, all from the generate docs:

  • Custom mode requires title (up to 80 characters) and at least one of style, lyrics or negative_tags. The slices in the script keep a draft inside those limits: style up to 1,000 characters, lyrics up to 5,000.
  • In custom mode lyrics takes priority over prompt. If both are sent, the song sings lyrics.
  • instrumental and model are required on every generate request. model here is the Suno version (V6, V6_MINI or V6_WILD), not the endpoint.
  • Each generate request makes two songs, listed in response.data, each with its own id, audio_url, image_url, duration and the lyrics in prompt.

The full parameter list for custom mode, including vocal_gender, duration and the 0 to 1 weights, is in the Suno music API guide. Which fields to send in each mode is covered in Suno custom mode vs simple mode.

Edit before you generate#

Nothing forces you to pass a draft through unchanged. The text is a plain string, so you can trim a verse, swap a line, or join the chorus of one draft to the verse of another before sending it as lyrics. The catalog's tips for the lyrics model point the same way: read each line aloud against a likely melody, and put any line that must stay in the chorus on its own so it can be checked across drafts.

Writing prompts that fit in 200 characters#

The catalog's tips for this model are to tell the generator who is speaking, which language to use and what changes over the song. With 200 characters you cannot say much, so choose those three over adjectives. Each prompt below is original, written to fit the limit, and meant for ai-music-api/generate-lyrics.

text
A song in English sung by a night-shift baker: the town sleeps, the ovens warm, and by the last verse the first customer arrives.

It names the speaker and gives the song a change between the first and last verse, which is where the structure comes from.

text
Write in Spanish: a farewell from a sister leaving for another city, bittersweet, with a short chorus that repeats one promise.

It sets the language, the point of view and a repeating chorus line.

text
A cheerful jingle-length chorus about a repaired bicycle, simple rhymes, easy to sing along with.

It asks for one thing, a chorus, rather than a full song, so the draft is short and singable.

Run each of them a few times. A single request returns two or three drafts, and the endpoint is priced low enough that comparing several is cheap.

Callbacks instead of polling#

Pass a public http or https URL as callBackUrl and DreamTo POSTs the result once, when the task succeeds or fails. On success the body is {"code": 200, "msg": "All generated successfully.", "data": {"callbackType": "complete", "task_id": ..., "data": ...}}, where data.data holds the same list as response.resultObject.lyricsData. On failure code is the failure code, msg the reason, and data has only callbackType and task_id.

The request carries X-DreamTo-Event: task.completed and X-DreamTo-Timestamp. If you generated a signing secret in the console it also carries X-DreamTo-Signature:

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

status is success or failed. Answer with any 2xx, otherwise the callback is retried. The task callback docs cover the secret and retry rules.

What it costs#

Lyrics are billed per request: each succeeded task is charged once. Invalid requests and failed tasks are not charged. As of December 2026, the prices on /prices are:

EndpointPrice per request
ai-music-api/generate-lyrics$0.002
ai-music-api/generate$0.06

The script above makes one lyrics request and one generate request: $0.002 + $0.06 = $0.062. Ten lyrics requests cost 10 × $0.002 = $0.02, a third of one song request. That ratio is the reason to write the words first, since a weak set of lyrics costs a song request to find out.

Related endpoints in the same family are timestamped lyrics, which returns word timing for a song you have already generated, and boost music style, which expands a short style description into a fuller one; both are listed with the rest of the catalog on /models, and you can try the lyrics endpoint in the playground first. If the song you generated ends too early, see extend.

Limits to plan around#

  • The prompt is capped at 200 characters and is the only input.
  • Artist names in the prompt make the task fail.
  • Drafts can come back with status: failed, so filter before you use them.
  • Lyrics are kept for 14 days after the task is created.
  • The result is text only. There is no language, length or structure parameter, so those instructions go into the prompt itself.

FAQ#

How long can a Suno lyrics prompt be?#

The prompt field takes up to 200 characters and is the only input of ai-music-api/generate-lyrics. Anything over that returns code: 422 and no task is created or charged.

How many sets of lyrics does one request return?#

Usually two or three. They are in response.resultObject.lyricsData, each with a title, the lyrics in text, a status of complete or failed, an error_message and suggested styles in tags.

How do I turn generated lyrics into a song?#

Call ai-music-api/generate in custom mode (custom_mode: true) with a title and the draft's text as lyrics, plus instrumental and model. In custom mode lyrics takes priority over prompt, and the request returns two songs.

Does the lyrics endpoint cost anything if it fails?#

No. A task is charged once, only when it succeeds, and invalid requests and failed tasks are not charged. The balance is checked when the task is created, so a balance below the price returns code: 402.

Why did my lyrics task fail?#

The docs name two causes: a prompt that names an artist and a prompt that moderation flags. The reason is in failCode and failMsg on the task record.

  • Suno
  • API Guide