curl --request POST \
--url https://api.boson.ai/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "Hello, this is a test.",
"model": "higgs-tts-3",
"voice": "default",
"response_format": "mp3",
"stream": false,
"ref_audio": "<string>",
"ref_text": "<string>",
"normalize": true,
"language": null,
"timestamps": false
}
'import requests
url = "https://api.boson.ai/v1/audio/speech"
payload = {
"input": "Hello, this is a test.",
"model": "higgs-tts-3",
"voice": "default",
"response_format": "mp3",
"stream": False,
"ref_audio": "<string>",
"ref_text": "<string>",
"normalize": True,
"language": None,
"timestamps": False
}
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({
input: 'Hello, this is a test.',
model: 'higgs-tts-3',
voice: 'default',
response_format: 'mp3',
stream: false,
ref_audio: '<string>',
ref_text: '<string>',
normalize: true,
language: null,
timestamps: false
})
};
fetch('https://api.boson.ai/v1/audio/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.boson.ai/v1/audio/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([
'input' => 'Hello, this is a test.',
'model' => 'higgs-tts-3',
'voice' => 'default',
'response_format' => 'mp3',
'stream' => false,
'ref_audio' => '<string>',
'ref_text' => '<string>',
'normalize' => true,
'language' => null,
'timestamps' => false
]),
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.boson.ai/v1/audio/speech"
payload := strings.NewReader("{\n \"input\": \"Hello, this is a test.\",\n \"model\": \"higgs-tts-3\",\n \"voice\": \"default\",\n \"response_format\": \"mp3\",\n \"stream\": false,\n \"ref_audio\": \"<string>\",\n \"ref_text\": \"<string>\",\n \"normalize\": true,\n \"language\": null,\n \"timestamps\": false\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.boson.ai/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"Hello, this is a test.\",\n \"model\": \"higgs-tts-3\",\n \"voice\": \"default\",\n \"response_format\": \"mp3\",\n \"stream\": false,\n \"ref_audio\": \"<string>\",\n \"ref_text\": \"<string>\",\n \"normalize\": true,\n \"language\": null,\n \"timestamps\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.boson.ai/v1/audio/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 \"input\": \"Hello, this is a test.\",\n \"model\": \"higgs-tts-3\",\n \"voice\": \"default\",\n \"response_format\": \"mp3\",\n \"stream\": false,\n \"ref_audio\": \"<string>\",\n \"ref_text\": \"<string>\",\n \"normalize\": true,\n \"language\": null,\n \"timestamps\": false\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Create a speech
Generate speech audio from text. Returns an audio file, or a stream of raw PCM chunks when stream is true. With timestamps: true, it returns JSON with the audio base64-encoded inside it instead, or Server-Sent Events when streamed. The body may be JSON or multipart/form-data — the latter lets you upload ref_audio as a raw file instead of base64-encoding it.
curl --request POST \
--url https://api.boson.ai/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "Hello, this is a test.",
"model": "higgs-tts-3",
"voice": "default",
"response_format": "mp3",
"stream": false,
"ref_audio": "<string>",
"ref_text": "<string>",
"normalize": true,
"language": null,
"timestamps": false
}
'import requests
url = "https://api.boson.ai/v1/audio/speech"
payload = {
"input": "Hello, this is a test.",
"model": "higgs-tts-3",
"voice": "default",
"response_format": "mp3",
"stream": False,
"ref_audio": "<string>",
"ref_text": "<string>",
"normalize": True,
"language": None,
"timestamps": False
}
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({
input: 'Hello, this is a test.',
model: 'higgs-tts-3',
voice: 'default',
response_format: 'mp3',
stream: false,
ref_audio: '<string>',
ref_text: '<string>',
normalize: true,
language: null,
timestamps: false
})
};
fetch('https://api.boson.ai/v1/audio/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.boson.ai/v1/audio/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([
'input' => 'Hello, this is a test.',
'model' => 'higgs-tts-3',
'voice' => 'default',
'response_format' => 'mp3',
'stream' => false,
'ref_audio' => '<string>',
'ref_text' => '<string>',
'normalize' => true,
'language' => null,
'timestamps' => false
]),
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.boson.ai/v1/audio/speech"
payload := strings.NewReader("{\n \"input\": \"Hello, this is a test.\",\n \"model\": \"higgs-tts-3\",\n \"voice\": \"default\",\n \"response_format\": \"mp3\",\n \"stream\": false,\n \"ref_audio\": \"<string>\",\n \"ref_text\": \"<string>\",\n \"normalize\": true,\n \"language\": null,\n \"timestamps\": false\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.boson.ai/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"Hello, this is a test.\",\n \"model\": \"higgs-tts-3\",\n \"voice\": \"default\",\n \"response_format\": \"mp3\",\n \"stream\": false,\n \"ref_audio\": \"<string>\",\n \"ref_text\": \"<string>\",\n \"normalize\": true,\n \"language\": null,\n \"timestamps\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.boson.ai/v1/audio/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 \"input\": \"Hello, this is a test.\",\n \"model\": \"higgs-tts-3\",\n \"voice\": \"default\",\n \"response_format\": \"mp3\",\n \"stream\": false,\n \"ref_audio\": \"<string>\",\n \"ref_text\": \"<string>\",\n \"normalize\": true,\n \"language\": null,\n \"timestamps\": false\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Body
Text to convert to speech. Up to 5,000 characters, or 50,000 with stream: true; longer input returns 400 input_too_long. May contain inline control tags, which don't count toward this limit. Must contain at least one letter or number outside control tags; input with nothing to say, such as ... or tags alone, returns 400 invalid_field_value. A <|...|> that isn't a documented control tag returns 400 invalid_field_value naming it. Long input is split at natural boundaries and synthesized in full.
1 - 50000"Hello, this is a test."
If true, stream raw PCM chunks as they are decoded. With timestamps: true, the stream is Server-Sent Events (text/event-stream) carrying the PCM and the timestamps instead. Requires response_format to be pcm. Raises the input limit to 50,000 characters, so use it for long input.
Expand non-standard words into spoken form before synthesis, including numbers, dates, times, currency, units, URLs, email addresses, phone numbers, abbreviations, and symbols. Enabled by default; set to false to synthesize the text exactly as written. Text with nothing to normalize is passed through unchanged. Inline tags are preserved. The old name enable_tn is no longer recognized and is ignored, so sending enable_tn: false leaves normalization on.
ISO 639-3 language code of the input text, for example eng (English) or cmn (Mandarin Chinese). Used for text normalization. Defaults to null, in which case normalization infers the language from the text; set it when you know the language for the most reliable results. An unsupported code returns 400 invalid_field_value, including when normalization is disabled. Only ISO 639-3 codes are accepted, in any letter case. A few alternative ISO 639-3 codes are also accepted, such as zho for Chinese and arb for Arabic. The old field name tn_language is no longer recognized and is ignored.
Attach token timestamps: the time each token of input is spoken, and its position in input. The response becomes a JSON envelope carrying the timestamps and the audio base64-encoded in the requested response_format, instead of raw audio bytes. With stream: true, it is Server-Sent Events carrying PCM chunks and timestamp entries instead of raw PCM. Works with long input and with normalize: entries are always on input as sent. See Timestamps.
Response
Generated audio. The content type depends on response_format, and a streamed response is raw PCM. With timestamps: true, the response is application/json instead, carrying the audio base64-encoded alongside the timestamps; streamed, it is text/event-stream.
The response is of type file.