ACE Music Lyrics Generation API Integration Guide

The ACE Music Lyrics Generation API can generate titles and lyrics based on a theme and music style. You can edit the lyrics first, then create a song through the custom mode of the Song Generation API. This guide explains the complete process of obtaining an API Token, submitting a lyrics request, reading the results, and using the lyrics to create a song.

Application Process

  1. Open the Ace Data Cloud Console. If you are not logged in, register or log in first.
  2. Select and copy the key in the API Key section of the General Application; if you do not have a key, click Create API Key. API Token and API Key in this guide refer to the same type of API credential.
  3. You can also manage keys in Credential Management. When using an ACE Music-specific application or a key with API restrictions, confirm that access to the Lyrics API is allowed; subsequent queries and song generation also require the corresponding Task and Song API permissions.
  4. Before creating paid content, check the application balance and key usage limits. If the balance is insufficient, click the “Recharge” button.

Replace YOUR_API_TOKEN in the examples with the copied Token and send it in the Authorization: Bearer YOUR_API_TOKEN request header. Store the Token on the server side; do not put it in public web pages or code repositories.

Complete API parameters and online testing: ACE Music Lyrics API.

Basic Usage

The request endpoint is POST https://api.acedata.cloud/acemusic/lyrics. For example, to write a Chinese folk song about taking a train home at night, you can put the theme in prompt and the musical atmosphere in style.

curl --request POST 'https://api.acedata.cloud/acemusic/lyrics' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "写一段关于夜晚坐火车回家的原创中文民谣歌词,包含一段主歌和一段副歌。",
    "style": "温暖、木吉他、希望"
  }'

Request Parameters

Parameter Type Required Description
prompt string Yes The lyrics theme, language, story, or section requirements, up to 20,000 characters.
style string No The desired style and atmosphere, up to 20,000 characters.

This API waits synchronously for the lyrics result and does not accept async or callback_url parameters. If the wait exceeds the processing budget, it returns HTTP 202 and a task_id; in this case, save the ID and use the Task API to query the original task.

Response Example

The following is an actual successful response. Generated content varies with the request.

{
  "success": true,
  "task_id": "893deb8e-d6b5-4872-8d3a-07bdcae189e5",
  "trace_id": "a06d171c-ad78-4aeb-aa8e-1cd0834fe19b",
  "status": "succeeded",
  "data": [
    {
      "title": "归途夜车",
      "text": "[verse]\n车窗倒映着疲惫的脸庞\n铁轨在夜色里轻轻摇晃\n路过的站台落满了微霜\n背包里装着一年的行囊\n\n[chorus]\n呜——列车穿过了漫长黑夜\n每一步都在把距离缩短\n车轮声数着心底的期盼\n天亮时就能看见家门前的炊烟"
    }
  ]
}
Field Description
success Whether this lyrics generation request succeeded.
task_id Platform task ID, used for subsequent queries and troubleshooting.
trace_id Request trace ID; provide it when contacting support.
status Task status; succeeded indicates that generation is complete. An HTTP 202 acceptance response still requires further querying.
data List of lyrics results.
data[*].title Generated song title, which can be edited.
data[*].text Lyrics text, including line breaks and section tags, which can be edited; this field is not an audio URL.

Using Lyrics to Create a Song

  1. Extract data[0].title and data[0].text from the successful response and edit them as needed.
  2. Call the Song Generation API, set action=generate and custom=true, put the title in title, put the lyrics text in lyric, and fill in style.
  3. Save the new task_id returned by the song request and retrieve the song result using the Task Query Guide.

Note that the field names differ between the two APIs: the Lyrics API returns text, while the Song API accepts lyric. The lyrics task and song task also each have their own task_id.

The following is an example request body for the Song API; replace the placeholders with your confirmed title, complete lyrics, and style, then send the request according to the Song Guide.

{
  "action": "generate",
  "model": "acemusic-v1.1",
  "custom": true,
  "title": "YOUR_SONG_TITLE",
  "lyric": "YOUR_LYRICS_TEXT",
  "style": "温暖的中文民谣,木吉他伴奏",
  "async": true
}

Lyrics generation and song generation are two separate paid operations. Calling only the Lyrics API will not generate audio; calling the Song API directly will not implicitly incur a separate lyrics assistant fee.

Queries and Error Handling

If HTTP 202 is returned, put the task_id from the response into id in the following request:

curl --request POST 'https://api.acedata.cloud/acemusic/tasks' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "action": "retrieve",
    "id": "YOUR_LYRICS_TASK_ID"
  }'

The task query returns a task record, with the completed lyrics located in response.data, at a different level from data in a successful direct call to the Lyrics API. It is recommended to query every few seconds and gradually increase the interval, stopping once a terminal state is reached.

HTTP Status Code Recommended Action
400 Check prompt, style, and parameter types; do not pass parameters specific to the song API.
401 / 403 Check whether the Token is valid and whether the application and key have the corresponding API permissions.
402 Check the balance and key usage limit.
404 Check the task ID and the account currently making the request when querying.
429 Reduce the request frequency and retry the query after a delay.
500 / 503 Retain the existing task_id and trace_id, and first query the original task or contact support.

After a network interruption or timeout, do not automatically resend the lyrics generation request. If you have obtained a task ID, continue querying the original task; if you have not obtained a task ID and the acceptance status is unclear, retain the request information and contact support to avoid duplicate generation and charges.

Pricing

Each successful lyrics generation costs 0.0157408497024 Credits; there is no charge if it ultimately fails. Querying your own tasks is free. The actual currency amount depends on the plan used, discounts, site pricing, and exchange rates; please refer to the amount displayed in the console.