Upload Voice
curl --request POST \
--url https://api.siliconflow.com/v1/uploads/audio/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=FunAudioLLM/CosyVoice2-0.5B \
--form customName=your-voice-name \
--form 'text=In the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.'import requests
url = "https://api.siliconflow.com/v1/uploads/audio/voice"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nFunAudioLLM/CosyVoice2-0.5B\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customName\"\r\n\r\nyour-voice-name\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text\"\r\n\r\nIn the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'FunAudioLLM/CosyVoice2-0.5B');
form.append('customName', 'your-voice-name');
form.append('text', 'In the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.siliconflow.com/v1/uploads/audio/voice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"uri": "speech:your-voice-name:xxx:xxx"
}{
"code": 20012,
"message": "<string>",
"data": "<string>"
}"Invalid token""404 page not found"{
"message": "Request was rejected due to rate limiting. If you want more, please contact contact@siliconflow.com. Details:TPM limit reached.",
"data": "<string>"
}{
"code": 50505,
"message": "Model service overloaded. Please try again later.",
"data": "<string>"
}"<string>"语音系列
上传参考音频
Upload user-provided voice style, which can be in base64 encoding or file format. Refer to (https://docs.siliconflow.com/capabilities/text-to-speech#2-2)
POST
/
uploads
/
audio
/
voice
Upload Voice
curl --request POST \
--url https://api.siliconflow.com/v1/uploads/audio/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=FunAudioLLM/CosyVoice2-0.5B \
--form customName=your-voice-name \
--form 'text=In the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.'import requests
url = "https://api.siliconflow.com/v1/uploads/audio/voice"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nFunAudioLLM/CosyVoice2-0.5B\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customName\"\r\n\r\nyour-voice-name\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"text\"\r\n\r\nIn the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'FunAudioLLM/CosyVoice2-0.5B');
form.append('customName', 'your-voice-name');
form.append('text', 'In the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.siliconflow.com/v1/uploads/audio/voice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"uri": "speech:your-voice-name:xxx:xxx"
}{
"code": 20012,
"message": "<string>",
"data": "<string>"
}"Invalid token""404 page not found"{
"message": "Request was rejected due to rate limiting. If you want more, please contact contact@siliconflow.com. Details:TPM limit reached.",
"data": "<string>"
}{
"code": 50505,
"message": "Model service overloaded. Please try again later.",
"data": "<string>"
}"<string>"Authorizations
Body
multipart/form-data
- Option 1
- Option 2
Predefined voice style model name
Available options:
FunAudioLLM/CosyVoice2-0.5B Example:
"FunAudioLLM/CosyVoice2-0.5B"
User-defined voice style name
Example:
"your-voice-name"
text
string
default:In the midst of ignorance, a day in the dream comes to an end, and a new cycle begins.
required
Corresponding text content for the audio
Example:
"In the midst of ignorance, a day in the dream comes to an end, and a new cycle begins."
Audio file encoded in base64 with the header format of data:audio/mpeg;base64
Example:
"data:audio/mpeg;base64,aGVsbG93b3JsZA=="
Response
Successful response
Example:
"speech:your-voice-name:xxx:xxx"