Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Generate speech audio from text using a supported voice. Returns base64 audio.
cURL
curl --request POST \ --url https://behaviq.io/v1/audio/tts \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "text": "<string>", "voice": "alloy", "speed": 2.125, "instructions": "<string>" } '
import requests url = "https://behaviq.io/v1/audio/tts" payload = { "text": "<string>", "voice": "alloy", "speed": 2.125, "instructions": "<string>" } 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: 'alloy', speed: 2.125, instructions: '<string>'}) }; fetch('https://behaviq.io/v1/audio/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://behaviq.io/v1/audio/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' => 'alloy', 'speed' => 2.125, 'instructions' => '<string>' ]), 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://behaviq.io/v1/audio/tts" payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"voice\": \"alloy\",\n \"speed\": 2.125,\n \"instructions\": \"<string>\"\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://behaviq.io/v1/audio/tts") .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .body("{\n \"text\": \"<string>\",\n \"voice\": \"alloy\",\n \"speed\": 2.125,\n \"instructions\": \"<string>\"\n}") .asString();
require 'uri' require 'net/http' url = URI("https://behaviq.io/v1/audio/tts") 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\": \"alloy\",\n \"speed\": 2.125,\n \"instructions\": \"<string>\"\n}" response = http.request(request) puts response.read_body
{ "audioBase64": "<string>", "contentType": "audio/mpeg" }
{ "error": { "code": "<string>", "message": "<string>", "details": "<unknown>" } }
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
1 - 4096
0.25 <= x <= 4
mp3
opus
aac
flac
wav
pcm
1 - 1000
Response for status 200
1
Was this page helpful?