Generate speech from text (Lightning)
curl --request POST \
--url https://api.smallest.ai/waves/v1/lightning/get_speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"voice_id": "<string>",
"sample_rate": 24000,
"speed": 1,
"language": "en",
"output_format": "pcm"
}
'import requests
url = "https://api.smallest.ai/waves/v1/lightning/get_speech"
payload = {
"text": "<string>",
"voice_id": "<string>",
"sample_rate": 24000,
"speed": 1,
"language": "en",
"output_format": "pcm"
}
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({
text: '<string>',
voice_id: '<string>',
sample_rate: 24000,
speed: 1,
language: 'en',
output_format: 'pcm'
})
};
fetch('https://api.smallest.ai/waves/v1/lightning/get_speech', 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.smallest.ai/waves/v1/lightning/get_speech",
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_id' => '<string>',
'sample_rate' => 24000,
'speed' => 1,
'language' => 'en',
'output_format' => 'pcm'
]),
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.smallest.ai/waves/v1/lightning/get_speech"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"sample_rate\": 24000,\n \"speed\": 1,\n \"language\": \"en\",\n \"output_format\": \"pcm\"\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.smallest.ai/waves/v1/lightning/get_speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"sample_rate\": 24000,\n \"speed\": 1,\n \"language\": \"en\",\n \"output_format\": \"pcm\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smallest.ai/waves/v1/lightning/get_speech")
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 \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"sample_rate\": 24000,\n \"speed\": 1,\n \"language\": \"en\",\n \"output_format\": \"pcm\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": "InvalidRequest",
"message": "The 'text' field is required."
}{
"error": "Unauthorized",
"message": "Bearer token is missing or invalid."
}{
"error": "InternalServerError",
"message": "An unexpected error occurred."
}Lightning
Text to speech
deprecated
Get speech for given text using the Waves API
POST
/
waves
/
v1
/
lightning
/
get_speech
Generate speech from text (Lightning)
curl --request POST \
--url https://api.smallest.ai/waves/v1/lightning/get_speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"voice_id": "<string>",
"sample_rate": 24000,
"speed": 1,
"language": "en",
"output_format": "pcm"
}
'import requests
url = "https://api.smallest.ai/waves/v1/lightning/get_speech"
payload = {
"text": "<string>",
"voice_id": "<string>",
"sample_rate": 24000,
"speed": 1,
"language": "en",
"output_format": "pcm"
}
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({
text: '<string>',
voice_id: '<string>',
sample_rate: 24000,
speed: 1,
language: 'en',
output_format: 'pcm'
})
};
fetch('https://api.smallest.ai/waves/v1/lightning/get_speech', 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.smallest.ai/waves/v1/lightning/get_speech",
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_id' => '<string>',
'sample_rate' => 24000,
'speed' => 1,
'language' => 'en',
'output_format' => 'pcm'
]),
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.smallest.ai/waves/v1/lightning/get_speech"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"sample_rate\": 24000,\n \"speed\": 1,\n \"language\": \"en\",\n \"output_format\": \"pcm\"\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.smallest.ai/waves/v1/lightning/get_speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"sample_rate\": 24000,\n \"speed\": 1,\n \"language\": \"en\",\n \"output_format\": \"pcm\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smallest.ai/waves/v1/lightning/get_speech")
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 \"text\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"sample_rate\": 24000,\n \"speed\": 1,\n \"language\": \"en\",\n \"output_format\": \"pcm\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": "InvalidRequest",
"message": "The 'text' field is required."
}{
"error": "Unauthorized",
"message": "Bearer token is missing or invalid."
}{
"error": "InternalServerError",
"message": "An unexpected error occurred."
}Authorizations
Bearer authentication header of the form Bearer <api_key>, where <api_key> is your api key.
Body
application/json
The text to convert to speech.
The voice identifier to use for speech generation.
The sample rate for the generated audio.
Required range:
8000 <= x <= 24000The speed of the generated speech.
Required range:
0.5 <= x <= 2Language code for text normalization (e.g., how numbers, dates, and abbreviations are spelled out). Specify a language code like 'en' or 'hi' to normalize text according to that language's rules.
Available options:
en, hi The format of the output audio.
Available options:
pcm, mp3, wav, mulaw Response
Synthesized speech retrieved successfully.
A PCM int16 WAV file at the specified sample rate.
⌘I

