Voice Design
Generate Voice Candidates
Sample candidate voices from a written description.
POST
/
voice-generator
/
generate
Generate Voice Candidates
curl --request POST \
--url https://api.gradium.ai/api/voice-generator/generate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"prompt": "<string>",
"n_samples": 1,
"json_config": {
"cfg_scale": 5,
"steps": 16,
"seed": 123,
"utmos_score": 3
}
}
'import requests
url = "https://api.gradium.ai/api/voice-generator/generate"
payload = {
"prompt": "<string>",
"n_samples": 1,
"json_config": {
"cfg_scale": 5,
"steps": 16,
"seed": 123,
"utmos_score": 3
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
n_samples: 1,
json_config: {cfg_scale: 5, steps: 16, seed: 123, utmos_score: 3}
})
};
fetch('https://api.gradium.ai/api/voice-generator/generate', 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.gradium.ai/api/voice-generator/generate",
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([
'prompt' => '<string>',
'n_samples' => 1,
'json_config' => [
'cfg_scale' => 5,
'steps' => 16,
'seed' => 123,
'utmos_score' => 3
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.gradium.ai/api/voice-generator/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"n_samples\": 1,\n \"json_config\": {\n \"cfg_scale\": 5,\n \"steps\": 16,\n \"seed\": 123,\n \"utmos_score\": 3\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.gradium.ai/api/voice-generator/generate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"n_samples\": 1,\n \"json_config\": {\n \"cfg_scale\": 5,\n \"steps\": 16,\n \"seed\": 123,\n \"utmos_score\": 3\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gradium.ai/api/voice-generator/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"n_samples\": 1,\n \"json_config\": {\n \"cfg_scale\": 5,\n \"steps\": 16,\n \"seed\": 123,\n \"utmos_score\": 3\n }\n}"
response = http.request(request)
puts response.read_body{
"embeddings": [
{
"embedding_id": "<string>",
"ready": true,
"expires_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
API key for authentication. Passed via the x-api-key header.
Body
application/json
The voice description, up to 500 characters. Must contain actual text, not only spaces.
Required string length:
1 - 500Language the voice will speak. Shapes the accent and the delivery.
Available options:
en, fr, es, pt, de Number of candidate voices to sample from the description. All candidates in one request are variations on the same character.
Required range:
1 <= x <= 5Advanced sampling options for voice generation. The defaults are tuned, so send only the keys you need.
Show child attributes
Show child attributes
Response
Successful Response
Show child attributes
Show child attributes
⌘I
Generate Voice Candidates
curl --request POST \
--url https://api.gradium.ai/api/voice-generator/generate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"prompt": "<string>",
"n_samples": 1,
"json_config": {
"cfg_scale": 5,
"steps": 16,
"seed": 123,
"utmos_score": 3
}
}
'import requests
url = "https://api.gradium.ai/api/voice-generator/generate"
payload = {
"prompt": "<string>",
"n_samples": 1,
"json_config": {
"cfg_scale": 5,
"steps": 16,
"seed": 123,
"utmos_score": 3
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
n_samples: 1,
json_config: {cfg_scale: 5, steps: 16, seed: 123, utmos_score: 3}
})
};
fetch('https://api.gradium.ai/api/voice-generator/generate', 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.gradium.ai/api/voice-generator/generate",
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([
'prompt' => '<string>',
'n_samples' => 1,
'json_config' => [
'cfg_scale' => 5,
'steps' => 16,
'seed' => 123,
'utmos_score' => 3
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.gradium.ai/api/voice-generator/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"n_samples\": 1,\n \"json_config\": {\n \"cfg_scale\": 5,\n \"steps\": 16,\n \"seed\": 123,\n \"utmos_score\": 3\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.gradium.ai/api/voice-generator/generate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"n_samples\": 1,\n \"json_config\": {\n \"cfg_scale\": 5,\n \"steps\": 16,\n \"seed\": 123,\n \"utmos_score\": 3\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gradium.ai/api/voice-generator/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"n_samples\": 1,\n \"json_config\": {\n \"cfg_scale\": 5,\n \"steps\": 16,\n \"seed\": 123,\n \"utmos_score\": 3\n }\n}"
response = http.request(request)
puts response.read_body{
"embeddings": [
{
"embedding_id": "<string>",
"ready": true,
"expires_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}