Lyria
Text-to-music generation with one to eight requested clips and synchronous result delivery.
About the model
This description covers the model’s capabilities. Available in Ailoot inputs, outputs and options are listed for the selected method below.
google/lyria creates music from a written prompt through /v1/music/generations. A concrete use is requesting a restrained instrumental bed for a product demonstration, describing the foreground instruments and how much space the narration needs. Choose this route when a generated music clip is the desired result.
The request requires model and prompt. The n or count control accepts one to eight clips, and the method returns its generation result synchronously. Save every returned clip and its actual metadata. This entry does not expose audio-reference input, a duration setting or a tempo field, so those are not independently selectable controls. Describe musical intent in the prompt without treating it as a guaranteed measured property of the output.
Ailoot · Music POST /v1/music/generations google/lyria
google/lyriaOverview
Text-to-music generation with one to eight requested clips and synchronous result delivery.
- Accepted inputs
- Text
- Results
- music
Available in Ailoot · inputs & methods
Ailoot · Music POST /v1/music/generations
- Input types
text- Output types
music- Output format
- complete owned audio clips / JSON links
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits google/lyria | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 Maximum: 8 | Default1 |
Fieldcount | Typeinteger | RequirementOptional | Values & limits Minimum: 1 Maximum: 8 Conditions: Ifnalso supplied, countmustagree | Default— |
Input material combinations
text_to_music · Required: prompt
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametermaterial_types | Contracttext |
Parameterrequired | Contractnull |
Parameteroptional_controls | Contractnull |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Method shapes and IDs are exact; supplier capability is separate from admission.
Pricing
Ailoot method rates
POST /v1/music/generations- Output
- $0.08 per clip
- Reference only · not added
- $0.08 per request
Delivered clips × base clip rate. The per-request reference is not added. Examples are before applicable adjustments.
1 × $0.08 = $0.08
4 × $0.08 = $0.32
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot · Music
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
Receive and save results
Ailoot · Music
complete owned audio clips / JSON links
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Keep every complete returned response, file and content part.
Save/fetch every returned clip and preserve actual ID, MIME and metadata. The method is synchronous; no separate Ailoot music generationpollingURL is introduced.
If the original response needs checking
If a music result requires a check, keep the original operation_id/X-Client-Request-ID and returned clip information. Recover existing owned clips through the media library using actual task_id or asset_id values. Do not resubmit the music request or construct a generation polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldmodel | Typestring |
Fieldresponse_id | Typestring |
Fielddata[] | Typeowned clip record |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot google/lyria
Method path aliases
Use the method paths shown above.
Related caller IDs
FAQ · Lyria
- What inputs and results are available?
POST /v1/music/generations·google/lyria:text→music- Which fields does the request use?
POST /v1/music/generations·google/lyria:model,prompt,n,count- What limits apply?
POST /v1/music/generations·google/lyria:n.minimum:1;n.maximum:8;count.minimum:1;count.maximum:8