Clone Voice
curl --request POST \
--url https://api.vivix.ai/v1/voices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Studio Host",
"file_id": "file_aud_a1b2c3d4e5f6",
"language": "zh"
}
'import requests
url = "https://api.vivix.ai/v1/voices"
payload = {
"name": "Studio Host",
"file_id": "file_aud_a1b2c3d4e5f6",
"language": "zh"
}
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({name: 'Studio Host', file_id: 'file_aud_a1b2c3d4e5f6', language: 'zh'})
};
fetch('https://api.vivix.ai/v1/voices', 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.vivix.ai/v1/voices",
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([
'name' => 'Studio Host',
'file_id' => 'file_aud_a1b2c3d4e5f6',
'language' => 'zh'
]),
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://api.vivix.ai/v1/voices"
payload := strings.NewReader("{\n \"name\": \"Studio Host\",\n \"file_id\": \"file_aud_a1b2c3d4e5f6\",\n \"language\": \"zh\"\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://api.vivix.ai/v1/voices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Studio Host\",\n \"file_id\": \"file_aud_a1b2c3d4e5f6\",\n \"language\": \"zh\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vivix.ai/v1/voices")
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 \"name\": \"Studio Host\",\n \"file_id\": \"file_aud_a1b2c3d4e5f6\",\n \"language\": \"zh\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "success",
"data": {
"voice_id": "voice_9f1c2a7b",
"name": "Studio Host",
"language": "zh"
}
}Voices
Clone Voice
Clones a voice from an uploaded audio file_id and returns a voice_id. Pass that id as pipeline_config.tts_config.tts_voice_id when you start a session.
POST
/
v1
/
voices
Clone Voice
curl --request POST \
--url https://api.vivix.ai/v1/voices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Studio Host",
"file_id": "file_aud_a1b2c3d4e5f6",
"language": "zh"
}
'import requests
url = "https://api.vivix.ai/v1/voices"
payload = {
"name": "Studio Host",
"file_id": "file_aud_a1b2c3d4e5f6",
"language": "zh"
}
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({name: 'Studio Host', file_id: 'file_aud_a1b2c3d4e5f6', language: 'zh'})
};
fetch('https://api.vivix.ai/v1/voices', 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.vivix.ai/v1/voices",
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([
'name' => 'Studio Host',
'file_id' => 'file_aud_a1b2c3d4e5f6',
'language' => 'zh'
]),
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://api.vivix.ai/v1/voices"
payload := strings.NewReader("{\n \"name\": \"Studio Host\",\n \"file_id\": \"file_aud_a1b2c3d4e5f6\",\n \"language\": \"zh\"\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://api.vivix.ai/v1/voices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Studio Host\",\n \"file_id\": \"file_aud_a1b2c3d4e5f6\",\n \"language\": \"zh\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vivix.ai/v1/voices")
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 \"name\": \"Studio Host\",\n \"file_id\": \"file_aud_a1b2c3d4e5f6\",\n \"language\": \"zh\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "success",
"data": {
"voice_id": "voice_9f1c2a7b",
"name": "Studio Host",
"language": "zh"
}
}Use the voice when you create a session
Use the voice when you create a session
{
"pipeline_config": {
"tts_config": {
"tts_voice_id": "voice_9f1c2a7b"
}
}
}
tts_voice_id is required: the service fills tts_provider / tts_model_id for that voice.Errors
Errors
Error responses use the same
{code, message, data} envelope; a non-zero code identifies the error.| Case | Error code |
|---|---|
Missing name or file_id | 20003 missing required parameter |
language / name is invalid | 20004 invalid parameter |
file_id does not exist or is not in the current workspace | 20005 not found |
file_id is not an audio file | 20004 invalid parameter |
The clone provider call failed (HTTP 502) | 30007 voice clone provider failed |
| The API key is missing or invalid | 10001 missing api key or 10003 invalid api key |
Authorizations
Your Vivix API key. Keep it on your server.
Body
application/json
Display name, at most 128 characters.
Audio file id in the current workspace (call Upload Audio first).
Sample language: zh (Chinese), en (English), fr (French), de (German), ja (Japanese), ko (Korean), ru (Russian), pt (Portuguese), th (Thai), id (Indonesian), vi (Vietnamese), it (Italian), es (Spanish), ms (Malay), fil (Filipino), ar (Arabic).