curl -X POST "https://api.mosi.cn/v1/audio/voice/generations" \
-H "Authorization: Bearer $MOSS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "moss-voice-generator-1.0",
"input": "欢迎来到今晚的节目。",
"instruction": "一个温柔、自然、略带微笑感的年轻女声",
"delivery_method": "url",
"response_format": "mp3"
}'
import os
import requests
response = requests.post(
"https://api.mosi.cn/v1/audio/voice/generations",
headers={
"Authorization": f"Bearer {os.environ['MOSS_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "moss-voice-generator-1.0",
"input": "欢迎来到今晚的节目。",
"instruction": "一个温柔、自然、略带微笑感的年轻女声",
"delivery_method": "url",
"response_format": "mp3",
},
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.mosi.cn/v1/audio/voice/generations", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.MOSS_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "moss-voice-generator-1.0",
"input": "欢迎来到今晚的节目。",
"instruction": "一个温柔、自然、略带微笑感的年轻女声",
"delivery_method": "url",
"response_format": "mp3"
}),
})
if (!response.ok) throw new Error(`HTTP ${response.status}`)
console.log(await response.json())