curl --request POST \
--url https://api.chariot.in/v1/tts/stream \
--header 'Content-Type: application/json' \
--header 'chariotai-api-key: <api-key>' \
--data '
{
"voice_id": "bac7d666-094d-4698-91fa-741d60fce662",
"text": "Hello from Chariot.",
"model_type": "v0"
}
'import requests
url = "https://api.chariot.in/v1/tts/stream"
payload = {
"voice_id": "bac7d666-094d-4698-91fa-741d60fce662",
"text": "Hello from Chariot.",
"model_type": "v0"
}
headers = {
"chariotai-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'chariotai-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
voice_id: 'bac7d666-094d-4698-91fa-741d60fce662',
text: 'Hello from Chariot.',
model_type: 'v0'
})
};
fetch('https://api.chariot.in/v1/tts/stream', 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.chariot.in/v1/tts/stream",
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([
'voice_id' => 'bac7d666-094d-4698-91fa-741d60fce662',
'text' => 'Hello from Chariot.',
'model_type' => 'v0'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"chariotai-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.chariot.in/v1/tts/stream"
payload := strings.NewReader("{\n \"voice_id\": \"bac7d666-094d-4698-91fa-741d60fce662\",\n \"text\": \"Hello from Chariot.\",\n \"model_type\": \"v0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("chariotai-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.chariot.in/v1/tts/stream")
.header("chariotai-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"voice_id\": \"bac7d666-094d-4698-91fa-741d60fce662\",\n \"text\": \"Hello from Chariot.\",\n \"model_type\": \"v0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chariot.in/v1/tts/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["chariotai-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voice_id\": \"bac7d666-094d-4698-91fa-741d60fce662\",\n \"text\": \"Hello from Chariot.\",\n \"model_type\": \"v0\"\n}"
response = http.request(request)
puts response.read_body"<string>"Stream text to speech
Synthesize speech and stream the audio back as it is generated, for the lowest possible time-to-first-byte over HTTP. The response is a chunked stream of raw 16-bit little-endian PCM (audio/L16) at 44.1 kHz, mono.
Metadata is returned in response headers before the body streams: X-inference-id, X-audio-url, and Credit-Utilized. Because the HTTP status line is sent before generation begins, a mid-stream failure ends the stream early rather than changing the status code, always verify you received a complete stream.
Cost: 1 credit per input character, charged up front. If generation fails, the credits are refunded.
curl --request POST \
--url https://api.chariot.in/v1/tts/stream \
--header 'Content-Type: application/json' \
--header 'chariotai-api-key: <api-key>' \
--data '
{
"voice_id": "bac7d666-094d-4698-91fa-741d60fce662",
"text": "Hello from Chariot.",
"model_type": "v0"
}
'import requests
url = "https://api.chariot.in/v1/tts/stream"
payload = {
"voice_id": "bac7d666-094d-4698-91fa-741d60fce662",
"text": "Hello from Chariot.",
"model_type": "v0"
}
headers = {
"chariotai-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'chariotai-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
voice_id: 'bac7d666-094d-4698-91fa-741d60fce662',
text: 'Hello from Chariot.',
model_type: 'v0'
})
};
fetch('https://api.chariot.in/v1/tts/stream', 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.chariot.in/v1/tts/stream",
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([
'voice_id' => 'bac7d666-094d-4698-91fa-741d60fce662',
'text' => 'Hello from Chariot.',
'model_type' => 'v0'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"chariotai-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.chariot.in/v1/tts/stream"
payload := strings.NewReader("{\n \"voice_id\": \"bac7d666-094d-4698-91fa-741d60fce662\",\n \"text\": \"Hello from Chariot.\",\n \"model_type\": \"v0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("chariotai-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.chariot.in/v1/tts/stream")
.header("chariotai-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"voice_id\": \"bac7d666-094d-4698-91fa-741d60fce662\",\n \"text\": \"Hello from Chariot.\",\n \"model_type\": \"v0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chariot.in/v1/tts/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["chariotai-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voice_id\": \"bac7d666-094d-4698-91fa-741d60fce662\",\n \"text\": \"Hello from Chariot.\",\n \"model_type\": \"v0\"\n}"
response = http.request(request)
puts response.read_body"<string>"Authorizations
Your Chariot API key, generated from the dashboard. Send it in the chariotai-api-key header on every request.
Body
The voice to synthesize with. Get valid ids from GET /v1/voices.
"bac7d666-094d-4698-91fa-741d60fce662"
The text to synthesize. 1 to 500 characters after trimming whitespace.
1 - 500"Hello from Chariot."
The TTS model to use. Currently only v0 is available.
v0 Response
A chunked stream of raw PCM audio (16-bit LE, 44100 Hz, mono).
The response is of type file.