Sinh nhạc (Lyria 3)
POST /audio/speech
Sinh một bản nhạc từ mô tả bằng chữ. Dùng chung endpoint với Text-to-Speech, khác ở tên model.
Tham khảo
Hướng dẫn chi tiết và cách viết prompt: Sinh nhạc với Lyria 3. Tài liệu gốc: Lyria 3 (Google).
Cấu trúc yêu cầu (Request Body)
modelstringRequiredlyria-3-clip-preview (bài khoảng 30 giây, $0.04) hoặc lyria-3-pro-preview (bài khoảng 3 phút, $0.08).
inputstringRequiredMô tả bản nhạc: thể loại, tâm trạng, nhạc cụ, nhịp độ, giọng hát, lời bài hát.
voicestringRequiredLyria không dùng giọng đọc. Gửi default.
response_formatstringmp3 (mặc định). Riêng lyria-3-pro-preview nhận thêm wav.
Cấu trúc Phản hồi (Response Body)
Phản hồi thành công trả về file âm thanh (audio/mpeg). Header x-litellm-response-cost cho biết chi phí của request.
Lỗi thường gặp
429rate limitVượt 105 request/phút của model đó, hoặc hết budget.
curl https://api.thucchien.ai/audio/speech \-H "Content-Type: application/json" \-H "Authorization: Bearer " \-d '{ "model": "", "input": "", "voice": "default"}' \--output song.mp3Example Response
{
"status": 200,
"contentType": "audio/mpeg",
"message": "Response body contains the MP3 file."
}