Skip to main content
POST
/
v1
/
tts
Text to speech
curl --request POST \
  --url https://api.kova.ai/v1/tts \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "text": "<string>",
  "voice": "<string>",
  "normalize_text": false,
  "response_format": {
    "bitrate": "<string>",
    "encoding": "mp3",
    "sample_rate": 123
  },
  "temperature": 123,
  "timestamps": false
}
'
import requests

url = "https://api.kova.ai/v1/tts"

payload = {
"text": "<string>",
"voice": "<string>",
"normalize_text": False,
"response_format": {
"bitrate": "<string>",
"encoding": "mp3",
"sample_rate": 123
},
"temperature": 123,
"timestamps": False
}
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({
text: '<string>',
voice: '<string>',
normalize_text: false,
response_format: {bitrate: '<string>', encoding: 'mp3', sample_rate: 123},
temperature: 123,
timestamps: false
})
};

fetch('https://api.kova.ai/v1/tts', 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.kova.ai/v1/tts",
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([
'text' => '<string>',
'voice' => '<string>',
'normalize_text' => false,
'response_format' => [
'bitrate' => '<string>',
'encoding' => 'mp3',
'sample_rate' => 123
],
'temperature' => 123,
'timestamps' => false
]),
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.kova.ai/v1/tts"

payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"voice\": \"<string>\",\n \"normalize_text\": false,\n \"response_format\": {\n \"bitrate\": \"<string>\",\n \"encoding\": \"mp3\",\n \"sample_rate\": 123\n },\n \"temperature\": 123,\n \"timestamps\": false\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.kova.ai/v1/tts")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"voice\": \"<string>\",\n \"normalize_text\": false,\n \"response_format\": {\n \"bitrate\": \"<string>\",\n \"encoding\": \"mp3\",\n \"sample_rate\": 123\n },\n \"temperature\": 123,\n \"timestamps\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.kova.ai/v1/tts")

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 \"text\": \"<string>\",\n \"voice\": \"<string>\",\n \"normalize_text\": false,\n \"response_format\": {\n \"bitrate\": \"<string>\",\n \"encoding\": \"mp3\",\n \"sample_rate\": 123\n },\n \"temperature\": 123,\n \"timestamps\": false\n}"

response = http.request(request)
puts response.read_body
{
  "audio": "<string>",
  "timestamps": {
    "end_seconds": [
      123
    ],
    "start_seconds": [
      123
    ],
    "words": [
      "<string>"
    ]
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}
POST /v1/tts is the simplest way to generate audio: send text, get a complete audio file back as base64. Use this when you have a single utterance and want to write the result to a file or play it back after generation completes. If you need to start playback before generation finishes, use Streaming TTS instead.

Examples

from kova_tts import KovaTTSClient, AudioResponseFormat

client = KovaTTSClient(api_key="kova_sk_...")
result = client.tts(
    text="Welcome to Kova.",
    voice="cal",
    response_format=AudioResponseFormat(encoding="mp3"),
    timestamps=True,
)
client.write_audio_file(result.audio, "welcome.mp3")
if result.timestamps:
    print(result.timestamps.words)
import { KovaTTSClient } from "@kova-ai/tts";

const client = new KovaTTSClient({ apiKey: "kova_sk_..." });
const result = await client.tts({
  text: "Welcome to Kova.",
  voice: "cal",
  response_format: { encoding: "mp3" },
  timestamps: true,
});
await client.writeAudioFile(result.audio, "welcome.mp3");
console.log(result.timestamps?.words);
curl https://api.kova.ai/v1/tts \
  -H "x-api-key: $KOVA_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "text": "Welcome to Kova.",
    "voice": "cal",
    "response_format": {"encoding": "mp3"},
    "timestamps": true
  }' \
  | jq -r .audio | base64 -d > welcome.mp3

response_format

response_format accepts an object or, for backward compatibility, a bare encoding string (e.g. "mp3").
encodingsample_ratebitrateNotes
mp3 (default)16000–48000 Hz (default 32000)32–320 kbps (default 128k)Compressed; best general-purpose default.
wav8000–48000 Hz (default 32000)n/aUncompressed; one header per file.
pcm8000–48000 Hz (default 32000)n/aRaw signed 16-bit little-endian. Best for streaming if you assemble your own header.
linear168000–48000 Hz (default 32000)n/aEquivalent to pcm but emits a WAV header per chunk during streaming.
opusone of 8000, 12000, 16000, 24000, 48000 (default 48000)32–192 kbps (default 64k)Compressed, low-latency.
mulaw8000 Hz onlyn/aTelephony (G.711).
alaw8000 Hz onlyn/aTelephony (G.711).
Encoding aliases are accepted and normalized: linear_pcm / linear-pcm / pcm_s16le / raw / mu-law / μ-law / ulaw / u-law / a-law. Documented names are canonical.

See also

  • Streaming TTS — same request shape, lower time-to-first-audio.
  • Voices — available speaker ids.
  • Errors — what 4xx and 5xx bodies look like.

Authorizations

x-api-key
string
header
required

Body

application/json
text
string
required
voice
string
required
normalize_text
boolean
default:false
response_format
AudioResponseFormat · object
temperature
number | null
timestamps
boolean
default:false

Response

Successful Response

audio
string
required
timestamps
SyncTimestamps · object | null