> ## Documentation Index
> Fetch the complete documentation index at: https://mixroute.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Lyria 音乐生成

> Lyria 接收音乐提示词，不是文字朗读指令。把 `lyria-3.5` 放入 URL，在 `contents[].parts[].text` 中描述乐器、人声、风格和期望时长；时长不是固定秒数参数。

使用 MixRoute API Key 认证，并在请求路径中传完整模型 ID。这里说明 MixRoute 的 GenerateContent 请求格式。

`POST /v1/models/lyria-3.5:generateContent`

## 模型 ID

* `lyria-3.5`

## 请求与响应

Lyria 接收音乐提示词，不是文字朗读指令。把 `lyria-3.5` 放入 URL，在 `contents[].parts[].text` 中描述乐器、人声、风格和期望时长；时长不是固定秒数参数。

```bash theme={null}
curl --request POST 'https://api.mixroute.ai/v1/models/lyria-3.5:generateContent' \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "contents": [
    {
      "parts": [
        {
          "text": "Create a short instrumental piano track. No vocals."
        }
      ],
      "role": "user"
    }
  ]
}'
```

从 `candidates[].content.parts[].inlineData.data` 解码 Base64 音频，保存前检查 `mimeType`。没有音频不代表已成功生成音乐。

可用性与字段支持以 MixRoute 路由为准。请先看独立模型页，不要假定支持流式或其他请求格式。

## Interactions API

`POST /v1beta/interactions`

使用下方的 Interactions 请求体，不要沿用 GenerateContent 的 `contents`。保存前先确认响应中包含音频数据。

```bash theme={null}
curl --request POST 'https://api.mixroute.ai/v1beta/interactions' \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header 'Content-Type: application/json' \
  --header 'Api-Revision: 2026-05-20' \
  --data '{"model":"lyria-3.5","input":"A short solo piano jingle. No vocals."}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.