Skip to content

MaaS_Lyria

Model Description

Capability Description
Text-to-Music Generate music based on the text prompt and return it synchronously
Output Form Audio (inlineData, e.g., audio/mpeg) + Text (lyrics/structural annotation)
Interface Style Vertex generateContent native JSON; optionally OpenAI chat/completions compatible
Streaming Not supported
Asynchronous polling Not supported

1 Text-to-Music — generateContent

1.1 Request URL

POST https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/music/generateContent

1.2 Request Header

Authorization: Bearer {your AK}

Content-Type: application/json

1.3 Request Body

Field Required
contents is
contents[].parts[].text is
contents[].role No
generationConfig.responseModalities No

Request Example

curl --location --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/music/generateContent' \
--header 'Authorization: Bearer ${your AK} 
--header 'Content-Type: application/json' 
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Upbeat pop song about a summer road trip, catchy chorus, female vocal"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": ["AUDIO", "TEXT"]
  }
}

1.4 Successful Response Parameters

Returned upon success:

Field Description
candidates[].content.parts[].text Lyrics / Structural Text
candidates[].content.parts[].inlineData.mimeType 如 audio/mpeg
candidates[].content.parts[].inlineData.data Audio Base64
candidates[].finishReason e.g. STOP
usageMetadata Token Usage

Successful Response Example

curl --location --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/music/generateContent' \
--header 'Authorization: Bearer ${your AK} 
--header 'Content-Type: application/json' 
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {
            "text": "[Verse]\n...\n[Chorus]\n..."
          },
          {
            "inlineData": {
              "mimeType": "audio/mpeg",
              "data": "<base64-encoded-mp3>"
            }
          }
        ]
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 14,
    "candidatesTokenCount": 3199,
    "totalTokenCount": 3213
  },
  "responseId": "******"
}

2 Vertex v1beta1 — generateContent

2.1 Request URL

POST https:// genaiapi-m2.cloudsway.net /{endpointPath}/music/v1beta1/publishers/google/models/{modelName}:generateContent

2.2 Request Body

Same as 1; {modelName} in the URL will be written into the request model field.


3 OpenAI — google/chat/completions

3.1 Request URL

POST https:// genaiapi-m2.cloudsway.net /v1/ai/{endpointPath}/music/google/chat/completions

3.2 Request Header

Authorization: Bearer {Platform AK}

Content-Type: application/json

3.3 Request Body

Field Required Description
model is MaaS_Lyria_3_pro_preview
stream must be false or omitted; streaming is not supported
messages is OpenAI Message Array
modalities No Suggested ["audio", "text"]

Request Example

curl --location --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/music/generateContent' \
--header 'Authorization: Bearer ${your AK} 
--header 'Content-Type: application/json' 
{
  "model": "MaaS_Lyria_3_pro_preview",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Upbeat pop song about a summer road trip, catchy chorus, female vocal"
    }
  ],
  "modalities": ["audio", "text"]
}

3.4 Successful Response Parameters

OpenAIchat/completions format:

Field Description
choices[0].message.content Lyric Text
choices[0].message.audio.data Audio Base64
choices[0].finish_reason If stop
usage Token Statistics

4 OpenAI Compatibility — chat/completions (Endpoint Path Pattern)

4.1 Request URL

POST https:// genaiapi-m2.cloudsway.net /v1/ai/{endpointPath}/music/chat/completions

The body is the same as 3.


5 OpenAI Compatibility — chat/completions (Compatibility Mode)

5.1 Request URL

POST https:// genaiapi-m2.cloudsway.net /v1/music/chat/completions

Request Example

curl --location --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/music/generateContent' \
--header 'Authorization: Bearer ${your AK} 
--header 'Content-Type: application/json' 
{
  "model": "MaaS_Lyria_3_pro_preview",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Upbeat pop song about a summer road trip"
    }
  ],
  "modalities": ["audio", "text"]
}