curl --request POST \
--url https://api.apimart.ai/v1/music/generations/lyricsFlowMusic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}'
import requests
url = "https://api.apimart.ai/v1/music/generations/lyricsFlowMusic"
payload = {
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/music/generations/lyricsFlowMusic";
const payload = {
model: "flowmusic",
prompt: "A rock song about perseverance"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KWXVCX91HYHSTHZ0NC1SRFW1"
}
]
}
{
"error": {
"message": "model is required",
"type": "invalid_request",
"param": "",
"code": "model_required"
}
}
{
"error": {
"message": "Insufficient balance",
"type": "invalid_request",
"param": "",
"code": "quota_not_enough"
}
}
{
"error": {
"message": "Current group capacity is saturated, please retry later",
"type": "rate_limit_error",
"param": "",
"code": "rate_limit_error"
}
}
Flow Music
Generate Lyrics
Flow Music generates lyrics from a prompt. The result can be filled into the lyrics field of the Generate Music endpoint
POST
/
v1
/
music
/
generations
/
lyricsFlowMusic
curl --request POST \
--url https://api.apimart.ai/v1/music/generations/lyricsFlowMusic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}'
import requests
url = "https://api.apimart.ai/v1/music/generations/lyricsFlowMusic"
payload = {
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/music/generations/lyricsFlowMusic";
const payload = {
model: "flowmusic",
prompt: "A rock song about perseverance"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KWXVCX91HYHSTHZ0NC1SRFW1"
}
]
}
{
"error": {
"message": "model is required",
"type": "invalid_request",
"param": "",
"code": "model_required"
}
}
{
"error": {
"message": "Insufficient balance",
"type": "invalid_request",
"param": "",
"code": "quota_not_enough"
}
}
{
"error": {
"message": "Current group capacity is saturated, please retry later",
"type": "rate_limit_error",
"param": "",
"code": "rate_limit_error"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/music/generations/lyricsFlowMusic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}'
import requests
url = "https://api.apimart.ai/v1/music/generations/lyricsFlowMusic"
payload = {
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/music/generations/lyricsFlowMusic";
const payload = {
model: "flowmusic",
prompt: "A rock song about perseverance"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KWXVCX91HYHSTHZ0NC1SRFW1"
}
]
}
{
"error": {
"message": "model is required",
"type": "invalid_request",
"param": "",
"code": "model_required"
}
}
{
"error": {
"message": "Insufficient balance",
"type": "invalid_request",
"param": "",
"code": "quota_not_enough"
}
}
{
"error": {
"message": "Current group capacity is saturated, please retry later",
"type": "rate_limit_error",
"param": "",
"code": "rate_limit_error"
}
}
Authentication
string
required
All endpoints require Bearer Token authenticationGet your API Key:Visit the API Key management page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY
Request Parameters
string
required
Model name, must be
"flowmusic" (case-insensitive)string
required
Prompt for generating lyrics, ≤ 3000 charactersIt is recommended to describe the song’s theme, style, and mood to get better-fitting lyricsExample:
"A rock song about perseverance"Response
integer
Response status code, 200 on success
array
Use Cases
Scenario 1: Generate lyrics by theme
{
"model": "flowmusic",
"prompt": "A rock song about perseverance"
}
Scenario 2: Fill generated lyrics into a song
First generate lyrics; once done, take thetitle and lyrics from result.lyrics[0] and fill them into the Generate Music endpoint:
{
"model": "flowmusic",
"title": "Perseverance",
"lyrics": "[Verse 1]\nEven the longest night turns to dawn\n...",
"sound_prompt": "energetic rock with electric guitar"
}
Query Task ResultsLyrics generation is an asynchronous task; a
task_id is returned after submission. Use the Get Task Status endpoint to query generation progress and results.Completed Task Result Example
Query response example (GET /v1/music/tasks/{task_id}):
{
"code": 200,
"data": {
"id": "task_01KWXVCX91HYHSTHZ0NC1SRFW1",
"status": "completed",
"progress": 100,
"created": 1783413241,
"completed": 1783413284,
"actual_time": 43,
"cost": 0.016,
"credits_cost": 0.16,
"result": {
"lyrics": [
{
"title": "Bleached",
"lyrics": "[Intro]\n(Check)\n(One two)\n\n[Verse 1]\nThe birds are..."
}
]
}
}
}