Lyria 音樂生成
curl --request POST \
--url https://api.mixroute.ai/v1/models/lyria-3.5:generateContentimport requests
url = "https://api.mixroute.ai/v1/models/lyria-3.5:generateContent"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.mixroute.ai/v1/models/lyria-3.5:generateContent', 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://api.mixroute.ai/v1/models/lyria-3.5:generateContent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mixroute.ai/v1/models/lyria-3.5:generateContent"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mixroute.ai/v1/models/lyria-3.5:generateContent")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixroute.ai/v1/models/lyria-3.5:generateContent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body音訊與即時
Lyria 音樂生成
Lyria 接收音樂提示詞,不是朗讀指令。將 lyria-3.5 放入 URL,在 contents[].parts[].text 描述樂器、人聲、風格與預期長度;長度不是固定秒數參數。
Lyria 音樂生成
curl --request POST \
--url https://api.mixroute.ai/v1/models/lyria-3.5:generateContentimport requests
url = "https://api.mixroute.ai/v1/models/lyria-3.5:generateContent"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.mixroute.ai/v1/models/lyria-3.5:generateContent', 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://api.mixroute.ai/v1/models/lyria-3.5:generateContent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mixroute.ai/v1/models/lyria-3.5:generateContent"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mixroute.ai/v1/models/lyria-3.5:generateContent")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixroute.ai/v1/models/lyria-3.5:generateContent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body使用 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 描述樂器、人聲、風格與預期長度;長度不是固定秒數參數。
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。儲存前請確認回應包含音訊資料。
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."}'