Source: https://ailoot.ai/models/zh-hant-tw/google-lyria/
Canonical: https://ailoot.ai/models/zh-hant-tw/google-lyria/
Language: zh-hant-tw

# Lyria

[Markdown](https://ailoot.ai/models/zh-hant-tw/google-lyria/index.md) · [JSON](https://ailoot.ai/models/zh-hant-tw/google-lyria/facts.json)

## [Lyria](https://ailoot.ai/models/zh-hant-tw/google-lyria/)

文字轉音樂，可要求 1–8 段，結果同步回傳。

- [**Ailoot · 音樂** `POST /v1/music/generations` `google/lyria`](https://ailoot.ai/models/zh-hant-tw/google-lyria/#method-0)

關於模型

此說明介紹模型的能力。Ailoot 可用的輸入、輸出與選項，依所選方法列於下方。

google/lyria 透過 /v1/music/generations 依文字生成音樂。可要求產品示範的克制器樂背景，說明主奏樂器及旁白所需空間；預期成果是音樂片段時可選。

必填 model、prompt，n 或 count 接受 1–8 段，同步回傳。保存每段實際輸出及 metadata。沒有音訊參考輸入、時長或 tempo 欄位；可在提示描述意圖，但不是保證量測屬性。

**Ailoot · 音樂** `POST /v1/music/generations` `google/lyria`

[`google/lyria`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Flyria&route=Core&caller=google%2Flyria&fmt=music)

Google /`google/lyria`

### 入門

文字轉音樂，可要求 1–8 段，結果同步回傳。

接受的輸入

文字

結果

music

### Ailoot 可用 · 輸入與方法

**Ailoot · 音樂** `POST /v1/music/generations`

輸入

`text`

輸出

`music`

輸出格式

完整的自有音訊片段／JSON 連結

| 欄位 | 類型 | 要求 | 值與限制 | 預設值 |
| --- | --- | --- | --- | --- |
| 欄位`model` | 類型`string` | 要求必填 | 值與限制 google/lyria | 預設值— |
| 欄位`prompt` | 類型`string` | 要求必填 | 值與限制 長度下限: 1 | 預設值— |
| 欄位`n` | 類型`integer` | 要求選填 | 值與限制 最小值: 1 最大值: 8 | 預設值1 |
| 欄位`count` | 類型`integer` | 要求選填 | 值與限制 最小值: 1 最大值: 8 條件: 若也提供 n，數量必須一致 | 預設值— |

輸入素材組合

**text\_to\_music** · 必填： prompt

方法參數與生命週期

| 參數 | 規格 |
| --- | --- |
| 參數`material_types` | 規格text |
| 參數`required` | 規格null |
| 參數`optional_controls` | 規格null |

生命週期： `synchronous_result_then_owned_library`

`GET /v1/media/tasks/{task_id}` · 實際回傳的 task\_id 或媒體庫紀錄

`GET /v1/media/assets/{asset_id}/content`

`GET /v1/media/assets`

`GET /v1/media/assets/{asset_id}`

方法結構與 ID 均為精確值；供應商能力與准入狀態分開。

### 方案

#### Ailoot 方法費率

輸出

US$0.08 *每個片段*

僅供參考・不另加

US$0.08 *每次請求*

已交付片段數 × 每段基本費率。每次請求的參考費率不會另加。範例為適用調整前的金額。

`1 × US$0.08 = US$0.08`

`4 × US$0.08 = US$0.32`

Ailoot 會在請求前預留估算金額。取得結果後，依實測用量結算最終費用。串流結算採用最終用量紀錄。[預留金額與結算的運作方式 →](https://ailoot.ai/docs/zh-hant-tw/billing/reserve/)

### 請求範例

#### Ailoot · 音樂

音樂範例

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 music brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "google/lyria", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/music/generations \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
export AILOOT_API_KEY
python3 - <<'PY_RESULT'
import json, os, subprocess
from pathlib import Path
from urllib.parse import urljoin, urlparse
result=json.loads(Path("result.json").read_text(encoding="utf-8"))
print(json.dumps(result,ensure_ascii=False,indent=2))
for number,clip in enumerate(result.get("data") or []):
    u=urlparse(urljoin("https://api.ailoot.ai",clip["url"]))
    if u.scheme!="https" or not u.hostname or u.username or u.password:
        raise SystemExit("Result URL must be HTTPS without embedded credentials")
    owned=u.netloc=="api.ailoot.ai" and u.path.startswith("/v1/media/assets/") and u.path.endswith("/content")
    args=["curl","--fail-with-body","--silent","--show-error",u.geturl()]
    if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
    raw=subprocess.check_output(args)
    ext="wav" if raw.startswith(b"RIFF") and raw[8:12]==b"WAVE" else "flac" if raw.startswith(b"fLaC") else "ogg" if raw.startswith(b"OggS") else "mp3" if raw.startswith(b"ID3") or raw[:1]==b"\xff" else "bin"
    f=Path("music-"+str(number)+"."+ext);f.write_bytes(raw)
    print("Saved",f,clip.get("asset_id"))

PY_RESULT
```

### 接收並儲存結果

#### Ailoot · 音樂

完整的自有音訊片段／JSON 連結

- `GET /v1/media/tasks/{task_id}`
- `GET /v1/media/assets/{asset_id}/content`
- `GET /v1/media/assets`
- `GET /v1/media/assets/{asset_id}`

##### 保留所有已完成的結果

請保留所有完整傳回的回應、檔案與內容區塊。

請儲存／取得每個回傳的片段，並保留實際的 ID、MIME 與中繼資料。此方法為同步操作；不會另設 Ailoot 音樂生成輪詢 URL。

##### 需要檢查原始回應時

若音樂結果需要查核，請保留原始 operation\_id/X-Client-Request-ID 與回傳的片段資訊。請使用實際的 task\_id 或 asset\_id 值，透過媒體庫復原現有的自有片段。切勿重新提交音樂請求，或根據 operation\_id 組出生成輪詢 URL。

回應欄位

| 欄位 | 類型 |
| --- | --- |
| 欄位`model` | 類型string |
| 欄位`response_id` | 類型string |
| 欄位`data[]` | 類型owned clip record |

錯誤與後續步驟

| 回應 | 條件 | 下一步 |
| --- | --- | --- |
| 回應400 · `invalid_request_error` | 條件必要欄位、素材表示方式或參數值無效 | 下一步提出新的建立請求前，先修正指定欄位。 |
| 回應`server_error` | 條件回傳的回應表示該作業或結果需要檢查 | 下一步保留原始回傳的作業／任務 ID、請求標頭與回應；繼續以支援的方式讀取該原始作業。請勿重新提交建立請求。 |

### 別名

#### 模型別名

**Ailoot** [`google/lyria`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Flyria&route=Core&caller=google%2Flyria&fmt=music)

#### 方法路徑別名

請使用上方列出的 API 方法路徑。

#### 相關呼叫用 ID

[`google/lyria`](https://ailoot.ai/models/zh-hant-tw/#m=google%2Flyria&route=Core&caller=google%2Flyria&fmt=music)

FAQ · Lyria

可以使用哪些輸入與結果？

`POST /v1/music/generations` · `google/lyria`: `text` → `music`

請求使用哪些欄位？

`POST /v1/music/generations` · `google/lyria`: `model`, `prompt`, `n`, `count`

適用哪些限制？

`POST /v1/music/generations` · `google/lyria`: `n.minimum`: `1`; `n.maximum`: `8`; `count.minimum`: `1`; `count.maximum`: `8`

將 Ailoot 串接 Claude Code、OpenCode、Hermes 或自己的應用程式。

## 公司及其專案組合

公司及其專案組合：數百萬客戶，每月銷售額達數十億。

## 優惠購買 token。

訂閱優惠適合持續工作，折扣碼購買 token 最高可折 50%。

訂閱

為定期請求選擇優惠方案。

最高 50% 折扣碼

購買時輸入代碼，價格依活動重算。

歷史中的費用

每次請求保存模型、token 與金額。

[選擇訂閱](https://ailoot.ai/docs/zh-hant-tw/billing/subscriptions/) · [查看模型價格](https://ailoot.ai/models/zh-hant-tw/)

## 將 API 加入 你銷售的產品。

依 Ailoot 正式服務條款與授權合約串接 SaaS、應用程式與機器人；轉售請申請經銷授權。

商用應用程式

在付費功能加入文字、圖片、影片與聲音生成。

經銷授權

提供專案說明與存取方式，要求書面使用和轉售條件。

網站文件

串接前可閱讀正式服務條款、授權合約與資料處理政策。

[申請經銷授權](mailto:support@ailoot.ai) · [正式服務條款與授權合約](https://ailoot.ai/legal/offer?lang=zh-hant-tw)

## Ailoot · 公司及其專案組合





Ailoot以累積的營運經驗、廣大的客戶群、穩定的服務及持續的KPI管理為基礎。





公司及其專案組合：數百萬客戶，每月銷售額達數十億。





Ailoot將這些營運經驗用於API存取，讓客戶的產品、代理、應用程式及自動化流程使用AI功能。
