生成音乐
curl --request POST \
--url https://router.aionclaw.ai/v1/music_generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "lyria-3.5",
"prompt": "A warm piano song about coming home.",
"is_instrumental": false
}
'import requests
url = "https://router.aionclaw.ai/v1/music_generation"
payload = {
"model": "lyria-3.5",
"prompt": "A warm piano song about coming home.",
"is_instrumental": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'lyria-3.5',
prompt: 'A warm piano song about coming home.',
is_instrumental: false
})
};
fetch('https://router.aionclaw.ai/v1/music_generation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://router.aionclaw.ai/v1/music_generation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'lyria-3.5',
'prompt' => 'A warm piano song about coming home.',
'is_instrumental' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://router.aionclaw.ai/v1/music_generation"
payload := strings.NewReader("{\n \"model\": \"lyria-3.5\",\n \"prompt\": \"A warm piano song about coming home.\",\n \"is_instrumental\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://router.aionclaw.ai/v1/music_generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"lyria-3.5\",\n \"prompt\": \"A warm piano song about coming home.\",\n \"is_instrumental\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router.aionclaw.ai/v1/music_generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"lyria-3.5\",\n \"prompt\": \"A warm piano song about coming home.\",\n \"is_instrumental\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "interaction_example",
"status": "completed",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "[Verse] Coming home"
},
{
"type": "audio",
"mime_type": "audio/mpeg",
"data": "SUQz"
}
]
}
]
}{}{}{}{}{}{}{}音乐生成
生成音乐
通过 model 选择 Gemini Lyria 模型,使用 prompt 生成歌曲或纯音乐。响应包含生成状态、歌词文本和 Base64 MP3 音频。支持 lyria-3.5、lyria-3-clip-preview、lyria-3-pro-preview 及已配置的模型别名。
POST
/
v1
/
music_generation
生成音乐
curl --request POST \
--url https://router.aionclaw.ai/v1/music_generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "lyria-3.5",
"prompt": "A warm piano song about coming home.",
"is_instrumental": false
}
'import requests
url = "https://router.aionclaw.ai/v1/music_generation"
payload = {
"model": "lyria-3.5",
"prompt": "A warm piano song about coming home.",
"is_instrumental": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'lyria-3.5',
prompt: 'A warm piano song about coming home.',
is_instrumental: false
})
};
fetch('https://router.aionclaw.ai/v1/music_generation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://router.aionclaw.ai/v1/music_generation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'lyria-3.5',
'prompt' => 'A warm piano song about coming home.',
'is_instrumental' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://router.aionclaw.ai/v1/music_generation"
payload := strings.NewReader("{\n \"model\": \"lyria-3.5\",\n \"prompt\": \"A warm piano song about coming home.\",\n \"is_instrumental\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://router.aionclaw.ai/v1/music_generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"lyria-3.5\",\n \"prompt\": \"A warm piano song about coming home.\",\n \"is_instrumental\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router.aionclaw.ai/v1/music_generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"lyria-3.5\",\n \"prompt\": \"A warm piano song about coming home.\",\n \"is_instrumental\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "interaction_example",
"status": "completed",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "[Verse] Coming home"
},
{
"type": "audio",
"mime_type": "audio/mpeg",
"data": "SUQz"
}
]
}
]
}{}{}{}{}{}{}{}授权
AionRouter API 密钥。
请求体
application/json
模型名称或已配置的模型别名。支持 lyria-3.5、lyria-3-clip-preview、lyria-3-pro-preview。
示例:
"lyria-3.5"
描述曲风、情绪、语言、歌词或歌曲结构。至少一个非空白字符,最多 2000 字符。
Required string length:
1 - 2000示例:
"A warm piano song about coming home."
true 时要求生成无歌词、无人声的纯音乐。
仅支持同步非流式请求;省略或设为 false。
可用选项:
false